#!/bin/bash # mabox-compositor - script to start|stop|restart picom # by Daniel Napora . "$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