summaryrefslogtreecommitdiff
path: root/kanotix-lxde-extra/kanotix-start-compiz
blob: 7e3d478d15e23d9cf7e44d6ad1e0f33ad799110e (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh

 # kanotix-start-copmpiz 20131231
 # Start compiz via fusion-icon

! [ -x /usr/bin/compiz ] &&  exit 1   # check for compiz
[ "$(id -u)" = "0" ] && exit 2        # do not run as root
! [ -x /usr/sbin/lightdm ] && exit 3 # only start in lxde with ligthdm

if [ -e ~/.nocompiz ]; then
 # write openbox-config and start openbox
 # keep care we have this config in case fusion-icon is started from
 # menu later with the -n option
echo "compiz start disabled per user setting" >&2
cat <<"_EOF_" > ~/.config/compiz/fusion-icon
[compiz options]
loose binding = false
indirect rendering = false

[window manager]
active wm = openbox-lxde


_EOF_

if [ -e ~/.compton ]; then
echo "starting compton" >&2
compton -b
fi
exit 4
fi

# startup
if ! [ -e ~/.config/compiz/fusion-icon ]; then
 # write default config for fusion-icon, this is default, also
 # this can go to etcskel, but better keep here
cat <<"_EOF_" > ~/.config/compiz/fusion-icon
[compiz options]
loose binding = false
indirect rendering = false

[window manager]
active wm = compiz


_EOF_
fi
STARTFLAG=""
# catch if system is already running
if ps ax |grep -q [f]usion-icon; then
 echo "ERROR fusion-icon already running, this should not happen, killing" >&2
 pkill -9 fusion-icon
 fusion-icon $STARTFLAG >/dev/null 2>&1 &
 exit 5
fi
# force no compiz start with llvmpipe
if glxinfo|grep -q llvmpipe; then
echo "disable compiz on llvmpipe" >&2
sed -i s/"active wm = compiz"/"active wm = openbox-lxde"/ ~/.config/compiz/fusion-icon
STARTFLAG="-n"
fi

# start compiz/openbox choosen from config
if grep "openbox-lxde" ~/.config/compiz/fusion-icon; then
STARTFLAG="-n"
fi
if glxinfo|grep -q GLX_EXT_texture_from_pixmap; then
if [ -x /usr/bin/fusion-icon ]; then
 echo "starte fusion-icon"
 fusion-icon $STARTFLAG >/dev/null 2>&1 &     # start and reload windowmanager
else
 echo "ERROR fusion-icon not found, starting default" >&2
fi
else
 echo "Error no hardware support to start compiz" >&2
fi