Browse Source

Add reattach

add a wrapper function arround `xinput --reattach id master`
pull/2/head
Ali Hatami Tajik 2 years ago
parent
commit
fd23971bcc
  1. 16
      src/scripts/python/xutil/common.py

16
src/scripts/python/xutil/common.py

@ -33,6 +33,22 @@ def get_list_short(id):
ValueError(f'id[{id}] is not registered') ValueError(f'id[{id}] is not registered')
def reattach(id, master):
"""Reattach a device to a master
Args:
id (str|int): name of the slave or id
master (_type_): _description_
TODO: Error handling should be done. BUT, if the master is not a master or
id is not valid, xinput will not do anything and nothing bad will happen :)
"""
completed = subprocess.run(
['xinput', '--reattach', str(id), str(master)], capture_output=True)
return completed.returncode
def get_ids() -> List[int]: def get_ids() -> List[int]:
"""returns list of ids registered in xinput""" """returns list of ids registered in xinput"""
completed = subprocess.run( completed = subprocess.run(

Loading…
Cancel
Save