Toto je stará stránka, nová je tu.
This is old web page. New is here.

ThinkWiki - The Linux Thinkpad Wiki  

rotate.py


0 days and 4.95 hours since someone reset this sign. Record was 21 days and 18.88 hours.
p7091126

p7091126

Date: 07/09/2008

Moj desktop
Moj desktop
Linux kernel
Debian
Gentoo
ThinkWiki
Wikipedia
OpenMoko
OpenEZX
Jamendo
/.
47
Opera
Yellow Bulldozer
Pink Bulldozer
Christmas pudding
Football
OpenCola
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+: a-- C++ UL+++ P+ L++ E--- W++ N? o? K? w-- O? M? V? PS+ PE+(-) Y+ PGP+ t>+ 5++ X+ R+ tv-- b+ DI+ D G++ e>++ h-- r++ y?
------END GEEK CODE BLOCK------
Download file rotate.py
 1 #!/usr/bin/python
 2 #
 3 # This program is under GPLv3 license --
 4 # http://www.gnu.org/licenses/gpl-3.0.html
 5 #
 6 # If you think, that this script is usefull, please send me a postcard to
 7 # adress:
 8 # Michal Nanasi
 9 # Azalkova 1
10 # 82101 Bratislava
11 # Slovakia
12
13 import os,time,re,sys;
14
15 normal='xrandr --output LVDS --rotate normal'
16 left='xrandr --output LVDS --rotate left'
17 right='xrandr --output LVDS --rotate right'
18
19 type=0
20
21 while True:
22     time.sleep(0.1);
23     try:
24         f=open('/sys/devices/platform/hdaps/position','r')
25         line=f.readline()
26         m=re.search('.([0-9]*).*',line)
27 #       print m.group(1)
28         trash=int(m.group(1))
29         if(trash <400):
30             if type!=-1:
31                 os.system(right)
32                 time.sleep(1);
33                 type=-1
34         else:
35             if (trash >590):
36                 if type != 1:
37                     os.system(left)
38                     time.sleep(1);
39                     type=1
40             else:
41                 if type!=0:
42                     os.system(normal)
43                     time.sleep(1);
44                     type=0
45     except:
46         type=47
Created by Mic ( mic(at)ksp(dot)sk, ICQ: 281832795, jabber: mic47@jabber.sk) Tato stranka vyzera najlepsie na mojom monitore:-) A v prehliadacoch Opera, Iceweasel, Epiphany