Battery widget #7
@@ -1,13 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import qs.Config
|
|
||||||
import qs.Modules
|
|
||||||
import qs.Components
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
text: Time.time
|
|
||||||
color: Config.useDynamicColors ? DynamicColors.palette.m3tertiary : "white"
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
CAnim {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -36,6 +36,10 @@ JsonObject {
|
|||||||
id: "tray",
|
id: "tray",
|
||||||
enabled: true
|
enabled: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "upower",
|
||||||
|
enabled: false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "clock",
|
id: "clock",
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Services.UPower
|
||||||
|
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
readonly property list<UPowerDevice> devices: UPower.devices.values
|
||||||
|
readonly property bool onBattery: UPower.onBattery
|
||||||
|
readonly property UPowerDevice displayDevice: UPower.displayDevice
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import qs.Config
|
|||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
import qs.Daemons
|
import qs.Daemons
|
||||||
import qs.Modules.Polkit
|
import qs.Modules.Polkit
|
||||||
|
import qs.Modules.UPower
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: root
|
id: root
|
||||||
@@ -160,6 +161,12 @@ RowLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DelegateChoice {
|
||||||
|
roleValue: "upower"
|
||||||
|
delegate: WrappedLoader {
|
||||||
|
sourceComponent: UPowerWidget {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
import qs.Components
|
||||||
|
import qs.Config
|
||||||
|
import qs.Helpers
|
||||||
|
import qs.Modules
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
implicitWidth: 100
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
function findDevice() {
|
||||||
|
for ( let i = 0; i < UPower.devices.count; i++ ) {
|
||||||
|
if ( UPower.devices[i].isLaptopBattery ) {
|
||||||
|
return UPower.devices[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
text: findDevice().percentage
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
|
main() {
|
||||||
|
if [[ ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
Reference in New Issue
Block a user