Last active
September 10, 2017 18:44
-
-
Save ob-ivan/958558086f6d1c534bc15129d510aed5 to your computer and use it in GitHub Desktop.
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/bash | |
# USAGE: | |
# - clone to ~/GitHub/screensaver-layout | |
# - edit ~/.config/lxsession/LXDE/autoload | |
# - add line: @~/GitHub/screensaver-layout/screensaver-layout.sh | |
# - save and exit | |
# - relogin to desktop environment | |
SYS_LAYOUTS=$(setxkbmap -query | grep 'layout' | awk '{ print $2 }') | |
trap "setxkbmap -layout $SYS_LAYOUTS; exit" SIGINT SIGQUIT SIGKILL | |
xscreensaver-command -watch | while read l | |
do | |
if [[ "$l" == *LOCK* ]] | |
then | |
setxkbmap -layout us | |
elif [[ "$l" == *UNBLANK* ]] | |
then | |
setxkbmap -layout $SYS_LAYOUTS | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment