summaryrefslogtreecommitdiff
path: root/packages/zaurusd/files/zaurus-hinge.in
blob: f719ba3c769ec55f55e4889cffc50a83cd162c6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
#
# Quick handler for chkhinge26 and X. 
#

killproc() {            # kill the named process(es)
        pid=`/bin/ps -e x |
             /bin/grep $1 |
             /bin/grep -v grep |
             /bin/sed -e 's/^  *//' -e 's/ .*//'`
        [ "$pid" != "" ] && kill $pid
}

ZD_BINDIR="@bindir@"
export DISPLAY=:0

if [ -z "$1" ]; then
   echo "Usage: hinge-handler <state> ( 3 = closed, 0 = landscape, 2 = portrait )"
   exit 1
fi

panel_user="`ps aux|grep matchbox-panel|grep -v grep | awk '{print $2}'`"



STATE=$1

if [ $STATE = "3" ]; then

  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"

  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"

  for script in `ls -1 /etc/zaurusd/hinge-portrait.d`
  do
  	. /etc/zaurusd/hinge-portrait.d/$script
  done

  exit 0
fi