Created
September 23, 2015 19:16
-
-
Save shaiay/283a117d81890d85930b to your computer and use it in GitHub Desktop.
a screen locker for use with xautolock which enables locking without password when connected to home wifi
This file contains hidden or 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 | |
# | |
# example usage: | |
# xautolock -locker /full/path/to/screenlock.sh -corners 00-+ -detectsleep | |
# | |
# depends on xssstate which is part of suckless-tools: | |
# http://tools.suckless.org/ or | |
# apt-get suckless-tools on debian | |
# | |
simple_lock () { | |
# lock w/o password & don't exit until screen save turns off to comply with | |
# xautolock expected locker behaviour | |
xset s activate | |
sleep 1 | |
while [ $(xssstate -s) = "on" ]; do | |
sleep 1 | |
done | |
} | |
passwd_lock () { | |
# use whatever you like here | |
i3lock --dpms --color=222222 | |
} | |
connection=$(nmcli d show wlan0 | grep GENERAL.CONNECTION | awk '{print $2}') | |
if [ "$connection" = "my_ssid" ] ; then | |
simple_lock | |
else | |
passwd_lock | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment