- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
#!/usr/bin/env python3
import subprocess as sp
lines_pipe = sp.Popen(('xinput', 'list'), stdout=sp.PIPE)
id_line = str(sp.check_output(('grep', 'Touchpad'), stdin=lines_pipe.stdout))
a = id_line.index("id=") + 3
b = a
while id_line[b] in set(list("0123456789")):
b += 1
id = id_line[a:b]
status_pipe = sp.Popen(('xinput', 'list-props', id), stdout=sp.PIPE)
sp.run(('xinput', ['enable', 'disable'][int(str(sp.check_output(('grep', 'Device Enabled'), stdin=status_pipe.stdout))[-4]=='1')], id))