Run custom script on screensaver start and end
-
Hi,
I am interested in having a custom script launch when the screensaver starts and end. I'm not a developer, but I can probably figure out Python enough to turn a GPIO pin turn off and on to trigger a high voltage relay. I'd like to turn off my monitor and translite when the screensaver kicks in, then turn them back on when the screensaver is done.
I could see other folks wanting to do something custom like gracefully shutdown their RetroPie, or really anything.
Is there a configuration that would allow this - screensaver run a custom script at startup and end? I'm asking here before I add it as an idea for the developers.
Thanks -
This would be possible if you check presence of OMXPlayer process. It's not an elegant method but it might work. But keep in mind you will loose opportunity to play video snapshots in gamelist
So the better way would be an implementation into the C++ code of ES itslef.
PSEUDOCODE
#!/bin/bash # Run this script with root user or sudo command # Initiate GPIO x ouput # Exports pin to userspace echo x > /sys/class/gpio/export # Sets pin x as an output echo out > /sys/class/gpio/gpiox/direction while true do # Slow down the whole thing a bit sleep 5 # Suggest running oxmplayer instance omxpid=$(pgrep omxplayer) # Set GPIO x high > switch off screen [[ -n $omxpid ]] && echo "1" > /sys/class/gpio/gpiox/value # Set GPIO x low > switch on screen [[ -z $omxpid ]] && echo "0" > /sys/class/gpio/gpiox/value done
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.