48 lines
828 B
Bash
Executable File
48 lines
828 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
_status_file="${XDG_RUNTIME_DIR}/presentation-mode-on"
|
|
|
|
is_on() {
|
|
[[ -e "${_status_file}" ]]
|
|
}
|
|
|
|
switch_on() {
|
|
touch "${_status_file}"
|
|
dunstctl set-paused true &
|
|
systemctl --user --no-block stop redshift.service
|
|
systemctl --user --no-block stop spotify.service
|
|
}
|
|
|
|
switch_off() {
|
|
rm -f "${_status_file}"
|
|
dunstctl set-paused false &
|
|
systemctl --user --no-block start redshift.service
|
|
systemctl --user --no-block start spotify.service
|
|
}
|
|
|
|
|
|
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
|
|
;;
|
|
off)
|
|
switch_off
|
|
;;
|
|
on)
|
|
switch_on
|
|
;;
|
|
esac
|
|
|
|
|