From 95aa7df506879c8d5755234a3cb6cad263148500 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 15 Sep 2024 18:02:26 +0330 Subject: [PATCH] Refactoring --- src/rules/90-hid-mouse.rules | 13 --------- src/scripts/xscript/changemouse.py | 46 ------------------------------ 2 files changed, 59 deletions(-) delete mode 100644 src/rules/90-hid-mouse.rules delete mode 100644 src/scripts/xscript/changemouse.py diff --git a/src/rules/90-hid-mouse.rules b/src/rules/90-hid-mouse.rules deleted file mode 100644 index 37e0e3e..0000000 --- a/src/rules/90-hid-mouse.rules +++ /dev/null @@ -1,13 +0,0 @@ -# Following rule will take affect after binding/unbinding action of HID devices -# which is expected. These rules only take effect one time for each mouse -# insertion, removal. Actually, usb events are triggered when usb and -# usb interface are binding but hid is more specific and happen once for each -# action. change action is not used because -# XAUTHORUTY and DISPLAY must be set and related to the current session. It may -# vary with different graphic drivers. -SUBSYSTEM=="hid", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/run/user/1000/gdm/Xauthority", ACTION=="bind", RUN+="/usr/local/bin/changemouse.py" - -# the following line may not be needed as when we unplug a mouse it would -# automatically remove devices from the list and they need no furthur -# configuration -# SUBSYSTEM=="hid", ACTION=="unbind", RUN+="/usr/local/bin/changemouse.py" \ No newline at end of file diff --git a/src/scripts/xscript/changemouse.py b/src/scripts/xscript/changemouse.py deleted file mode 100644 index 7ffb3c7..0000000 --- a/src/scripts/xscript/changemouse.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 - -"""Change mouse script - -Whenever a mouse is changed to the system, this script will be executed. These -are the rules: - + All regular mouses should connect to the "Virtual core pointer" of the - system - + Touchpanel should be connected to the master "touch-pointer" - -NOTE: if master `touch` is not present in the system, the script will create a - master `touch` itself and hides the pointer. eGalax device input will be - attached to this master. TODO: make master's cursor invisible. - - Currently we'll use xinput command-line application, but, It is possible - to write a specified c program that uses Xlib efficiently. - - Steps: - + List all pointer as we don't know what pointer is added to the system - + group them by their usage by name rules (As if the pointer is eGalax - touch pointer it should be attached to the touch-pointer o.w. it - should be attached to Vitual core pointer (OR trackball TODO)) - - utility functions to find and group pointers aer available in xutil module. - -NOTE: In case of psyco adds and removes mouses with intervals smaller than run - time of this code (which is not probabale at all) a lockfile is used so that - only one instance of this code is running at a moment so no conflicts occur. -""" - -import util.pointer as putil -import util.x as xutil - -if __name__ == "__main__": - """Configure Pointers - - Execution time: 140ms avg -> Tolarable - """ - v_core, touch_master, e_galax, pointers = putil.get_pointers_categorized() - if e_galax: - xutil.reattach(e_galax.id, touch_master.id) - else: - # TODO: disable touch? - pass - for p in pointers: - xutil.reattach(p.id, v_core.id)