~charles/dotfiles

ref: b83f3b9ef9ba9b7c4a3cd5069e9e965add785c54 dotfiles/overlay/bin/system-launch-compositor -rwxr-xr-x 1.4 KiB
b83f3b9e — Charles Daniels various OpenBSD-related tweaks 3 years ago
                                                                                
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
#!/bin/sh

# .SCRIPTDOC

# Launch compton. My preferred settings are baked into this file. The purpose
# of this script is to try launch compton with different acceleration modes,
# which is necessary since different modes are available on different systems.

# .ENDOC


# kill any existing instances
pkill compton

# vsync methods in order of preference
VSYNC_METHODS="drm:opengl:opengl-oml:opengl-swc:opengl-mswc:none"

SHADOW_OPACITY=0
INACTIVE_OPACITY=1.0
INACTIVE_DIM=0.2
TITLEBAR_OPACITY=1.0
DROPDOWN_OPACITY=1.0
FADE_DURATION=2

COMPTON_OPTS="--shadow-opacity=$SHADOW_OPACITY "
COMPTON_OPTS="$COMPTON_OPTS -i $INACTIVE_OPACITY "
COMPTON_OPTS="$COMPTON_OPTS -e $TITLEBAR_OPACITY "
COMPTON_OPTS="$COMPTON_OPTS -m $DROPDOWN_OPACITY "
COMPTON_OPTS="$COMPTON_OPTS -D $FADE_DURATION "
COMPTON_OPTS="$COMPTON_OPTS --inactive-dim $INACTIVE_DIM "

# enable fade in / fade out
COMPTON_OPTS="$COMPTON_OPTS -f"

# run in background
COMPTON_OPTS="$COMPTON_OPTS -b"

# blur background for transparent windows
# COMPTON_OPTS="$COMPTON_OPTS --blur-background "

# exempted windows for shadow effects et al.
COMPTON_OPTS="$COMPTON_OPTS --focus-exclude name='rofi'"

echo "INFO: executing compton with options: $COMPTON_OPTS"

echo "$VSYNC_METHODS" | tr ':' '\n' | while read -r method ; do
	if compton $COMPTON_OPTS --vsync $method ; then
		echo "INFO: Launched compton successfully"
		exit 0
	fi
done