Merge branch 'main' into feat/fullscreen-reveal-bar
C++ / fmt (pull_request) Successful in 8s
JS/TS / fmt (pull_request) Successful in 12s
JS/TS / lint (pull_request) Successful in 15s
Python / static (pull_request) Successful in 51s
Rust / fmt (pull_request) Successful in 40s
Rust / build (pull_request) Successful in 1m45s
C++ / build (pull_request) Successful in 3m40s
Rust / clippy (pull_request) Successful in 1m32s
Python / verify (pull_request) Successful in 3m19s
C++ / clang-tidy (pull_request) Successful in 5m21s
C++ / fmt (pull_request) Successful in 8s
JS/TS / fmt (pull_request) Successful in 12s
JS/TS / lint (pull_request) Successful in 15s
Python / static (pull_request) Successful in 51s
Rust / fmt (pull_request) Successful in 40s
Rust / build (pull_request) Successful in 1m45s
C++ / build (pull_request) Successful in 3m40s
Rust / clippy (pull_request) Successful in 1m32s
Python / verify (pull_request) Successful in 3m19s
C++ / clang-tidy (pull_request) Successful in 5m21s
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
import QtQuick
|
||||
import ZShell.Config
|
||||
import qs.Services
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
|
||||
Row {
|
||||
id: root
|
||||
|
||||
property real batHeight: Tokens.padding.smaller * 2
|
||||
property real batWidth: Tokens.padding.larger * 2
|
||||
required property string devState
|
||||
property real nubHeight: Tokens.padding.small
|
||||
property real nubWidth: 2
|
||||
required property real percentage
|
||||
property real radius: Tokens.rounding.smallest / 2
|
||||
|
||||
spacing: 1
|
||||
|
||||
CustomRect {
|
||||
id: track
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: Battery.getColors(root.percentage, root.devState).bg
|
||||
height: root.batHeight
|
||||
radius: root.radius
|
||||
width: root.batWidth
|
||||
|
||||
CustomText {
|
||||
color: Battery.getColors(root.percentage, root.devState).fg
|
||||
font.pointSize: Tokens.font.size.larger / 1.5
|
||||
font.weight: 800
|
||||
height: track.height
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: Math.round(root.percentage * 100)
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: track.width
|
||||
}
|
||||
|
||||
Item {
|
||||
clip: true
|
||||
width: parent.width * root.percentage
|
||||
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
id: fill
|
||||
|
||||
color: Battery.getColors(root.percentage, root.devState).fg
|
||||
height: track.height
|
||||
radius: track.radius
|
||||
width: track.width
|
||||
|
||||
CustomText {
|
||||
id: batteryLabel
|
||||
|
||||
clip: true
|
||||
color: Battery.getColors(root.percentage, root.devState).bg
|
||||
font.pointSize: Tokens.font.size.larger / 1.5
|
||||
font.weight: 800
|
||||
height: track.height
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: Math.round(root.percentage * 100)
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: track.width
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
id: nub
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
bottomRightRadius: 20
|
||||
color: root.percentage < 0.99 ? track.color : fill.color
|
||||
height: root.nubHeight
|
||||
topRightRadius: 20
|
||||
width: root.nubWidth
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,6 @@ WidgetBase {
|
||||
name: "upower"
|
||||
|
||||
UPowerWidget {
|
||||
horizontal: root.horizontal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,17 @@ import Quickshell.Services.UPower
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property bool horizontal
|
||||
readonly property Item currentItem: batteryIconLoader?.item ?? peripheralIconLoader?.item ?? upowerIconLoader.item
|
||||
|
||||
implicitHeight: Battery.isLaptop ? batteryIconLoader.item.implicitHeight : upowerIconLoader.item.implicitHeight
|
||||
implicitWidth: Battery.isLaptop ? batteryIconLoader.item.implicitWidth : upowerIconLoader.item.implicitWidth
|
||||
implicitHeight: currentItem?.implicitHeight ?? 0
|
||||
implicitWidth: currentItem?.implicitWidth ?? 0
|
||||
|
||||
Behavior on Layout.preferredHeight {
|
||||
Anim {
|
||||
@@ -30,95 +31,36 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: Battery.startDaemon()
|
||||
|
||||
Loader {
|
||||
id: batteryIconLoader
|
||||
|
||||
active: Battery.isLaptop
|
||||
anchors.centerIn: parent
|
||||
|
||||
sourceComponent: Row {
|
||||
id: batteryIcon
|
||||
sourceComponent: BatteryIcon {
|
||||
devState: Battery.deviceStateString
|
||||
percentage: Battery.currentPerc
|
||||
}
|
||||
}
|
||||
|
||||
property real batHeight: 16
|
||||
property real batWidth: 30
|
||||
property real nubHeight: 6
|
||||
property real nubWidth: 2
|
||||
property real radius: Tokens.rounding.smallest / 2
|
||||
Loader {
|
||||
id: peripheralIconLoader
|
||||
|
||||
spacing: 1
|
||||
active: (Battery.lowestPeripheral?.isPresent ?? false) && !batteryIconLoader.active
|
||||
anchors.centerIn: parent
|
||||
|
||||
CustomRect {
|
||||
id: track
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: Battery.colors.bg
|
||||
height: batteryIcon.batHeight
|
||||
radius: batteryIcon.radius
|
||||
width: batteryIcon.batWidth
|
||||
|
||||
CustomText {
|
||||
color: Battery.colors.fg
|
||||
font.pointSize: Tokens.font.size.larger / 1.5
|
||||
font.weight: 800
|
||||
height: track.height
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: Math.round(Battery.currentPerc * 100)
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: track.width
|
||||
}
|
||||
|
||||
Item {
|
||||
clip: true
|
||||
width: parent.width * Battery.currentPerc
|
||||
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
id: fill
|
||||
|
||||
color: Battery.colors.fg
|
||||
height: track.height
|
||||
radius: track.radius
|
||||
width: track.width
|
||||
|
||||
CustomText {
|
||||
id: batteryLabel
|
||||
|
||||
clip: true
|
||||
color: Battery.colors.bg
|
||||
font.pointSize: 7.5
|
||||
font.weight: 800
|
||||
height: track.height
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: Math.round(Battery.currentPerc * 100)
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: track.width
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomRect {
|
||||
id: nub
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
bottomRightRadius: 20
|
||||
color: Battery.currentPerc < 0.99 ? track.color : fill.color
|
||||
height: batteryIcon.nubHeight
|
||||
topRightRadius: 20
|
||||
width: batteryIcon.nubWidth
|
||||
}
|
||||
sourceComponent: BatteryIcon {
|
||||
devState: Battery.lowestPeripheral?.state ?? ""
|
||||
percentage: Battery.lowestPeripheral?.percentage ?? 0
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: upowerIconLoader
|
||||
|
||||
active: !Battery.isLaptop
|
||||
active: !batteryIconLoader.active && !peripheralIconLoader.active
|
||||
anchors.centerIn: parent
|
||||
|
||||
sourceComponent: MaterialIcon {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Services.UPower
|
||||
import ZShell.Config
|
||||
import qs.Modules.Bar.Components.Common
|
||||
import qs.Helpers
|
||||
import qs.Components
|
||||
import qs.Services
|
||||
@@ -22,6 +24,31 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: Battery.allPeripherals
|
||||
|
||||
RowLayout {
|
||||
id: layout
|
||||
|
||||
required property var modelData
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Tokens.padding.normal
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Tokens.padding.normal
|
||||
|
||||
CustomText {
|
||||
Layout.fillWidth: true
|
||||
text: layout.modelData.model
|
||||
}
|
||||
|
||||
BatteryIcon {
|
||||
devState: layout.modelData.state
|
||||
percentage: layout.modelData.percentage
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomText {
|
||||
function formatSeconds(s: int, fallback: string): string {
|
||||
const day = Math.floor(s / 86400);
|
||||
@@ -75,7 +102,7 @@ Column {
|
||||
CustomText {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: Colors.palette.m3onError
|
||||
font.family: Appearance.font.family.mono
|
||||
font.family: Config.appearance.font.family.mono
|
||||
text: qsTr("Performance Degraded")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user