dotfiles/.config/sway/scripts/screentemp

48 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# gps - get yours https://arpinux.org/public/arpinux-docs-pdf/gps.pdf
lat="43.21"
long="2.14"
# screen temp 6500~2800
cmax="6300"
cmin="3200"
# check and/or toggle screentemp
userlocale=$(echo $LANG | cut -b-2)
case $userlocale in
fr) messageon="coloration d'écran activée"
messageoff="coloration d'écran désactivée"
;;
*) messageon="screen temp enabled"
messageoff="screen temp disabled"
;;
esac
case "$1" in
toggle)
if ! pgrep -x wlsunset > /dev/null 2>&1; then
wlsunset -l $lat -L $long -g 0.8 -T $cmax -t $cmin &
notify-send "$messageon"
else
pkill wlsunset
notify-send "$messageoff"
fi
;;
check)
if ! pgrep -x wlsunset > /dev/null 2>&1; then
echo '{"text": "", "class": "off", "tooltip": "'$messageoff'"}'
else
echo '{"text": "", "class": "on", "tooltip": "'$messageon'"}'
fi
;;
*)
if ! pgrep -x wlsunset > /dev/null 2>&1; then
notify-send "$messageoff"
else
notify-send "$messageon"
fi
;;
esac
exit 0