40 lines
1.2 KiB
Bash
Executable File
40 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Toggle the horizon-dock. Forwards a verb to the resident daemon over D-Bus; if
|
|
# the daemon isn't running yet, starts it first. Mirrors orbit-menu.sh/menu-
|
|
# toggle.sh. Not bound to a key by default — invoke manually or wire it into a
|
|
# bar button / gesture yourself.
|
|
#
|
|
# horizon-dock.sh -> --toggle (default)
|
|
# horizon-dock.sh show -> --show
|
|
# horizon-dock.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.horizondock"
|
|
OBJ="/eu/abdelbaki/horizondock"
|
|
APP="${HOME}/.config/horizon-dock/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/horizon-dock-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"
|