New rotate for OpenMoko

Thomas des Courières thomas.descourieres at gmail.com
Sun Oct 12 16:24:08 CEST 2008


Hi Ruis,
just wanted you to know i created a desktop icon in order to
activate/desactivate auto rotate.

It works with 2008.9/FDOM, but should work with other distributions.
I extended the /etc/init.d/accel-rotate to add it a "switch" function, and
used the tap/untap icon for the desktop entry.

Here you got it all.
Greetings

************ /etc/init.d/accel-rotate

#! /bin/sh
#
# accel-rotate
#
# description: this script starts accel-rotate daemon
# processname: accel-rotate

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
NAME=accel-rotate
CMD=`which accel-rotate`

[ -f /etc/default/rcS ] && . /etc/default/rcS

case "$1" in
    start)
        echo -n "Starting accel-rotate daemon: "
        start-stop-daemon --start --pidfile /var/run/${NAME}.pid
--make-pidfile --background -x ${CMD}
        if [ $? = 0 ]; then
            echo "(ok)"
        else
            echo "(failed)"
        fi
        ;;
    stop)
        echo -n "Stopping accel-rotate daemon: "
        start-stop-daemon --stop --pidfile /var/run/${NAME}.pid --oknodo
        rm -f /var/run/${NAME}.pid
        echo "(done)"
        ;;
    switch)
        echo "Switching state of accel-rotate daemon: "
        if [ -e "/var/run/${NAME}.pid" ]; then
            /etc/init.d/accel-rotate stop
        else
            /etc/init.d/accel-rotate start
        fi
        ;;
    restart|force-reload)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|switch|force-reload}"
        exit 1
        ;;
esac

exit 0

************ /usr/share/applications/rotate.desktop
[Desktop Entry]
Encoding=UTF-8
Name=.Rotate 0/1
Comment=Autorotate the screen
Exec=/etc/init.d/accel-rotate switch
Icon=tapuntap
Terminal=false
Type=Application
Categories=Office;
MimeType=text/x-vcard;
SingleInstance=true
StartupNotify=false
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openmoko.org/pipermail/community/attachments/20081012/63a36d21/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: accel-rotate
Type: application/octet-stream
Size: 1177 bytes
Desc: not available
Url : http://lists.openmoko.org/pipermail/community/attachments/20081012/63a36d21/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rotate.desktop
Type: application/octet-stream
Size: 244 bytes
Desc: not available
Url : http://lists.openmoko.org/pipermail/community/attachments/20081012/63a36d21/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tapuntap.png
Type: image/png
Size: 3362 bytes
Desc: not available
Url : http://lists.openmoko.org/pipermail/community/attachments/20081012/63a36d21/attachment.png 


More information about the community mailing list