[PLUGIN] IR Remote Controller feedback thread

Turn your display on/off using a remote (in combination with Touch Display)

cd ~
nano togglescreen.sh

copy paste:

#!/bin/bash

# Set XAUTHORITY and DISPLAY environment variables
export XAUTHORITY=~volumio/.Xauthority
export DISPLAY=:0

# Run the xset q command to get DPMS information
output=$(xset q)

# Check each line of the output for DPMS status
if [[ $output == *"Monitor is On"* ]]; then
    echo "Monitor is ON => Turning OFF"
    xset dpms force off
elif [[ $output == *"Monitor is Off"* ]]; then
    echo "Monitor is OFF => Turning ON!"
    xset dpms force on
else
    echo "Unable to determine monitor status"
fi

chmod 755 togglescreen.sh

To make sure no strange EOL are added:
sed -i -e 's/\r$//' togglescreen.sh

Test script manual:
bash /home/volumio/togglescreen.sh

image

add to the lircrc file (choose your button):

begin
prog = irexec
button = KEY_D
config = /home/volumio/togglescreen.sh &
repeat = 0
end
1 Like