aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/xqtlauncher/xqtlauncher/xqtlauncher
blob: 4f2c9f937c96b67ba0999e864947d06a166dc293 (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
#set DISPLAY
export DISPLAY=:0.0
#check if the application is installed
if which $1 ; then
        echo start $1
        #is Xqt running?        
        if test ! -f /var/run/Xqt ;then
                #start Xqt              
                startxqt-wrapper
        fi
        #do we have atomate access? FIXME: make a function out of this and loop it
        if test -f /var/lock/xqtlauncher; then
                qcop QPE/TaskBar "message(QString)" "Was not able to lock access. Try again or remove /var/lock/xqtlauncher"
        else
                #lock access
                touch /var/lock/xqtlauncher
                if test -f /var/run/xqtlauncher; then
                        #atomate write nuber of applications running in xqt +1
                        echo $(($(cat /var/run/xqtlauncher ) + 1)) > /var/run/xqtlauncher
                else
                        echo 1 > /var/run/xqtlauncher
                fi              
                #remove lock
                rm /var/lock/xqtlauncher
                #start application
                $1
                #do we have atomate access? FIXME: make a function out of this and loop it
                if test -f /var/lock/xqtlauncher; then
                        qcop QPE/TaskBar "message(QString)" "Was not able to lock access. Try again or remove /var/lock/xqtlauncher" 
                else
                        #lock access
                        touch /var/lock/xqtlauncher
                        COUNTXQT=$(($(cat /var/run/xqtlauncher ) -1))
                        echo $COUNTXQT > /var/run/xqtlauncher 
                        if [ $COUNTXQT -le 0 ] ; then
                                #kill Xqt if there is no application running.
                                killall Xqt
                        fi
                        #remove lock                                            
                        rm /var/lock/xqtlauncher
                fi
        fi
else
        qcop QPE/TaskBar "message(QString)" "Application not found"
fi