blob: 0d6213cf0866caed282fa547026f45a638c8b108 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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()
}
}
}
|