Run every terminal launch through one dispatcher with fallbacks

This commit is contained in:
2026-09-21 02:10:01 +00:00
parent d316308bf5
commit 90c22b4e0c
15 changed files with 88 additions and 26 deletions
+1 -1
View File
@@ -10,4 +10,4 @@ source blob-restart-gum
cmd="$*" cmd="$*"
presentation_script="blob-show-logo; $cmd; if (( \$? != 130 )); then blob-show-done; fi" presentation_script="blob-show-logo; $cmd; if (( \$? != 130 )); then blob-show-done; fi"
exec setsid uwsm-app -- xdg-terminal-exec --app-id=org.blob.terminal --title=Blob -e bash -c "$presentation_script" exec setsid uwsm-app -- blob-terminal-exec --app-id=org.blob.terminal --title=Blob -e bash -c "$presentation_script"
+1 -1
View File
@@ -16,7 +16,7 @@ if blob-toggle-enabled screensaver-off && [[ $1 != "force" ]]; then
fi fi
focused=$(blob-hypr-monitor-focused) focused=$(blob-hypr-monitor-focused)
terminal=$(xdg-terminal-exec --print-id) terminal=$(blob-terminal-exec --print-id)
case $terminal in case $terminal in
*Alacritty* | *ghostty* | *foot* | *kitty*) ;; *Alacritty* | *ghostty* | *foot* | *kitty*) ;;
+1 -10
View File
@@ -3,13 +3,4 @@
# blob:summary=Launch the default terminal # blob:summary=Launch the default terminal
# blob:args=[command [args...]] # blob:args=[command [args...]]
if blob-cmd-present xdg-terminal-exec; then exec setsid uwsm-app -- blob-terminal-exec "$@"
exec setsid uwsm-app -- xdg-terminal-exec "$@"
fi
for terminal in foot kitty; do
blob-cmd-present "$terminal" && exec setsid uwsm-app -- "$terminal" "$@"
done
blob-notify-send "No terminal installed" "Install xdg-terminal-exec, foot or kitty."
exit 1
+1 -1
View File
@@ -10,4 +10,4 @@ else
APP_ID="org.blob.$(basename $1)" APP_ID="org.blob.$(basename $1)"
fi fi
exec setsid uwsm-app -- xdg-terminal-exec --app-id=$APP_ID -e "$1" "${@:2}" exec setsid uwsm-app -- blob-terminal-exec --app-id=$APP_ID -e "$1" "${@:2}"
+1 -1
View File
@@ -67,7 +67,7 @@ desktop_name="${desktop_file##*/}"
desktop_name="${desktop_name%.desktop}" desktop_name="${desktop_name%.desktop}"
exec_line="$(sed -n 's/^Exec=//p' "$desktop_file" | head -1)" exec_line="$(sed -n 's/^Exec=//p' "$desktop_file" | head -1)"
if [[ $exec_line =~ (^|[[:space:]])(\$TERMINAL|xdg-terminal-exec)[[:space:]].*-e([[:space:]]|$) ]]; then if [[ $exec_line =~ (^|[[:space:]])(\$TERMINAL|xdg-terminal-exec|blob-terminal-exec)[[:space:]].*-e([[:space:]]|$) ]]; then
BLOB_REMOVE_NOTIFY=false blob-tui-remove "$desktop_name" BLOB_REMOVE_NOTIFY=false blob-tui-remove "$desktop_name"
exit 0 exit 0
fi fi
+67
View File
@@ -0,0 +1,67 @@
#!/bin/bash
# blob:summary=Run a command in the default terminal
# blob:args=[--print-id] [--app-id=<app-id>] [--title=<title>] [-e] <command> [args...]
# blob:hidden=true
terminal=""
for candidate in xdg-terminal-exec foot kitty; do
if command -v "$candidate" &>/dev/null; then
terminal=$candidate
break
fi
done
if [[ -z $terminal ]]; then
blob-notify-send "No terminal installed" "Install xdg-terminal-exec, foot or kitty."
exit 1
fi
if [[ $terminal == "xdg-terminal-exec" ]]; then
exec xdg-terminal-exec "$@"
fi
app_id=""
title=""
command_args=()
while (( $# > 0 )); do
case "$1" in
--print-id)
printf '%s\n' "$terminal"
exit 0
;;
--app-id=*)
app_id=${1#--app-id=}
shift
;;
--title=*)
title=${1#--title=}
shift
;;
-e)
shift
command_args+=("$@")
break
;;
*)
command_args+=("$1")
shift
;;
esac
done
launch=("$terminal")
case "$terminal" in
foot)
[[ -n $app_id ]] && launch+=("--app-id=$app_id")
;;
kitty)
[[ -n $app_id ]] && launch+=("--class=$app_id")
;;
esac
[[ -n $title ]] && launch+=("--title=$title")
exec "${launch[@]}" "${command_args[@]}"
+1 -1
View File
@@ -84,7 +84,7 @@ cat >"$DESKTOP_FILE" <<EOF
Version=1.0 Version=1.0
Name=$APP_NAME Name=$APP_NAME
Comment=$APP_NAME Comment=$APP_NAME
Exec=xdg-terminal-exec --app-id=$APP_CLASS -e $APP_EXEC Exec=blob-terminal-exec --app-id=$APP_CLASS -e $APP_EXEC
Terminal=false Terminal=false
Type=Application Type=Application
Icon=$ICON_VALUE Icon=$ICON_VALUE
+1 -1
View File
@@ -12,7 +12,7 @@ DESKTOP_DIR="$HOME/.local/share/applications/"
if (( $# == 0 )); then if (( $# == 0 )); then
# Find all TUIs # Find all TUIs
while IFS= read -r -d '' file; do while IFS= read -r -d '' file; do
if grep -qE '^Exec=.*(\$TERMINAL|xdg-terminal-exec).*-e' "$file"; then if grep -qE '^Exec=.*(\$TERMINAL|xdg-terminal-exec|blob-terminal-exec).*-e' "$file"; then
TUIS+=("$(basename "${file%.desktop}")") TUIS+=("$(basename "${file%.desktop}")")
fi fi
done < <(find "$DESKTOP_DIR" -name '*.desktop' -print0) done < <(find "$DESKTOP_DIR" -name '*.desktop' -print0)
+1 -1
View File
@@ -12,7 +12,7 @@ echo "Scanning for TUIs in $APP_DIR..."
tui_desktop_files=() tui_desktop_files=()
while IFS= read -r -d '' file; do while IFS= read -r -d '' file; do
if grep -q "Exec=xdg-terminal-exec --app-id=TUI\." "$file" 2>/dev/null; then if grep -qE "Exec=(xdg|blob)-terminal-exec --app-id=TUI\." "$file" 2>/dev/null; then
tui_desktop_files+=("$file") tui_desktop_files+=("$file")
fi fi
done < <(find "$APP_DIR" -maxdepth 1 -name "*.desktop" -print0 2>/dev/null) done < <(find "$APP_DIR" -maxdepth 1 -name "*.desktop" -print0 2>/dev/null)
+4 -4
View File
@@ -254,8 +254,8 @@
"setup.direct-boot": {"icon":"","label":"Direct Boot","action":"blob-launch-floating blob-setup-direct-boot"}, "setup.direct-boot": {"icon":"","label":"Direct Boot","action":"blob-launch-floating blob-setup-direct-boot"},
// Install // Install
"install.package": {"icon":"󰣇","label":"Package","action":"xdg-terminal-exec --app-id=org.blob.terminal blob-pkg-install"}, "install.package": {"icon":"󰣇","label":"Package","action":"blob-terminal-exec --app-id=org.blob.terminal blob-pkg-install"},
"install.aur": {"icon":"󰣇","label":"AUR","action":"xdg-terminal-exec --app-id=org.blob.terminal blob-pkg-aur-install"}, "install.aur": {"icon":"󰣇","label":"AUR","action":"blob-terminal-exec --app-id=org.blob.terminal blob-pkg-aur-install"},
"install.tui": {"icon":"","label":"TUI","action":"blob-launch-floating blob-tui-install"}, "install.tui": {"icon":"","label":"TUI","action":"blob-launch-floating blob-tui-install"},
"install.style": {"icon":"","label":"Style"}, "install.style": {"icon":"","label":"Style"},
"install.style.theme": {"icon":"󰸌","label":"Theme","action":"blob-launch-floating blob-theme-install"}, "install.style.theme": {"icon":"󰸌","label":"Theme","action":"blob-launch-floating blob-theme-install"},
@@ -269,8 +269,8 @@
"install.style.font.iosevka": {"icon":"","label":"Iosevka","action":"blob-install-font Iosevka ttf-iosevka-nerd 'Iosevka Nerd Font Mono'"}, "install.style.font.iosevka": {"icon":"","label":"Iosevka","action":"blob-install-font Iosevka ttf-iosevka-nerd 'Iosevka Nerd Font Mono'"},
// Remove // Remove
"remove.package": {"icon":"󰣇","label":"Package","action":"xdg-terminal-exec --app-id=org.blob.terminal blob-pkg-remove"}, "remove.package": {"icon":"󰣇","label":"Package","action":"blob-terminal-exec --app-id=org.blob.terminal blob-pkg-remove"},
"remove.tui": {"icon":"","label":"TUI","when":"grep -qE '^Exec=.*(\\$TERMINAL|xdg-terminal-exec).*-e' $HOME/.local/share/applications/*.desktop","action":"blob-tui-remove"}, "remove.tui": {"icon":"","label":"TUI","when":"grep -qE '^Exec=.*(\\$TERMINAL|xdg-terminal-exec|blob-terminal-exec).*-e' $HOME/.local/share/applications/*.desktop","action":"blob-tui-remove"},
"remove.theme": {"icon":"󰸌","label":"Theme","action":"blob-theme-remove"}, "remove.theme": {"icon":"󰸌","label":"Theme","action":"blob-theme-remove"},
// Update // Update
+1
View File
@@ -533,6 +533,7 @@ of the `blob` listing.
| Command | Does | Arguments | | Command | Does | Arguments |
| --- | --- | --- | | --- | --- | --- |
| `blob-terminal-exec` | Run a command in the default terminal (hidden) | [--print-id] [--app-id=<app-id>] [--title=<title>] [-e] <command> [args...] |
| `blob-theme-browser` | Apply the current theme color to Chromium, Chrome, Edge, and Brave (hidden) | - | | `blob-theme-browser` | Apply the current theme color to Chromium, Chrome, Edge, and Brave (hidden) | - |
| `blob-theme-browser-policy` | Write the current theme color into the browser policy directories (hidden) | <rrggbb> | | `blob-theme-browser-policy` | Write the current theme color into the browser policy directories (hidden) | <rrggbb> |
| `blob-theme-color` | Resolve semantic colors from an Blob theme colors.toml (hidden) | [--file <colors.toml>] (--all \| --raw \| <key> [fallback]) | | `blob-theme-color` | Resolve semantic colors from an Blob theme colors.toml (hidden) | [--file <colors.toml>] (--all \| --raw \| <key> [fallback]) |
+5 -2
View File
@@ -58,8 +58,11 @@ than usual.
Two are worth knowing about: Two are worth knowing about:
- `xdg-terminal-exec` is load-bearing. Every TUI launcher's `Exec=` line calls - `xdg-terminal-exec` used to be load-bearing: every TUI launcher, the floating
it, so if its AUR build ever fails, TUI shortcuts stop opening. launcher behind most of the menu, and `$TERMINAL` called it by name, so a
failed AUR build silently broke about half the menu. They all go through
`blob-terminal-exec` now, which prefers it and falls back to `foot`, then
`kitty`, both from the official repositories.
- `aether` is in the AUR at a version newer than the one the repository shipped. - `aether` is in the AUR at a version newer than the one the repository shipped.
`quickshell` never came from the Omarchy repository - it is in official `extra`. `quickshell` never came from the Omarchy repository - it is in official `extra`.
+1 -1
View File
@@ -1,2 +1,2 @@
export TERMINAL=xdg-terminal-exec export TERMINAL=blob-terminal-exec
export EDITOR="blob-launch-editor --inline" export EDITOR="blob-launch-editor --inline"
+1 -1
View File
@@ -3,7 +3,7 @@
if [ -f "${BLOB_PATH%/}/session/uwsm/default" ]; then if [ -f "${BLOB_PATH%/}/session/uwsm/default" ]; then
. "${BLOB_PATH%/}/session/uwsm/default" . "${BLOB_PATH%/}/session/uwsm/default"
else else
export TERMINAL=xdg-terminal-exec export TERMINAL=blob-terminal-exec
export EDITOR="blob-launch-editor --inline" export EDITOR="blob-launch-editor --inline"
fi fi
+1 -1
View File
@@ -48,7 +48,7 @@ BarWidget {
horizontalMargin: 7.5 horizontalMargin: 7.5
onPressed: function(button) { onPressed: function(button) {
if (!root.bar) return if (!root.bar) return
if (button === Qt.RightButton) root.bar.run("xdg-terminal-exec") if (button === Qt.RightButton) root.bar.run("blob-terminal-exec")
else root.bar.run("blob-shell shell toggle blob.menu '{\"menu\":\"root\"}'") else root.bar.run("blob-shell shell toggle blob.menu '{\"menu\":\"root\"}'")
} }