z0rk
February 21, 2021, 9:00pm
1
Volumio Information
Volumio Version: 2.861
Hardware: x86
DAC: n/a
I would like to set my display off at all times regardless of lid open or closed or touch screen. I’ve tried the following.
/lib/systemd/system/screen_off.service
[Unit]
Description=screen off
After=volumio.service
[Service]
Type=oneshot
User=root
Group=root
ExecStart=/bin/bash /usr/bin/screen_off.sh
[Install]
WantedBy=multi-user.target
sudo chown root.root /lib/systemd/system/screen_off.service
/usr/bin/screen_off.sh
#!/bin/bash
xrandr -d :0 --output LVDS1 --off
chmod +x /usr/bin/screen_off.sh
sudo chown root.root /usr/bin/screen_off.sh
systemctl enable screen_off.service
My shell script works flawlessly from the CLI but not as a service.
Thanks
z0rk
February 22, 2021, 5:55am
2
The following works. Display turns off after 2 minutes.
/lib/systemd/system/screen_off.service
[Unit]
Description=screen off
[Service]
Type=oneshot
ExecStart=/usr/bin/screen_off.sh
/lib/systemd/system/screen_off.timer
[Unit]
Description=timer for screen_off
[Timer]
OnBootSec=2min
[Install]
WantedBy=timers.target
sudo chown root.root /lib/systemd/system/screen_off.service
sudo chown root.root /lib/systemd/system/screen_off.timer
/usr/bin/screen_off.sh (use xrandr -d :0 to determine display name)
#!/bin/bash
export XAUTHORITY=/home/volumio/.Xauthority
xrandr -d :0 --output LVDS1 --off
sudo chmod +x /usr/bin/screen_off.sh
sudo chown root.root /usr/bin/screen_off.sh
systemctl daemon-reload
systemctl enable screen_off.timer
gkkpch
February 22, 2021, 11:00am
3
In case you wish to run it headless, you can also prevent the UI from starting by disabling the volumio-kiosk.service
z0rk
February 26, 2021, 3:38pm
4
i like the convenience of just turning the display back on. i am not sure if that’s possible when running headless? thank you for mentioning it though i really appreciate it.
to turn display back on:
xrandr -d :0 --output LVDS1 --off