#!/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