self.running = False
return False
method_name = f"handle_{pygame.event.event_name(ev.type).lower()}"
- for child in self.children:
+ for child in (self, *self.children):
if not hasattr(child, method_name):
continue
getattr(child, method_name)(ev)
"output": "eDP-1",
"type": "touchpad",
},
+ "ELAN9008:00 04F3:425B Stylus": {
+ "output": "eDP-1",
+ "type": "stylus",
+ "ignore_result": True,
+ },
"ELAN9008:00 04F3:425B Stylus Pen (0)": {
"output": "eDP-1",
"type": "stylus",
"output": "eDP-2",
"type": "touchpad",
},
+ "ELAN9009:00 04F3:425A Stylus": {
+ "output": "eDP-2",
+ "type": "stylus",
+ "ignore_result": True,
+ },
"ELAN9009:00 04F3:425A Stylus Pen (0)": {
"output": "eDP-2",
"type": "stylus",
enable = device["enabled"]
if enable:
subprocess.run(["xinput", "enable", device["id"]])
- subprocess.run(["xinput", "map-to-output", device["id"], device["output"]])
+ subprocess.run(
+ ["xinput", "map-to-output", device["id"], device["output"]],
+ stderr=subprocess.DEVNULL if device.get("ignore_result") else None,
+ )
else:
subprocess.run(["xinput", "disable", device["id"]])
self.conf = self.get_conf()
outputs = {o["name"]: o for o in self.xrandr_conf.get_relevant_outputs()}
state = None
for device in self.conf:
- if device["type"] != device_type or not outputs[device["output"]]["active"]:
+ if (
+ device["type"] != device_type
+ or not outputs[device["output"]]["active"]
+ or device.get("ignore_result")
+ ):
continue
new_state = device["enabled"]
if state is not None and new_state != state: