Files
dotfiles/i3/scripts/presentation-mode
Hannes Körber 571316c7a5 Move presentation_mode state file into XDG_RUNTIME_DIR
Because it is automatically cleaned up on boot, means we always start
with presentation_mode OFF
2020-02-23 14:00:20 +01:00

43 lines
811 B
Bash
Executable File

#!/usr/bin/env bash
_status_file="${XDG_RUNTIME_DIR}/presentation-mode-on"
_autostart="$HOME/.autostart.sh"
is_on() {
[[ -e "${_status_file}" ]]
}
switch_on() {
touch "${_status_file}"
systemctl --user --no-block kill --signal SIGUSR1 dunst_user
systemctl --user --no-block stop redshift
systemctl --user --no-block stop spotify
}
switch_off() {
rm -f "${_status_file}"
systemctl --user --no-block kill --signal SIGUSR2 dunst_user
"$_autostart" redshift spotify
}
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
esac