2 changed files with 0 additions and 59 deletions
			
			
		| @ -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" |  | ||||
| @ -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) |  | ||||
					Loading…
					
					
				
		Reference in new issue