balena-io-experimental / browser

A drop-in web browser block
98 stars 75 forks source link

Ability to enable screensaver/display power down? #102

Open Zebble opened 2 years ago

Zebble commented 2 years ago

We're testing this using KIOSK mode and it works brilliantly. Is there a way to have the screen powered down after a certain amount of time?

phil-d-wilson commented 2 years ago

Hey @Zebble - not with this block, but I was going to chat to @rahul-thakoor about making the scheduler service from balena dash into another block, so that projects could use it. I have numerous devices around the house running this browser block, but currently they are on 24/7.

Zebble commented 2 years ago

Thanks @phil-d-wilson - I did some digging into the scheduler service and that does seem like it will work by time, but possibly not by activity? (ie. 5 minutes after keyboard/mouse/touchscreen, turn off the screen).

I was able to modify the entrypoint/command through docker-compose for the browser service to do what I think will work for now.

entrypoint: bash
command: -c "(/usr/src/app/start.sh &) && sleep 15 && export XAUTHORITY=/home/chromium/.Xauthority && export DISPLAY=:0 && xset s 600 600 && xset +dpms && while true; do sleep 60; done;"
phil-d-wilson commented 2 years ago

Oh NICE!

Zebble commented 2 years ago

I made a slight change to my original workaround as this didn't seem to work when rolled out on balenaOS. This command works:

command: -c "(/usr/src/app/start.sh &) && sleep 15 && XAUTHORITY=/home/chromium/.Xauthority DISPLAY=:0 && xset s 600 600 && XAUTHORITY=/home/chromium/.Xauthority DISPLAY=:0 xset +dpms && while true; do sleep 60; done;"

You will want to adjust the "600"'s to whatever screen timeout you need (in seconds).

The only remaining issue is that at least on an LCD touchscreen, touching the screen not only wakes up the screen but acts as an active press on whatever area you happen to touch.

Zebble commented 1 year ago

Hey @phil-d-wilson, added a new XSET_COMMAND option in PR #104 that has worked well for many months. Hope this helps!