ubuntuusers.de

Anhang: touchpad.py

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
# -*- coding: utf-8 -*-

import os

def ReadFile():
    os.system("synclient -l |grep -i touchpadOff > /tmp/synclient.tmp")
    fileclient = file("/tmp/synclient.tmp", "r")
    for line in fileclient:
        word = line.split()
        if word[2] == "1":
            state = False
        else:
            state = True
    fileclient.close()
    return state
        

def switch():
    if ReadFile() == True:
        os.system("synclient touchpadoff=1")
        os.system("notify-send \"Touchpad\" \"Das Touchpad wurde ausgeschalten\" -t 5000")
    else:
        os.system("synclient touchpadoff=0")
        os.system("notify-send \"Touchpad\" \"Das Touchpad wurde eingeschalten\" -t 5000")


if __name__ == '__main__':
    switch()

Anhang herunterladen

Diese Revision wurde am 10. Oktober 2018 15:13 von ubuntuusers erstellt.