Skip to content

Commit

Permalink
synaptics touchpad desktop switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
chon219 committed May 20, 2012
1 parent 3c4b8ca commit e74ff24
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions scripts/touch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/python2

import subprocess
import os

pipe = subprocess.Popen(["synclient","-m","100"],stdout=subprocess.PIPE,stderr=subprocess.PIPE)

output = pipe.stdout
buf = 0
flag = 0
delta = 0
time = []

def action():
print buf
if buf > 150:
os.system("qdbus org.kde.kwin /KWin org.kde.KWin.nextDesktop")
elif buf < -150:
os.system("qdbus org.kde.kwin /KWin org.kde.KWin.previousDesktop")

while(True):
one = output.readline().split()
two = output.readline().split()
if one[0] != 'time' and two[0] != 'time':
t1 = float(one[0])
x1 = int(one[1])
z1 = int(one[3])
w1 = int(one[5])
t2 = float(two[0])
x2 = int(two[1])
z2 = int(two[3])
w2 = int(two[5])
if z1 > 40 and w1 >= 8 and z2 > 40 and w2 >= 8:
delta = x2 - x1
if flag:
dt = t2 - time[0]
if dt >0.4:
time = []
action()
buf = 0
flag = 0
else:
buf += delta
else:
flag = 1
buf += delta
time.append(t1)
time.append(t2)
elif abs(delta)> 1000 or z1 <= 40 or z2 <=40 or buf > 1500 or w1 < 8 or w2 < 8:
time = []
if flag:
action()
buf = 0
flag = 0
else:
buf = 0
flag = 0

0 comments on commit e74ff24

Please sign in to comment.