#!/usr/bin/env bash # Toggle supersonic-booster (the PipeWire mixer panel). Forwards a verb to the # resident daemon over D-Bus; if the daemon isn't running yet, starts it first. # Mirrors horizon-dock.sh/transmitter-panel.sh. # # supersonic-booster.sh -> --toggle (default) # supersonic-booster.sh show -> --show # supersonic-booster.sh hide -> --hide # # (No `set -e`: a non-zero `busctl` in the wait loop is expected and must not # abort the script before it forwards the verb.) BUS="eu.abdelbaki.supersonicbooster" OBJ="/eu/abdelbaki/supersonicbooster" APP="${HOME}/.config/supersonic-booster/main.py" case "${1:-toggle}" in show) VERB="--show"; ACTION="show" ;; hide) VERB="--hide"; ACTION="hide" ;; *) VERB="--toggle"; ACTION="toggle" ;; esac registered() { busctl --user list 2>/dev/null | grep -q "$BUS"; } if registered; then exec gdbus call --session --dest "$BUS" --object-path "$OBJ" \ --method org.gtk.Actions.Activate "$ACTION" "[]" "{}" >/dev/null fi "${HOME}/.config/scripts/supersonic-booster-start.sh" >/dev/null 2>&1 & for _ in $(seq 1 25); do if registered; then exec "$0" "$@" fi sleep 0.2 done exec python3 "$APP" "$VERB"