Compare commits

...

4 commits

2 changed files with 15 additions and 4 deletions

11
bin/batstat Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env sh
set -e
battery_capacity=$(cat "/sys/class/power_supply/${1}/capacity")
if [ "$battery_capacity" -lt 25 ]; then echo critical
elif [ "$battery_capacity" -lt 50 ]; then echo low
elif [ "$battery_capacity" -lt 75 ]; then echo medium
elif [ "$battery_capacity" -lt 100 ]; then echo high
else echo full
fi

View file

@ -1,7 +1,8 @@
#!/bin/sh -e
#!/usr/bin/env sh
set -e
screen_is_on() {
[ "$(brightnessctl g)" -ne 0 ]
[ "$(brightnessctl get)" -ne 0 ]
}
turn_on_screen() {
@ -10,7 +11,7 @@ turn_on_screen() {
turn_off_screen() {
brightnessctl -s
brightnessctl s 0
brightnessctl set 0
}
if screen_is_on; then
@ -18,4 +19,3 @@ if screen_is_on; then
else
turn_on_screen
fi