diff --git a/bin/omarchy-launch-floating-terminal-with-presentation b/bin/omarchy-launch-floating-terminal-with-presentation index cd6db0d2..c9cb255a 100755 --- a/bin/omarchy-launch-floating-terminal-with-presentation +++ b/bin/omarchy-launch-floating-terminal-with-presentation @@ -3,6 +3,10 @@ # omarchy:summary=Launch a floating terminal with the Omarchy presentation wrapper # omarchy:args= +# Export the current theme's gum styling so gum widgets match the active theme +# even after a theme switch (the inherited environment is captured at login). +source omarchy-restart-gum + cmd="$*" presentation_script="omarchy-show-logo; $cmd; if (( \$? != 130 )); then omarchy-show-done; fi" diff --git a/bin/omarchy-restart-gum b/bin/omarchy-restart-gum new file mode 100755 index 00000000..ef10e7a4 --- /dev/null +++ b/bin/omarchy-restart-gum @@ -0,0 +1,18 @@ +#!/bin/bash + +# omarchy:summary=Export the current theme's gum styling into the environment +# omarchy:hidden=true + +# Meant to be sourced. gum_env.lua is fed into the compositor environment via +# hl.env at login, but that environment is captured once and is not refreshed on +# a theme switch, so anything launched from the session would otherwise inherit +# the login-time theme's gum colors. Export the current values instead. +_omarchy_gum_env="$HOME/.local/state/omarchy/current/theme/gum_env.lua" + +if [[ -f $_omarchy_gum_env ]]; then + while IFS=$'\t' read -r _omarchy_gum_key _omarchy_gum_value; do + [[ -n $_omarchy_gum_key && -n $_omarchy_gum_value ]] && export "$_omarchy_gum_key=$_omarchy_gum_value" + done < <(awk -F'"' '/hl\.env\("[A-Z0-9_]+", "[^"]+"\)/ { print $2 "\t" $4 }' "$_omarchy_gum_env") +fi + +unset _omarchy_gum_env _omarchy_gum_key _omarchy_gum_value