summaryrefslogtreecommitdiff
path: root/.config/quickshell/Services/Battery.qml
diff options
context:
space:
mode:
authorSam Nystrom <sam@samnystrom.dev>2026-01-15 16:53:43 -0500
committerSam Nystrom <sam@samnystrom.dev>2026-01-15 16:53:43 -0500
commit53008538e5bef961e9ceb5abc5c5ee05a559e97d (patch)
tree3ad2f4fa7fbc88ff4bb67c75395cc4acdb9c09fb /.config/quickshell/Services/Battery.qml
parent3ac17574dbcfe68b2fba11aeeb445f04d1170c2a (diff)
update qs config
Diffstat (limited to '.config/quickshell/Services/Battery.qml')
-rw-r--r--.config/quickshell/Services/Battery.qml33
1 files changed, 33 insertions, 0 deletions
diff --git a/.config/quickshell/Services/Battery.qml b/.config/quickshell/Services/Battery.qml
new file mode 100644
index 0000000..0d6213c
--- /dev/null
+++ b/.config/quickshell/Services/Battery.qml
@@ -0,0 +1,33 @@
+pragma Singleton
+
+import Quickshell
+import Quickshell.Io
+import QtQuick
+
+Singleton {
+ id: root
+ property string status: "Discharging"
+ property int capacity: 0
+
+ FileView {
+ id: statusFile
+ path: "/sys/class/power_supply/BAT0/status"
+ onLoaded: root.status = this.text().trim()
+ }
+
+ FileView {
+ id: capacityFile
+ path: "/sys/class/power_supply/BAT0/capacity"
+ onLoaded: root.capacity = parseInt(this.text().trim())
+ }
+
+ Timer {
+ interval: 10000
+ running: true
+ repeat: true
+ onTriggered: {
+ statusFile.reload()
+ capacityFile.reload()
+ }
+ }
+}