mabox-tools/bin/mb-tint2restart

38 lines
850 B
Plaintext
Raw Normal View History

2020-02-18 17:24:18 +01:00
#!/bin/bash
#
# mb-tint2restart to be used by mb-tint2-pipemenu
# Written by damo <damo@bunsenlabs.org> for BunsenLabs Linux, April 2015
# and johnraff <john@bunsenlabs.org> July 2015
# Potred to Manjaro by napcok <napcok@gmail.com>
declare -A commands # associative array
while read pid cmd; do
if [[ ${cmd%% *} = tint2 ]]; then
kill "$pid"
commands[$cmd]=1 # duplicate commands will be launched only once
fi
done <<< "$(pgrep -a tint2)"
sleep 1
# any processes still running will be killed with SIGKILL
while read pid cmd; do
if [[ ${cmd%% *} = tint2 ]]; then
kill -KILL "$pid"
commands[$cmd]=1
fi
done <<< "$(pgrep -a tint2)"
sleep 1
for i in "${!commands[@]}" # go through the indexes
do
(setsid $i &)
sleep 0.1
done
sleep 1
mabox-compositor --restart # restart compositor
exit 0