Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
lehrkraefte:blc:plg:stift [2023/11/03 10:50] Karlheinz Schubert [Stift bei mehreren Bildschirmen] |
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: | + | {{lehrkreafte: |
<code python> | <code python> | ||
- | # | + | #!/usr/bin/env -S python3 |
import subprocess | import subprocess | ||
Line 29: | Line 29: | ||
import sys | import sys | ||
- | displayId | + | # configure you devices: |
- | devNames | + | display_id_wayland = " |
+ | device_names_wayland = [" | ||
+ | display_id_x11 | ||
+ | device_names_x11 | ||
+ | # end configure | ||
verbose = False | verbose = False | ||
+ | |||
+ | |||
+ | def is_wayland(): | ||
+ | """ | ||
+ | ret_value = cmd(" | ||
+ | return ret_value == " | ||
def cmd(c): | def cmd(c): | ||
+ | """ | ||
print(c) if verbose else None | print(c) if verbose else None | ||
res = subprocess.check_output(c, | res = subprocess.check_output(c, | ||
Line 41: | Line 53: | ||
- | def getIDs(dev): | + | def get_device_id(device_name): |
- | id = re.search( | + | """ |
- | | + | id = re.search(r" |
- | | + | return |
- | return id | + | |
- | def setXinputMap(devId, displayId): | + | def set_xinput_mapping(device_id, display_id): |
- | cmd(f" | + | cmd(f" |
if __name__ == " | if __name__ == " | ||
- | args = sys.argv[1: | + | |
- | if len(args) > 0 and (" | + | |
- | verbose = True | + | if len(args) > 0 and (" |
- | else: | + | verbose = True |
- | print(" | + | else: |
- | for devName in devNames: | + | print(" |
- | | + | |
- | print(f" | + | if is_wayland(): |
- | | + | display_id = display_id_wayland |
- | + | device_names = device_names_wayland | |
- | print(" | + | |
+ | display_id | ||
+ | device_names = device_names_x11 | ||
+ | name_length = max([len(n) for n in device_names]) | ||
+ | | ||
+ | device_id = get_device_id(device_name) | ||
+ | | ||
+ | | ||
+ | | ||
+ | print(e) | ||
+ | print(" | ||
+ | input(" | ||
</ | </ |