LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   evdev, xte and xf86 buttons (https://www.linuxquestions.org/questions/linux-software-2/evdev-xte-and-xf86-buttons-4175666242/)

babag 12-19-2019 12:10 PM

evdev, xte and xf86 buttons
 
i'm using a second keyboard to assign macros and am running into some questions. generally, it works great. there are, however, a couple of instances where keys are reported as things like xf86back.

here's how my script starts, using evdev:
Code:

import os
from evdev import InputDevice, categorize, ecodes
#dev = InputDevice('/dev/input/event6') # Do not use event numbers for identifying keyboard as they change with reboots.
dev = InputDevice('/dev/input/by-id/usb-CHESEN_USB_Keyboard-event-kbd') # Use IDs for identifying keyboard as they do not change with reboots.
dev.grab()

for event in dev.read_loop():
  if event.type == ecodes.EV_KEY:
    key = categorize(event)
    if key.keystate == key.key_down:
        if key.keycode == 'KEY_ESC':
            os.system("xte 'keydown Control_L' 'keydown KP_0' 'keyup KP_0' 'keyup Control_L'") # Fill TS with 50ms roomtone

where the key is defined as 'KEY_ESC', how would i use something like an xf86 key call? if i just replace ESC with xf86back, for example, it doesn't work. tried all the variants for capitalization with no help.

thanks,
babag


All times are GMT -5. The time now is 09:43 PM.