[Plugin] Touch Display Lite

There is a actively developed plugin, touch display
Volumio only supports mouse operation, there is a way to navigate using xdotool.
I am using it to mimic a mouse via and Remote Contol.
But you need to spend some time to harvest locations on your screen.

Below a piece of code to handle the buttons to move the cursor around:

#!/usr/bin/python3.11
import lirc
import evdev
import subprocess

def ProcessIRRemote():
    #get IR command
    #keypress format = (hexcode, repeat_num, command_key, remote_id)
    try:
        keypress = conn.readline()
    except:
        keypress=""
             
    if (keypress != "" and keypress != None):
        data = keypress.split()
        sequence = data[1]
        command = data[2]
        
        #---------------------------------------------------------------------------------------------------------------------------------------
        #   Capture command repeats 
        #---------------------------------------------------------------------------------------------------------------------------------------
        if (sequence != "00"):
            # Mouse key Up
            if (command == 'KEY_UP'):
                subprocess.call('XAUTHORITY=~volumio/.Xauthority DISPLAY=:0 xdotool mousemove_relative -- 0 -20', shell=True)
            # Mouse key Left
            if (command == 'BTN_LEFT'):
                subprocess.call('XAUTHORITY=~volumio/.Xauthority DISPLAY=:0 xdotool mousemove_relative -- -20 0', shell=True)
            # Mouse key Right
            if (command == 'BTN_RIGHT'):
                subprocess.call('XAUTHORITY=~volumio/.Xauthority DISPLAY=:0 xdotool mousemove_relative  20 0', shell=True)
            # Mouse key Down
            if (command == 'KEY_DOWN'):
                subprocess.call('XAUTHORITY=~volumio/.Xauthority DISPLAY=:0 xdotool mousemove_relative  0 20', shell=True)
                
        #---------------------------------------------------------------------------------------------------------------------------------------
        #   Capture command single 
        #---------------------------------------------------------------------------------------------------------------------------------------
        else:
            # Mouse key Up
            if (command == 'KEY_UP'):
                subprocess.call('XAUTHORITY=~volumio/.Xauthority DISPLAY=:0 xdotool mousemove_relative -- 0 -5', shell=True)
                
            # Mouse key Left
            if (command == 'BTN_LEFT'):
                subprocess.call('XAUTHORITY=~volumio/.Xauthority DISPLAY=:0 xdotool mousemove_relative -- -5 0', shell=True)
                
            # Mouse key Mouse click
            if (command == 'KEY_OK'):
                subprocess.call('XAUTHORITY=~volumio/.Xauthority DISPLAY=:0 xdotool click 1', shell=True)
                
            # Mouse key Right
            if (command == 'BTN_RIGHT'):
                subprocess.call('XAUTHORITY=~volumio/.Xauthority DISPLAY=:0 xdotool mousemove_relative  5 0', shell=True)
                
            # Mouse key Down
            if (command == 'KEY_DOWN'):
                subprocess.call('XAUTHORITY=~volumio/.Xauthority DISPLAY=:0 xdotool mousemove_relative  0 5', shell=True)

#define Global
conn = lirc.LircdConnection()
conn.connect()
print("Starting Up...")
while True:         
      ProcessIRRemote()
1 Like