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
|
|
|
|
|
|
|
|
is_on() {
|
|
|
|
|
[[ -e "${_status_file}" ]]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_on() {
|
|
|
|
|
touch "${_status_file}"
|
2022-01-14 16:31:19 +01:00
|
|
|
dunstctl set-paused true &
|
2020-12-20 20:36:27 +01:00
|
|
|
systemctl --user --no-block stop redshift.service
|
|
|
|
|
systemctl --user --no-block stop spotify.service
|
2020-02-14 14:30:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_off() {
|
|
|
|
|
rm -f "${_status_file}"
|
2022-01-14 16:31:19 +01:00
|
|
|
dunstctl set-paused false &
|
2020-12-20 20:36:27 +01:00
|
|
|
systemctl --user --no-block start redshift.service
|
|
|
|
|
systemctl --user --no-block start spotify.service
|
2020-02-14 14:30:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
|
status)
|
|
|
|
|
if is_on ; then
|
|
|
|
|
printf "on\n"
|
|
|
|
|
else
|
|
|
|
|
printf "off\n"
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|