Files
dotfiles/config/.scripts/startup.sh
TuDatTr 686f13e21c Added check in config/.scripts/*.sh scripts wether the needed commands are available
Fixed shebang for some scrips
Removed unnecessary config/.scripts/lock.sh and replaced lock.sh with i3lock.py in the script that executed lock.sh
2020-05-22 01:55:37 +02:00

38 lines
725 B
Bash
Executable File

#!/bin/sh
type xset >/dev/null 2>&1 || { echo >&2 "I require xset but it's not installed. Aborting."; exit 1; }
lower_battery_threshold=10
KBD="";
oldKBD="";
function kb_routine {
oldKBD="$KBD";
case "$(xset -q | grep -A 0 'LED' | cut -c59-67)" in
"00000000")
KBD="English (US)" ;;
"00001000")
KBD="Deutsch" ;;
*) KBD="unknown" ;;
esac
if [ "$KBD" != "$oldKBD" ]; then
dunstify -r 1 "$KBD";
fi
}
function battery_routine {
capacity=$(< /sys/class/power_supply/BAT0/capacity)
if [[ $capacity -lt lower_battery_threshold ]]; then
dunstify "$capacity";
fi
}
while :
do
kb_routine
battery_routine
sleep 1;
done