blob: 3d1bf0545aa3173692926025196059901d4d3159 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/bin/sh
set -e
[ -n "$DEBUG" ] && set -x
export MENU_PROMPT=" s6"
svdir="${HOME}/.local/share/s6"
handle() {
while read -r sv; do
isup=$(s6-svstat -o up "${svdir}/${sv}")
if [ "${isup}" = "true" ]; then
act=restart
s6-svc -r "${svdir}/${sv}"
else
act=stopp
s6-svc -u "${svdir}/${sv}"
fi
if [ $? = 0 ]; then
notify-send -i /usr/share/icons/mdi/scalable/run-fast.svg -a s6 s6 "${act}ed ${sv}"
else
notify-send -i /usr/share/icons/mdi/scalable/run-fast.svg -a s6 -u critical -t 30000 s6 "${act}ing ${sv} failed"
fi
done
}
fd -t d -d 1 . "${svdir}" |
sed -e "s#${svdir}/##" |
awk '{printf "%25s\t%s\n", $1, $3}' |
menu --list=10 |
handle
|