2020-02-14 14:30:43 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2020-02-23 14:00:17 +01:00
|
|
|
_status_file="${XDG_RUNTIME_DIR}/presentation-mode-on"
|
2020-02-14 14:30:43 +01:00
|
|
|
_autostart="$HOME/.autostart.sh"
|
|
|
|
|
|
|
|
|
|
is_on() {
|
|
|
|
|
[[ -e "${_status_file}" ]]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_on() {
|
|
|
|
|
touch "${_status_file}"
|
2020-10-05 21:55:12 +02:00
|
|
|
dunstctl disable &
|
2020-12-11 20:05:55 +01:00
|
|
|
systemctl --user --no-block stop user:redshift
|
|
|
|
|
systemctl --user --no-block stop user:spotify
|
2020-02-14 14:30:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_off() {
|
|
|
|
|
rm -f "${_status_file}"
|
2020-10-05 21:55:12 +02:00
|
|
|
dunstctl enable &
|
2020-12-11 20:05:55 +01:00
|
|
|
"$_autostart" redshift spotify
|
2020-02-14 14:30:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
|
status)
|
|
|
|
|
if is_on ; then
|
|
|
|
|
printf "on\n"
|
|
|
|
|
printf '#F4BF75'
|
|
|
|
|
else
|
|
|
|
|
printf "off\n"
|
|
|
|
|
# printf '#F4BF75'
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
toggle)
|
|
|
|
|
if is_on ; then
|
|
|
|
|
switch_off
|
|
|
|
|
else
|
|
|
|
|
switch_on
|
|
|
|
|
fi
|
2020-02-28 21:32:11 +01:00
|
|
|
;;
|
|
|
|
|
off)
|
|
|
|
|
switch_off
|
|
|
|
|
;;
|
|
|
|
|
on)
|
|
|
|
|
switch_on
|
|
|
|
|
;;
|
2020-02-14 14:30:43 +01:00
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|