initial commit
This commit is contained in:
commit
9fde6d4fc6
27 changed files with 1110 additions and 0 deletions
32
modules/Battery.qml
Normal file
32
modules/Battery.qml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import QtQuick
|
||||
import Quickshell.Services.UPower
|
||||
import "." as M
|
||||
|
||||
Row {
|
||||
id: root
|
||||
spacing: 4
|
||||
visible: UPower.displayDevice?.isLaptopBattery ?? false
|
||||
|
||||
readonly property var dev: UPower.displayDevice
|
||||
readonly property real pct: (dev?.percentage ?? 0) * 100
|
||||
readonly property bool charging: dev?.state === UPowerDeviceState.Charging
|
||||
|
||||
Text {
|
||||
text: {
|
||||
if (root.charging) return "";
|
||||
const icons = ["","","","","","","","","","",""];
|
||||
return icons[Math.min(10, Math.floor(root.pct / 10))];
|
||||
}
|
||||
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
|
||||
font.pixelSize: M.Theme.fontSize + 2
|
||||
font.family: M.Theme.fontFamily
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Text {
|
||||
text: Math.round(root.pct) + "%"
|
||||
color: root.pct < 15 ? M.Theme.base08 : M.Theme.base05
|
||||
font.pixelSize: M.Theme.fontSize
|
||||
font.family: M.Theme.fontFamily
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue