From 730cc2325fe91d143e552863f5076867ea20e0c7 Mon Sep 17 00:00:00 2001 From: Ali Hatami Tajik Date: Sat, 11 Mar 2023 16:35:02 +0330 Subject: [PATCH] Fix create-master system error --- src/scripts/python/util/pointer.py | 5 ++--- src/scripts/python/util/x.py | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/scripts/python/util/pointer.py b/src/scripts/python/util/pointer.py index 0947943..fe4a0e7 100644 --- a/src/scripts/python/util/pointer.py +++ b/src/scripts/python/util/pointer.py @@ -1,5 +1,4 @@ -import x as xutil -import re +import util.x as xutil from enum import Enum @@ -43,7 +42,7 @@ class Pointer(XInput): super().__init__(name, id, state) def __repr__(self) -> str: - return f"" @property def slave(self): diff --git a/src/scripts/python/util/x.py b/src/scripts/python/util/x.py index 358e0e2..aa55a01 100644 --- a/src/scripts/python/util/x.py +++ b/src/scripts/python/util/x.py @@ -67,7 +67,7 @@ def create_master(name: str = "touch"): Args: name (str, optional): name of the master. Defaults to 'touch'. """ - completed = subprocess.run(["xinput create-master", name]) + completed = subprocess.run(["xinput", "create-master", name]) return completed.returncode @@ -79,13 +79,13 @@ def get_xi_id_by_name(name): name (str): name of the device """ completed = subprocess.run( - ["xinput list --id-only", name], capture_output=True + ["xinput", "list", "--id-only", name], capture_output=True ) if completed.returncode == 1: - return -1 + return None else: - int(completed.stdout.decode(ENCODING)) + return int(completed.stdout.decode(ENCODING)) def map_to_output(output, device_id):