diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2025-12-18 14:49:54 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2025-12-18 14:49:54 +0530 |
| commit | 29e3e7939b91c587a40e1c13babe1d8b15db180c (patch) | |
| tree | b07ec7f46c196edeb57d23ec461ec1f062e225f1 /quickshell | |
| parent | edaf04f79d33ba96ef7ac548fbad766e0546a200 (diff) | |
forgot about AC/DC(), .bin for personal stuff
Diffstat (limited to 'quickshell')
| -rw-r--r-- | quickshell/Procs.qml | 4 | ||||
| -rw-r--r-- | quickshell/items/Electrons.qml | 2 | ||||
| -rwxr-xr-x | quickshell/scripts/battery.sh | 3 | ||||
| -rw-r--r-- | quickshell/shell.qml | 1 |
4 files changed, 7 insertions, 3 deletions
diff --git a/quickshell/Procs.qml b/quickshell/Procs.qml index 7116604..8987b76 100644 --- a/quickshell/Procs.qml +++ b/quickshell/Procs.qml @@ -91,7 +91,9 @@ Scope { command: ["sh", "-c", "~/.config/quickshell/scripts/battery.sh"] stdout: SplitParser { onRead: data => { - battery = parseInt(data.trim()) || 0; + var parts = data.trim().split(/\s+/) + battery = parseInt(parts[0]) || 0; + batteryCharging = parseInt(parts[1]) || false; } } Component.onCompleted: running = true diff --git a/quickshell/items/Electrons.qml b/quickshell/items/Electrons.qml index f3164a0..769eda8 100644 --- a/quickshell/items/Electrons.qml +++ b/quickshell/items/Electrons.qml @@ -12,7 +12,7 @@ RowLayout { } } Text { - text: battery + text: (batteryCharging ? ("AC/DC(" + battery + ")") : battery) color: (battery <= redBatteryPoint) ? shellRoot.red : ((battery <= orangeBatteryPoint) ? shellRoot.orange : shellRoot.green) font { family: shellRoot.fontFamily diff --git a/quickshell/scripts/battery.sh b/quickshell/scripts/battery.sh index c7d4302..77f800a 100755 --- a/quickshell/scripts/battery.sh +++ b/quickshell/scripts/battery.sh @@ -1,2 +1,3 @@ battery=$(cat /sys/class/power_supply/BAT1/capacity) -echo "$battery" +charging=$(cat /sys/class/power_supply/ACAD/online) +echo "$battery $charging" diff --git a/quickshell/shell.qml b/quickshell/shell.qml index c232c0d..f860d74 100644 --- a/quickshell/shell.qml +++ b/quickshell/shell.qml @@ -56,6 +56,7 @@ ShellRoot { property int temperature: 6000 property int volume: 12 property int battery: 12 + property bool batteryCharging: false property string wifiName: "Offline" Procs {} |
