Is there a way to have a script called when batocera emulation station goes into screen saver? I see ones for quit, system-selected, etc. I would love it call a script so I can blank LED pixelcade. In below thread, someone made a udev rule, which is brilliant, but the screensaver option would be ideal.
https://pixelcade.org/forum/help-and-support/how-to-power-off-and-on/
Looks like batocera has a sleep event type, but it doesn't seem to be called on screensaver init.
https://forum.batocera.org/d/6972-emulationstation-scripts-not-working
Edit: Solved. It does call the script, but it needs to timeout itself, it is not called when you force the screensaver. I made script in:
/userdata/system/configs/emulationstation/scripts/sleep/01-pixelcade.sh
with the content
#!/bin/bash curl -s "http://127.0.0.1:8080/arcade/stream/black/dummy" >> /dev/null 2>/dev/null &
Awesome!
so in theory, there are hooks for screen savers at least according to the ES docs But I don't know if these were implemented in the Batocera fork of ES. So what you can do is create those directories and scripts (make sure to make them +x) and just see if they are triggered
screensaver-start after screensaver starts
scrensaver-stop after screensaver stops
screensaver-game-select screensaver is displaying the media for a game %system_name% %rom_path% %game_name% %media%
https://retropie.org.uk/docs/EmulationStation/ (see bottom of page)
see note 2.
@pixelcade-admin Thanks. I'll try those. See my edits above: "sleep" works in batocera and is called when the screensaver initializes. Works perfectly!
@jdog Ive tried to add a script to the `sleep` and `wake` paths `/userdata/system/configs/emulationstation/scripts/` but neither seem to trigger around the screensaver
I also noticed that the emulation-station `screen-saver` events does not trigger, but that might be a non-implemented event ?
Is your system actually going to sleep? as opposed to just turning the screen saver on? Or did you do something else? Much appreciated
/userdata/system/configs/emulationstation/scripts/sleep:
total 12
drwxr-xr-x 2 root root 4096 Nov 9 20:35 .
drwxr-xr-x 6 root root 4096 Nov 9 19:13 ..
-rwxr-xr-x 1 root root 85 Nov 9 20:35 sleep-01.sh/userdata/system/configs/emulationstation/scripts/wake:
total 12
drwxr-xr-x 2 root root 4096 Nov 9 20:40 .
drwxr-xr-x 6 root root 4096 Nov 9 19:13 ..
-rwxr-xr-x 1 root root 95 Nov 9 20:40 wake-01.sh
Just lost a *bunch* of typing when adding a reply...just entering this short update to make sure I don't get the "Sorry, there is something wrong with your data" error again.
OK - trying to type in my reply again:
@cgmckeever - I know it's been a while since your post, but thought I'd add this in case it sheds some light on the issues you were having. I, too, could not initially get the script (provided by the original poster here) to execute when the screensaver was triggered. Since the forums are still locked down, and I rarely have luck using Discord, I ran through some brut-force testing and discovered a potential bug in Batocera / EmulationStation.
When I had the Screensaver type set to "Slideshow", the script would not run. However, if I changed the Screensaver type to "Dim" or "Black" instead, the script would run perfectly as expected. I opened Issue 9181 with Batocera and am still waiting for a response. In the meantime, I've left the Screensaver type as "Dim" for now, but am working to map a controller key to run the script (so I can change back to using Slideshow).
am on PTO this week, can take a look here next week when back
No worries - the Batocera / ES team updated the issue and it appears a fix may already be coded.
When you do get back, I'd appreciate any help you can give on a related issue: Once the computer resumes ('wakes'), the Pixelcade will still be blank, and won't re-load an image until scrolling happens again through the games (or systems). Is there a way upon waking to have a script determine the last loaded game (or system) image and load that again? My guess is such a script would have to be placed in the /userdata/system/configs/emulationstation/scripts/wake directory...I'm just hoping there might be an existing Pixelcade script that could be copied or modified that has all or most of the logic already.
Thanks - enjoy your break.