Dotfiles/desktopenvs/hyprlua/scripts/astal-menu-start.sh

18 lines
820 B
Bash
Executable File

#!/usr/bin/env bash
# Resident launcher for the astal-menu GTK4 popup control centre.
#
# gtk4-layer-shell must be loaded before libwayland-client; when the shell is used
# through PyGObject that ordering isn't guaranteed, so we LD_PRELOAD it (the library
# itself documents this workaround). main.py drops LD_PRELOAD from its environment
# right after startup so the apps it launches don't inherit it (Firefox, for one,
# crashes with libgtk4-layer-shell preloaded). Starts the daemon hidden — it shows
# only when menu-toggle.sh forwards a --toggle/--show/--appdrawer verb.
APP="${HOME}/.config/astal-menu/main.py"
SO="$(ldconfig -p 2>/dev/null | awk '/libgtk4-layer-shell\.so/ {print $NF; exit}')"
if [[ -n "${SO:-}" ]]; then
export LD_PRELOAD="${SO}${LD_PRELOAD:+:${LD_PRELOAD}}"
fi
exec python3 "$APP" "$@"