diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-09-07 08:52:44 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-09-07 08:52:44 +0200 |
| commit | c27ec9af26ee58d10c8a4120eb30ea30ed3e48dd (patch) | |
| tree | ea6468cef43a4c7b61c1d6c1f198535e9204d38a /local/bin | |
| parent | c2ef576bcf9b69059492f7b7b4dfe89eb438fe44 (diff) | |
| parent | fec8285a351a0586107fcba0d11d078d8d5cd368 (diff) | |
| download | dotfiles-c27ec9af26ee58d10c8a4120eb30ea30ed3e48dd.tar.gz dotfiles-c27ec9af26ee58d10c8a4120eb30ea30ed3e48dd.tar.bz2 dotfiles-c27ec9af26ee58d10c8a4120eb30ea30ed3e48dd.zip | |
Merge branch 'master' of cacharle.xyz:/srv/git/dotfiles
Diffstat (limited to 'local/bin')
| -rwxr-xr-x | local/bin/battery-low-check | 5 | ||||
| -rwxr-xr-x | local/bin/battery-low-notify | 14 |
2 files changed, 14 insertions, 5 deletions
diff --git a/local/bin/battery-low-check b/local/bin/battery-low-check deleted file mode 100755 index dbbdc6b..0000000 --- a/local/bin/battery-low-check +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -capacity=$(cat /sys/class/power_supply/BAT0/capacity) - -[ "$capacity" -lt 10 ] && notify-send -u critical "Battery low $capacity%" diff --git a/local/bin/battery-low-notify b/local/bin/battery-low-notify new file mode 100755 index 0000000..605ea91 --- /dev/null +++ b/local/bin/battery-low-notify @@ -0,0 +1,14 @@ +#!/bin/sh + +battery_dir='/sys/class/power_supply/BAT0' + +[ ! -d "$battery_dir" ] && exit 1 + +if [ "$(cat "$battery_dir/status")" != 'Charging' ] +then + capacity="$(cat "$battery_dir/capacity")" + [ "$capacity" -lt 15 ] && + notify-send -u critical "Battery low: $capacity%" +fi + +exit 0 |
