diff --git a/bin/blob-launch-floating b/bin/blob-launch-floating index c6da911..eb18f2d 100755 --- a/bin/blob-launch-floating +++ b/bin/blob-launch-floating @@ -10,4 +10,4 @@ source blob-restart-gum cmd="$*" 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" diff --git a/bin/blob-launch-screensaver b/bin/blob-launch-screensaver index 65f4408..c7c489f 100755 --- a/bin/blob-launch-screensaver +++ b/bin/blob-launch-screensaver @@ -16,7 +16,7 @@ if blob-toggle-enabled screensaver-off && [[ $1 != "force" ]]; then fi focused=$(blob-hypr-monitor-focused) -terminal=$(xdg-terminal-exec --print-id) +terminal=$(blob-terminal-exec --print-id) case $terminal in *Alacritty* | *ghostty* | *foot* | *kitty*) ;; diff --git a/bin/blob-launch-terminal b/bin/blob-launch-terminal index a6d046a..4ab9fb1 100755 --- a/bin/blob-launch-terminal +++ b/bin/blob-launch-terminal @@ -3,13 +3,4 @@ # blob:summary=Launch the default terminal # blob:args=[command [args...]] -if blob-cmd-present xdg-terminal-exec; then - 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 +exec setsid uwsm-app -- blob-terminal-exec "$@" diff --git a/bin/blob-launch-tui b/bin/blob-launch-tui index b3373a6..4b4165c 100755 --- a/bin/blob-launch-tui +++ b/bin/blob-launch-tui @@ -10,4 +10,4 @@ else APP_ID="org.blob.$(basename $1)" 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}" diff --git a/bin/blob-launcher-remove b/bin/blob-launcher-remove index 676fe78..999cafe 100755 --- a/bin/blob-launcher-remove +++ b/bin/blob-launcher-remove @@ -67,7 +67,7 @@ desktop_name="${desktop_file##*/}" desktop_name="${desktop_name%.desktop}" 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" exit 0 fi diff --git a/bin/blob-terminal-exec b/bin/blob-terminal-exec new file mode 100755 index 0000000..c4dfe85 --- /dev/null +++ b/bin/blob-terminal-exec @@ -0,0 +1,67 @@ +#!/bin/bash + +# blob:summary=Run a command in the default terminal +# blob:args=[--print-id] [--app-id=] [--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[@]}" diff --git a/bin/blob-tui-install b/bin/blob-tui-install index 18ff240..df2bc28 100755 --- a/bin/blob-tui-install +++ b/bin/blob-tui-install @@ -84,7 +84,7 @@ cat >"$DESKTOP_FILE" <<EOF Version=1.0 Name=$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 Type=Application Icon=$ICON_VALUE diff --git a/bin/blob-tui-remove b/bin/blob-tui-remove index 88ff49d..f17859d 100755 --- a/bin/blob-tui-remove +++ b/bin/blob-tui-remove @@ -12,7 +12,7 @@ DESKTOP_DIR="$HOME/.local/share/applications/" if (( $# == 0 )); then # Find all TUIs 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}")") fi done < <(find "$DESKTOP_DIR" -name '*.desktop' -print0) diff --git a/bin/blob-tui-remove-all b/bin/blob-tui-remove-all index eb253af..60ce0b7 100755 --- a/bin/blob-tui-remove-all +++ b/bin/blob-tui-remove-all @@ -12,7 +12,7 @@ echo "Scanning for TUIs in $APP_DIR..." tui_desktop_files=() 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") fi done < <(find "$APP_DIR" -maxdepth 1 -name "*.desktop" -print0 2>/dev/null) diff --git a/default/blob/blob-menu.jsonc b/default/blob/blob-menu.jsonc index 146576d..a146b68 100644 --- a/default/blob/blob-menu.jsonc +++ b/default/blob/blob-menu.jsonc @@ -254,8 +254,8 @@ "setup.direct-boot": {"icon":"","label":"Direct Boot","action":"blob-launch-floating blob-setup-direct-boot"}, // Install - "install.package": {"icon":"󰣇","label":"Package","action":"xdg-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.package": {"icon":"󰣇","label":"Package","action":"blob-terminal-exec --app-id=org.blob.terminal blob-pkg-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.style": {"icon":"","label":"Style"}, "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'"}, // Remove - "remove.package": {"icon":"󰣇","label":"Package","action":"xdg-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.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|blob-terminal-exec).*-e' $HOME/.local/share/applications/*.desktop","action":"blob-tui-remove"}, "remove.theme": {"icon":"󰸌","label":"Theme","action":"blob-theme-remove"}, // Update diff --git a/docs/commands.md b/docs/commands.md index 78e30d4..42bbc4c 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -533,6 +533,7 @@ of the `blob` listing. | 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-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]) | diff --git a/docs/packages.md b/docs/packages.md index 5e3514b..a8caedb 100644 --- a/docs/packages.md +++ b/docs/packages.md @@ -58,8 +58,11 @@ than usual. Two are worth knowing about: -- `xdg-terminal-exec` is load-bearing. Every TUI launcher's `Exec=` line calls - it, so if its AUR build ever fails, TUI shortcuts stop opening. +- `xdg-terminal-exec` used to be load-bearing: every TUI launcher, the floating + 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. `quickshell` never came from the Omarchy repository - it is in official `extra`. diff --git a/session/uwsm/default b/session/uwsm/default index 9f765e2..106f780 100644 --- a/session/uwsm/default +++ b/session/uwsm/default @@ -1,2 +1,2 @@ -export TERMINAL=xdg-terminal-exec +export TERMINAL=blob-terminal-exec export EDITOR="blob-launch-editor --inline" diff --git a/session/uwsm/env.d/10-blob b/session/uwsm/env.d/10-blob index 65d794a..d4dff6e 100644 --- a/session/uwsm/env.d/10-blob +++ b/session/uwsm/env.d/10-blob @@ -3,7 +3,7 @@ if [ -f "${BLOB_PATH%/}/session/uwsm/default" ]; then . "${BLOB_PATH%/}/session/uwsm/default" else - export TERMINAL=xdg-terminal-exec + export TERMINAL=blob-terminal-exec export EDITOR="blob-launch-editor --inline" fi diff --git a/shell/plugins/menu/BarWidget.qml b/shell/plugins/menu/BarWidget.qml index 74d4476..46445ac 100644 --- a/shell/plugins/menu/BarWidget.qml +++ b/shell/plugins/menu/BarWidget.qml @@ -48,7 +48,7 @@ BarWidget { horizontalMargin: 7.5 onPressed: function(button) { 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\"}'") }