dotfiles/.config/sway/down-screen.sh

30 lines
924 B
Bash
Raw Normal View History

2021-12-11 15:02:56 +01:00
#!/bin/bash
2021-12-12 17:54:28 +01:00
######################################################
# down-screen - Script for sleep and resume monitors #
# Date: 12-12-2021 #
# Author: q3aql #
# Contact: q3aql@duck.com #
######################################################
2021-12-11 15:02:56 +01:00
2021-12-12 17:54:28 +01:00
# Load script for sleep and resume monitors
LoadScriptScreensaver="${HOME}/.config/sway/startwlrscreensaver.sh"
2021-12-11 15:02:56 +01:00
2021-12-12 17:54:28 +01:00
# Create or read init file
stateFile="${HOME}/.config/sway/screen-state"
if [ -f ${stateFile} ] ; then
echo "Screen State file detected"
else
echo "resume" > ${stateFile}
fi
# Boot parameters
current_state=$(cat ${stateFile})
if [ "${current_state}" == "resume" ] ; then
bash "${LoadScriptScreensaver}" sleep
echo "sleep" > ${stateFile}
elif [ "${current_state}" == "sleep" ] ; then
bash "${LoadScriptScreensaver}" resume
echo "resume" > ${stateFile}
fi