From e4bdd363f6ff18ec61ef614b43da25dc69f9e48a Mon Sep 17 00:00:00 2001 From: napcok Date: Fri, 2 Dec 2016 22:03:57 +0100 Subject: [PATCH] fix compositor restart --- usr/bin/mabox-compositor | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/usr/bin/mabox-compositor b/usr/bin/mabox-compositor index c5bfa00..66f4025 100755 --- a/usr/bin/mabox-compositor +++ b/usr/bin/mabox-compositor @@ -39,17 +39,19 @@ elif [[ $1 = '--toggle' || $1 = '--start' ]]; then # Toggle compositing with com killall compton fi elif [[ $1 = '--restart' ]]; then - killall -q compton - for (( i=0; i < RESTART_ATTEMPTS; i++ )); do - pidof compton > /dev/null || # no process found! Safe to start again - break + if pidof compton > /dev/null;then + killall -q compton + for (( i=0; i < RESTART_ATTEMPTS; i++ )); do + 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! - killall -q -S KILL compton + (( i == RESTART_ATTEMPTS - 1 )) && # still didn't die? Probably hangs. Force it to die! + killall -q -S KILL compton - sleep 0.25 - done - mabox-compositor --start + sleep 0.25 + done + mabox-compositor --start + fi elif [[ $1 = '--watch' ]]; then while inotifywait -e modify "$HOME/.config/compton.conf"; do mabox-compositor --restart # TODO move this to function?