mabox-pipemenus/usr/bin/mabox-compositor
2024-12-08 22:29:26 +01:00

51 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# mabox-compositor - script to start|stop|restart picom
# by Daniel Napora <napcok@gmail.com>
. "$HOME/.config/mabox/mabox.conf"
backend=${picom_renderer:-glx}
start() {
CONFIGFILE="$HOME/.config/picom.conf"
if [ -f "$CONFIGFILE" ];then
picom --backend "$backend" --config "$CONFIGFILE" &
else
picom --backend "$backend" --config /usr/share/doc/picom/picom.conf.example &
fi
}
stop() {
if [ $(pgrep -u $USER picom) ]; then
killall -u $USER picom
fi
}
restart(){
stop
sleep 0.25
start
}
# OLD RESTART
#if [[ $1 = '--restart' ]]; then
# if pidof picom > /dev/null;then
# killall -q picom
# for (( i=0; i < RESTART_ATTEMPTS; i++ )); do
# pidof picom > /dev/null || # no process found! Safe to start again
# break
#
# (( i == RESTART_ATTEMPTS - 1 )) && # still didn't die? Probably hangs. Force it to die!
# killall -q -S KILL picom
#
# sleep 0.25
# done
# mabox-compositor --start
#fi
case "$1" in
--start) start;;
--stop) stop;;
--restart) restart;;
menu) menu "$2";;
esac
exit 0