Skip to content

Instantly share code, notes, and snippets.

@intarstudents
Last active May 9, 2019 08:39
Show Gist options
  • Save intarstudents/33be20022dfc83195702868ba2d31ae8 to your computer and use it in GitHub Desktop.
Save intarstudents/33be20022dfc83195702868ba2d31ae8 to your computer and use it in GitHub Desktop.
Synergy client locking
#!/bin/bash
# sudo apt-get install inotify-tools xautomation
DISPLAY=:0
killall mate-screensaver
mate-screensaver &
CMD_FILE="remote-lock.cmd"
touch $CMD_FILE
while inotifywait -e close_write $CMD_FILE; do
case "$(< $CMD_FILE)" in
l)
mate-screensaver-command -l
xte "mousermove 1 1"
;;
u)
mate-screensaver-command -d
;;
esac
done
#!/bin/bash
dbus-monitor --session "type='signal',interface='org.mate.ScreenSaver'" |
while read x; do
case "$x" in
*"boolean true"*)
ssh user@ip 'echo "l" > remote-lock.cmd'
;;
*"boolean false"*)
ssh user@ip 'echo "u" > remote-lock.cmd'
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment