rotatescreen N900 RotateScreen para rotar la pantalla de tu Nokia N900

RotateScreen es un programa hacho en Python capaz de activar la rotación automática de la pantalla de nuestro Nokia N900, para pasarla a modo vertical u horizontal automáticamente.

deben realizar lo siguiente:

crear e instalar rotate.py

  1. Crear el archivo en python (o descargarlo del final del post si son medios araganes, si lo descargan pasemos al punto 4). Si no deseamos descargarlo podemos utilizar, por ejemplo,  el programa ConTEXT.
  2. Copiamos y pegamos las siguientes líneas:
    from ctypes import *
    import os
    import sys
    import time
    from math import atan2
    from pprint import pprint
    
    xlib = cdll.LoadLibrary("libX11.so.6")
    rr = cdll.LoadLibrary("libXrandr.so.2")
    
    def get_rotation():
        f = open("/sys/class/i2c-adapter/i2c-3/3-001d/coord", 'r' )
        coords = [int(w) for w in f.readline().split()]
        f.close()
        return coords
    
    print get_rotation()
    
    def rotate(angle):
        rr.XRRSetScreenConfigAndRate(display,config,root,size,angle,rate,timestamp)
    
    display = xlib.XOpenDisplay(os.getenv("DISPLAY"))
    screen = xlib.XDefaultScreen(display)
    root = xlib.XDefaultRootWindow(display, screen)
    
    class XRRScreenConfiguration(Structure):
       pass
    
    gsi = rr.XRRGetScreenInfo
    gsi.restype = POINTER(XRRScreenConfiguration)
    config = gsi(display, root)
    
    current_time = c_ulong()
    rr.XRRTimes.restpye = c_ulong
    timestamp = rr.XRRTimes(display, screen, byref(current_time))
    
    xccr = rr.XRRConfigCurrentRate
    xccr.restype = c_int
    rate = xccr(config)
    
    rotation = c_ushort()
    size = rr.XRRConfigCurrentConfiguration(config, byref(rotation))
    
    while True:
        [x,y,z] = get_rotation()
        print x,y,z
        if y < -500:
            rotate(1)
        elif y > 500:
            rotate(4)
    
        elif x < -500:
            rotate(2)
        elif x > 500:
            rotate(8)
    
        time.sleep(1)
    
  3. Guarde el documento con el nombre de rotate.py (PY es la extensión de archivos Python)
  4. Copiar en una carpeta del N900 el archivo rotate.py.
  5. Iniciamos  xterm en N900 y escribimos:
    python rotate.py

Descargar

Te puede interesar