Last active
August 29, 2015 14:07
-
-
Save afresh1/c334372b05c3288dcdd8 to your computer and use it in GitHub Desktop.
A set of scripts to lock my screen and turn off the laptop screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if ! pgrep xlock >/dev/null 2>&1; then | |
xlock -lockdelay 0 -endCmd ssh-add & | |
sleep 1 | |
fi | |
sudo -k | |
ssh-add -D | |
~/bin/monitors_off & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if pgrep xlock >/dev/null 2>&1; then | |
DISPLAY=`pgrep -nfl '[ /]X :[0-9]+ vt05' | | |
sed -e 's/^[^:]*\(:[0-9][0-9]*\)[^0-9].*/\1/'` | |
if [ X"${DISPLAY}" != X"" ]; then | |
xset -display ${DISPLAY} dpms force off | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment