summaryrefslogtreecommitdiffstats
path: root/firstboot-windowmanager
blob: ab79a4eee08907f450db9cfe412c94622ee6d8ca (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
#!/bin/sh

# This is the list of supported window manager binaries
WMS=("metacity" "kwin" "xfwm4" "openbox" "marco")

# Get the application binary to start and remove it from
# the argument list
BINARY=$1
shift

for WM in ${WMS[@]}; do
    FILE=$(which $WM 2>/dev/null)
    FOUND=$?

    if [ $FOUND -eq 0 -a -x "$FILE" ]; then
        # start window manager
        "$FILE" "$@" &
        pid=$!

        # start the application
        $BINARY
        res=$?

        # stop window manager
        kill $pid

        # return result
        exit $res
    fi
done

# No known window manager found
exit 1