Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
LAST_STATE=`system_profiler SPUSBDataType | grep -ci yubikey | cat`
while :
do
CURRENT_STATE=`system_profiler SPUSBDataType | grep -ci yubikey | cat`
if [ $LAST_STATE -eq $CURRENT_STATE ]; then
# do nothing
true
elif [ $LAST_STATE -lt $CURRENT_STATE ]; then
#echo "Key inserted"
LAST_STATE=$CURRENT_STATE
elif [ $LAST_STATE -gt $CURRENT_STATE ]; then
#echo "Key moved out"
LAST_STATE=$CURRENT_STATE
/System/Library/CoreServices/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine
fi;
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.