summaryrefslogtreecommitdiff
path: root/compton_toggle
blob: e24938782b082adcfa1db73a03c223683e327af4 (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
#!/usr/bin/zsh
nvidia_dev='/dev/nvidia0'
pidfile='/tmp/compton.pid'

if [[ -r $pidfile ]]; then
	read pid < $pidfile
	rm $pidfile
	if kill $pid; then
		exit 0
	fi
fi

if [[ -e $nvidia_dev ]]; then
	gpu_opts=
else
	gpu_opts=(--dbe --vsync opengl --backend xrender)
fi
compton $gpu_opts[@] -cGC -t-5 -l-5 -r4 -o.55 --no-fading-openclose &
pid=$!
if [[ -n $pid ]]; then
	printf '%s' $pid > $pidfile
else
	exit 1
fi
disown
exit 0