OSDN Git Service

new pidfile
[instantos/instantOS.git] / programs / ipicom
1 #!/bin/bash
2
3 # picom launcher that adapts to the environment
4
5 if [ -e /opt/instantos/potato ] || iconf -i potato; then
6     echo "no compositing for you, your pc is a potato"
7     exit
8 fi
9
10 genconfig() {
11
12     if [ -e ~/.compton.conf ]; then
13         rm ~/.compton.conf
14         echo "removed old compton file"
15     fi
16
17     mkdir -p ~/.config/picom
18     echo '# instantos
19 # remove the above comment to disable auto settings' >.config/picom/picom.conf
20
21     if ! grep -q 'hypervisor' /proc/cpuinfo; then
22         echo 'fading = true
23 fade-in-step = 0.15
24 fade-out-step = 0.15' >>.config/picom/picom.conf
25
26         echo "not a vm"
27         if iconf -i blur; then
28
29             # possibility 3:
30             tee -a .config/picom/picom.conf >/dev/null <<EOT
31 backend = "glx"
32 blur-background = true;
33 blur-background-frame = true;
34 blur-background-fixed = true;
35
36 blur-kern = "3x3box";
37 blur-method = "dual_kawase";
38 blur-strength = 5;
39 blur-background-exclude = [ "class_g = 'slop'", "class_g = 'Peek'", "class_g = 'Rofi'", "class_g = 'kdeconnect.daemon'"]
40
41 EOT
42         fi
43     else
44         echo "vm detected"
45     fi
46
47     if iconf -i vsync; then
48         echo "vsync=true" >> .config/picom/picom.conf
49     fi
50
51 }
52
53 cd || exit
54
55 if ! [ -e .config/picom/picom.conf ] ||
56     grep -q 'instantos' .config/picom/picom.conf &&
57     ! grep 'picom' ~/.instantrc | grep '0[^a-zA-Z]*$'; then
58     genconfig
59 fi
60
61 if (! grep -q 'hypervisor' /proc/cpuinfo &&
62     grep -q 'instantos' .config/picom/picom.conf &&
63     iconf -i blur) || iconf -i experimentalpicom; then
64     echo "running picom with blur support"
65     picom --experimental-backends &
66 else
67     picom "$@" &
68 fi