3 ms·
Make a little script, bind it to a hotkey. For me, I use Windows+S $ cat ~/bin/monitor-off.sh #!/bin/bash sleep .5 xset dpms force off Same little tri
by mmh0000 3y ago
Make a little script, bind it to a hotkey. For me, I use Windows+S
$ cat ~/bin/monitor-off.sh
#!/bin/bash
sleep .5
xset dpms force off
Same little trick for when I lock the screen, (Settings -> Notifications -> Screen Saver -> Configure Events):
cat ~/bin/LOCKSCREEN-ACTIONS.sh
#!/bin/bash
## Anything that is "slow" should be run in the background otherwise lock/unlock is slowed down
#Mute audio on screen lock, only if not already muted:
(
if [[ "$(amixer get Master | awk '/Front Left:/ {print $NF}')" = "[on]" ]]; then
amixer -q set Master mute
touch "${HOME}/.audiomutedbylockscreen"
fi
) &
#Pause foobar2000 only if playing, and make a note.
( "${HOME}/bin/foobar2000-pauseonly.sh" && touch "${HOME}/.foopausedbylockscreen" ) &
#Disable all mouses (to prevent movement waking monitor.)
"${HOME}/bin/set-mice-status" disable
#Force monitor to sleep.
"${HOME}/bin/monitor-off.sh"
And finally, I have the inverse of that, which is called on screen unlock, called automatically on screen unlock (Settings -> Notifications -> Screen Saver -> Configure Events):
cat ~/bin/UNLOCKSCREEN-ACTIONS.sh
#!/bin/bash
#Unmute audio only if muted by lockscreen:
(
if [ -f "${HOME}/.audiomutedbylockscreen" ]; then
amixer -q set Master unmute
rm -f "${HOME}/.audiomutedbylockscreen"
fi
) &
#Enable all mouses.
"${HOME}/bin/set-mice-status" enable &
#Unpause foobar2000 only if paused by lockscreen. Remove note.
(
if [ -f "${HOME}/.foopausedbylockscreen" ]; then
"${HOME}/bin/foobar2000-playonly.sh"
rm -f "${HOME}/.foopausedbylockscreen"
fi
) &
- wkat4242 3y agoOh cool I didn't know you could configure events. I made a script that just checks if kscreensaver is running but it always felt a bit duct tapeish. Thanks!