zaurusd: Make zaurus-hinge easier to use by external programs
authorMatthias Hentges <oe@hentges.net>
Tue, 6 Jun 2006 07:17:31 +0000 (07:17 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Tue, 6 Jun 2006 07:17:31 +0000 (07:17 +0000)
packages/zaurusd/files/zaurus-hinge.in
packages/zaurusd/files/zaurus-hinge.matchbox-landscape [new file with mode: 0644]
packages/zaurusd/files/zaurus-hinge.matchbox-portrait [new file with mode: 0644]
packages/zaurusd/zaurusd_svn.bb

index 1d4682e..f719ba3 100644 (file)
@@ -11,6 +11,7 @@ killproc() {            # kill the named process(es)
         [ "$pid" != "" ] && kill $pid
 }
 
+ZD_BINDIR="@bindir@"
 export DISPLAY=:0
 
 if [ -z "$1" ]; then
@@ -25,67 +26,33 @@ panel_user="`ps aux|grep matchbox-panel|grep -v grep | awk '{print $2}'`"
 STATE=$1
 
 if [ $STATE = "3" ]; then
-  #echo "sleeping"
-#
-# uncomment 'if' block below to have zaurus suspend on hinge close
-#
-#  if [ -x @bindir@/apm ]; then
-#    apm -s
-#  fi
+
+  for script in `ls -1 /etc/zaurusd/hinge-close.d`
+  do
+       . /etc/zaurusd/hinge-close.d/$script
+  done
+
   exit 0
 fi
 
 if [ $STATE = "0" ]; then
   #echo "landscape"
 
-  # As matchbox-panel updates its written configuration right after an applet dies / is killed, we can not be sure
-  # whether the user had gpe-panel in his preferences after rotating to portrait. And since there is a slim chance
-  # that a user changes his preferences from time to time, we renew that dumped configuration every now and then ;)
-
-  if ! test -e "/tmp/gpe-panel.session-$panel_user"
-  then
-    test -e /home/$panel_user/.matchbox/mbdock.session && cp /home/$panel_user/.matchbox/mbdock.session "/tmp/gpe-panel.session-$panel_user"
-    test -e "/tmp/gpe-panel.session-$panel_user" && cat "/tmp/gpe-panel.session-$panel_user" | grep -q panel || killproc @bindir@/mbinputmgr
-  else
-    cat "/tmp/gpe-panel.session-$panel_user" | grep -q panel || killproc @bindir@/mbinputmgr
-    rm "/tmp/gpe-panel.session-$panel_user"
-  fi
-   
-  # urg mbinputmgr should kill below
-  killproc @bindir@/matchbox-keyboard
-  killproc @bindir@/matchbox-stroke
-  if [ -x @bindir@/xrandr ]; then
-    xrandr -o normal
-  fi
+  for script in `ls -1 /etc/zaurusd/hinge-landscape.d`
+  do
+       . /etc/zaurusd/hinge-landscape.d/$script
+  done
+
   exit 0
 fi
 
 if [ $STATE = "2" ]; then
   #echo "portrait"
-  if [ -x @bindir@/xrandr ]; then
-    @bindir@/xrandr -o left 
-  fi
-  # just to be extra safe
-  sleep 1
-      
-  echo "panel_user = [$panel_user]"
-
-  if ! test -e "/tmp/gpe-panel.session-$panel_user"
-  then
-    cp /home/$panel_user/.matchbox/mbdock.session "/tmp/gpe-panel.session-$panel_user"
-  else
-    rm "/tmp/gpe-panel.session-$panel_user"
-  fi
-  
-  if test -n "$panel_user"
-  then
-    echo "Running panel as user [$panel_user]"
-    ps aux | grep "$panel_user" | grep -q "mbinputmgr " || su $panel_user -c @bindir@/mbinputmgr &
-  else
-     # A failsafe can't hurt
-     echo "Warning: Running mbinputmgr as root!"
-     ps aux | grep -q "mbinputmgr " || @bindir@/mbinputmgr &
-  fi
+
+  for script in `ls -1 /etc/zaurusd/hinge-portrait.d`
+  do
+       . /etc/zaurusd/hinge-portrait.d/$script
+  done
 
   exit 0
 fi
diff --git a/packages/zaurusd/files/zaurus-hinge.matchbox-landscape b/packages/zaurusd/files/zaurus-hinge.matchbox-landscape
new file mode 100644 (file)
index 0000000..e7b92b5
--- /dev/null
@@ -0,0 +1,21 @@
+  #!/bin/sh
+  
+  # As matchbox-panel updates its written configuration right after an applet dies / is killed, we can not be sure
+  # whether the user had gpe-panel in his preferences after rotating to portrait. And since there is a slim chance
+  # that a user changes his preferences from time to time, we renew that dumped configuration every now and then ;)
+
+  if ! test -e "/tmp/gpe-panel.session-$panel_user"
+  then
+    test -e /home/$panel_user/.matchbox/mbdock.session && cp /home/$panel_user/.matchbox/mbdock.session "/tmp/gpe-panel.session-$panel_user"
+    test -e "/tmp/gpe-panel.session-$panel_user" && cat "/tmp/gpe-panel.session-$panel_user" | grep -q panel || killproc ${ZD_BINDIR}/mbinputmgr
+  else
+    cat "/tmp/gpe-panel.session-$panel_user" | grep -q panel || killproc ${ZD_BINDIR}/mbinputmgr
+    rm "/tmp/gpe-panel.session-$panel_user"
+  fi
+   
+  # urg mbinputmgr should kill below
+  killproc ${ZD_BINDIR}/matchbox-keyboard
+  killproc ${ZD_BINDIR}/matchbox-stroke
+  if [ -x ${ZD_BINDIR}/xrandr ]; then
+    xrandr -o normal
+  fi
diff --git a/packages/zaurusd/files/zaurus-hinge.matchbox-portrait b/packages/zaurusd/files/zaurus-hinge.matchbox-portrait
new file mode 100644 (file)
index 0000000..bd04d32
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+  if [ -x ${ZD_BINDIR}/xrandr ]; then
+    ${ZD_BINDIR}/xrandr -o left 
+  fi
+  # just to be extra safe
+  sleep 1
+      
+  echo "panel_user = [$panel_user]"
+
+  if ! test -e "/tmp/gpe-panel.session-$panel_user"
+  then
+    cp /home/$panel_user/.matchbox/mbdock.session "/tmp/gpe-panel.session-$panel_user"
+  else
+    rm "/tmp/gpe-panel.session-$panel_user"
+  fi
+  
+  if test -n "$panel_user"
+  then
+    echo "Running panel as user [$panel_user]"
+    ps aux | grep "$panel_user" | grep -q "mbinputmgr " || su $panel_user -c ${ZD_BINDIR}/mbinputmgr &
+  else
+     # A failsafe can't hurt
+     echo "Warning: Running mbinputmgr as root!"
+     ps aux | grep -q "mbinputmgr " || ${ZD_BINDIR}/mbinputmgr &
+  fi
index 89291c4..4205213 100644 (file)
@@ -4,11 +4,14 @@ MAINTAINER = "Richard Purdie <rpurdie@openedhand.com>"
 LICENSE = "GPL"
 DEPENDS = "tslib"
 PV = "0.0+svn${SRCDATE}"
-PR = "r5"
+PR = "r6"
 
 SRC_URI = "svn://svn.o-hand.com/repos/misc/trunk;module=zaurusd;proto=http \
            file://zaurus-hinge.in \
-          file://add-poodle.patch;patch=1"
+          file://add-poodle.patch;patch=1 \
+          file://zaurus-hinge.matchbox-portrait \
+          file://zaurus-hinge.matchbox-landscape" 
+          
 
 S = "${WORKDIR}/${PN}"
 
@@ -18,6 +21,15 @@ do_configure_prepend () {
        cp ${WORKDIR}/zaurus-hinge.in ${S}/scripts
 }
 
+do_install_append() {
+       install -d "${D}/etc/zaurusd/hinge-landscape.d"
+       install -d "${D}/etc/zaurusd/hinge-portrait.d"
+       install -d "${D}/etc/zaurusd/hinge-close.d"
+       
+       install -m 0755 "${WORKDIR}/zaurus-hinge.matchbox-landscape" "${D}/etc/zaurusd/hinge-landscape.d/20-matchbox-landscape"
+       install -m 0755 "${WORKDIR}/zaurus-hinge.matchbox-portrait" "${D}/etc/zaurusd/hinge-portrait.d/20-matchbox-portrait"
+}
+
 inherit autotools pkgconfig update-rc.d
 
 INITSCRIPT_NAME = "zaurusd"