fix compositor restart

master
Daniel Napora 2016-12-02 22:03:57 +01:00
parent 31b814557d
commit e4bdd363f6
1 changed files with 11 additions and 9 deletions

View File

@ -39,17 +39,19 @@ elif [[ $1 = '--toggle' || $1 = '--start' ]]; then # Toggle compositing with com
killall compton killall compton
fi fi
elif [[ $1 = '--restart' ]]; then elif [[ $1 = '--restart' ]]; then
killall -q compton if pidof compton > /dev/null;then
for (( i=0; i < RESTART_ATTEMPTS; i++ )); do killall -q compton
pidof compton > /dev/null || # no process found! Safe to start again for (( i=0; i < RESTART_ATTEMPTS; i++ )); do
break pidof compton > /dev/null || # no process found! Safe to start again
break
(( i == RESTART_ATTEMPTS - 1 )) && # still didn't die? Probably hangs. Force it to die! (( i == RESTART_ATTEMPTS - 1 )) && # still didn't die? Probably hangs. Force it to die!
killall -q -S KILL compton killall -q -S KILL compton
sleep 0.25 sleep 0.25
done done
mabox-compositor --start mabox-compositor --start
fi
elif [[ $1 = '--watch' ]]; then elif [[ $1 = '--watch' ]]; then
while inotifywait -e modify "$HOME/.config/compton.conf"; do while inotifywait -e modify "$HOME/.config/compton.conf"; do
mabox-compositor --restart # TODO move this to function? mabox-compositor --restart # TODO move this to function?