OSDN Git Service

ipicom
[instantos/instantOS.git] / programs / ipicom
1 #!/bin/bash
2
3 # picom launcher that adapts to the environment
4 if [ -e /opt/instantos/potato ] || iconf -i potato; then
5     echo "no compositing for you, your pc is a potato"
6     exit
7 fi
8
9 genconfig() {
10
11     if [ -e ~/.compton.conf ]; then
12         rm ~/.compton.conf
13         echo "removed old compton file"
14     fi
15
16     mkdir -p ~/.config/picom
17     echo '# instantos
18 # remove the above comment to disable auto settings' >.config/picom/picom.conf
19
20     if ! grep -q 'hypervisor' /proc/cpuinfo; then
21         echo 'fading = true
22 fade-in-step = 0.15
23 fade-out-step = 0.15' >>.config/picom/picom.conf
24
25         echo "not a vm"
26         if iconf -i blur; then
27             echo 'backend = "glx"
28 blur-background = true;
29 blur-background-frame = true;
30 blur-background-fixed = true;
31
32 blur-kern = "3x3box";
33 blur-method = "dual_kawase";
34 blur-strength = 5;' >>.config/picom/picom.conf
35         fi
36     else
37         echo "vm detected"
38     fi
39
40 }
41
42 cd
43 if ! [ -e .config/picom/picom.conf ] || grep -q 'instantos' .config/picom/picom.conf; then
44     genconfig
45 fi
46
47 if ! grep -q 'hypervisor' /proc/cpuinfo &&
48     grep -q 'instantos' .config/picom/picom.conf &&
49     iconf -i blur; then
50     picom --experimental-backends
51 else
52     picom "$@"
53 fi