mabox-pipemenus/usr/bin/mabox-compositor

51 lines
1.1 KiB
Plaintext
Raw Normal View History

2016-03-25 19:02:03 +01:00
#!/bin/bash
2024-12-08 22:29:26 +01:00
# mabox-compositor - script to start|stop|restart picom
2016-03-25 19:02:03 +01:00
# by Daniel Napora <napcok@gmail.com>
2024-12-08 22:29:26 +01:00
. "$HOME/.config/mabox/mabox.conf"
2016-03-25 19:02:03 +01:00
2024-12-08 22:29:26 +01:00
backend=${picom_renderer:-glx}
2017-01-04 19:18:24 +01:00
2024-12-08 22:29:26 +01:00
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
2016-03-25 19:02:03 +01:00
2024-12-08 22:29:26 +01:00
case "$1" in
--start) start;;
--stop) stop;;
--restart) restart;;
menu) menu "$2";;
esac
2016-03-25 19:02:03 +01:00
exit 0