diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2025-09-28 19:57:25 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2025-09-28 19:57:25 +0530 |
| commit | ce2793694db5fdf3d6b5e5dac612528d61adede9 (patch) | |
| tree | 4ba3c03afadc6d89c2ca1151050b0a8fd188ab9b /hypr/hyprlock/status.sh | |
| parent | a9040e6e7da371a076dde035f2520775d2b24690 (diff) | |
modulaized hyprland + styled hyprlock from end4 config
Diffstat (limited to 'hypr/hyprlock/status.sh')
| -rw-r--r-- | hypr/hyprlock/status.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/hypr/hyprlock/status.sh b/hypr/hyprlock/status.sh new file mode 100644 index 0000000..0d4ec2d --- /dev/null +++ b/hypr/hyprlock/status.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +############ Variables ############ +enable_battery=false +battery_charging=false + +####### Check availability ######## +for battery in /sys/class/power_supply/*BAT*; do + if [[ -f "$battery/uevent" ]]; then + enable_battery=true + if [[ $(cat /sys/class/power_supply/*/status | head -1) == "Charging" ]]; then + battery_charging=true + fi + break + fi +done + +############# Output ############# +if [[ $enable_battery == true ]]; then + if [[ $battery_charging == true ]]; then + echo -n "(+) " + fi + echo -n "$(cat /sys/class/power_supply/*/capacity | head -1)"% + if [[ $battery_charging == false ]]; then + echo -n " remaining" + fi +fi + +echo '' |
