lehrkraefte:blc:plg:stift

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lehrkraefte:blc:plg:stift [2023/12/18 19:36]
Karlheinz Schubert extend for Wayland or X++ usage
lehrkraefte:blc:plg:stift [2024/01/20 10:59] (current)
Karlheinz Schubert
Line 21: Line 21:
 Folgendes Python-Script behebt das Problem, indem es den Stift nur auf den TouchScreen des Laptops (eDP-1) mapped:  Folgendes Python-Script behebt das Problem, indem es den Stift nur auf den TouchScreen des Laptops (eDP-1) mapped: 
  
-{{lehrkraefte:sbt:map-pen.py}}+{{lehrkreafte:sbt:map-pen.py |}}
 <code python> <code python>
-#!/usr/bin/python3+#!/usr/bin/env -S python3
  
 import subprocess import subprocess
Line 64: Line 64:
  
 if __name__ == "__main__": if __name__ == "__main__":
-    args = sys.argv[1:+    try: 
-    if len(args) > 0 and ("-v" in args or "--verbose" in args): +        args = sys.argv[1:
-        verbose = True +        if len(args) > 0 and ("-v" in args or "--verbose" in args): 
-    else: +            verbose = True 
-        print("Use -v or --verbose to see xinput output\nSet mappings:"+        else: 
-    is_wayland() +            print("Use -v or --verbose to see xinput output\nSet mappings:"
-    if is_wayland(): +        is_wayland() 
-        display_id = display_id_wayland +        if is_wayland(): 
-        device_names = device_names_wayland +            display_id = display_id_wayland 
-    else: +            device_names = device_names_wayland 
-        display_id = display_id_x11 +        else: 
-        device_names = device_names_x11 +            display_id = display_id_x11 
-    name_length = max([len(n) for n in device_names]) +            device_names = device_names_x11 
-    for device_name in device_names: +        name_length = max([len(n) for n in device_names]) 
-        device_id = get_device_id(device_name) +        for device_name in device_names: 
-        print(f" - Map {device_name:{name_length}} with Id={device_id:02d} to '{display_id}'"+            device_id = get_device_id(device_name) 
-        set_xinput_mapping(device_id, display_id) +            print(f" - Map {device_name:{name_length}} with Id={device_id:02d} to '{display_id}'"
 +            set_xinput_mapping(device_id, display_id) 
 +    except Exception as e: 
 +        print(e)
     print("")     print("")
 +    input("Press Enter to continue...")
  
 </code> </code>
  • lehrkraefte/blc/plg/stift.1702924590.txt.gz
  • Last modified: 2023/12/18 19:36
  • by Karlheinz Schubert