Created
January 20, 2016 07:42
-
-
Save eoldavix/fb15ad2397a1e5b7fb7b to your computer and use it in GitHub Desktop.
Turns on/off the screen at same time you unlock/lock your session in Elementary OS (should work in other distros)
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/bash | |
| # Author: David Carrera <eoldavix@gmail.com> | |
| dbus-monitor --session "interface=org.freedesktop.DBus.Properties,path=/org/gnome/SessionManager" | \ | |
| ( | |
| awk '/string "SessionIsActive"/ { | |
| getline | |
| if (index($0 ,"false") > 0) | |
| system("ssh pi@raspberrypi.local \"/opt/vc/bin/tvservice -p && /opt/vc/bin/tvservice -o\" &> /dev/null") | |
| else if (index($0, "true") > 0) | |
| system("ssh pi@raspberrypi.local \"/opt/vc/bin/tvservice -p && chvt 1 && chvt 7\" &> /dev/null") | |
| }' | |
| ) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Recomendable usar autenticación por clave pública agregada al anillo de contraseñas (o sin contraseña) para que el script funcione correctamente.