Skip to content

Instantly share code, notes, and snippets.

@ju916
Created April 29, 2019 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ju916/60990308b696007e4941f6a85d829e8f to your computer and use it in GitHub Desktop.
Save ju916/60990308b696007e4941f6a85d829e8f to your computer and use it in GitHub Desktop.
Skript to unlock XScreensaver
#!/bin/sh
# echo "USB device inserted `date` $@" >>/tmp/xscreenlock.log
#user=ju
user=`who | grep ':0' | awk '{print $1}'| head -1`
if [ ! -z "$user" ] ; then
# echo "$user is logged in :0"
# give it some time to settle
sleep 1
DISPLAY=:0 sudo -n -H -u "$user" /usr/bin/xscreensaver-command -deactivate >> /tmp/xscreenlock.log 2>>/tmp/xscreenlock.log
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment