diff options
author | Luca Matei Pintilie <luca@lucamatei.com> | 2024-07-11 17:54:06 +0000 |
---|---|---|
committer | Luca Matei Pintilie <luca@lucamatei.com> | 2024-07-11 17:54:06 +0000 |
commit | c33e5300d9027103e72f1cbff386768997b90ffc (patch) | |
tree | 15b54660cedeb9c8abe5d5661fa5a064e0518221 /.config/hypr/hyprlock/status.sh | |
parent | d7a21e259b80010ce7368e8aaa0863886a947085 (diff) | |
download | dotfiles-c33e5300d9027103e72f1cbff386768997b90ffc.tar dotfiles-c33e5300d9027103e72f1cbff386768997b90ffc.tar.gz dotfiles-c33e5300d9027103e72f1cbff386768997b90ffc.tar.bz2 dotfiles-c33e5300d9027103e72f1cbff386768997b90ffc.tar.lz dotfiles-c33e5300d9027103e72f1cbff386768997b90ffc.tar.xz dotfiles-c33e5300d9027103e72f1cbff386768997b90ffc.tar.zst dotfiles-c33e5300d9027103e72f1cbff386768997b90ffc.zip |
hyprlock: add config
Diffstat (limited to '')
-rwxr-xr-x | .config/hypr/hyprlock/status.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/.config/hypr/hyprlock/status.sh b/.config/hypr/hyprlock/status.sh new file mode 100755 index 0000000..dd80633 --- /dev/null +++ b/.config/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 ''
\ No newline at end of file |