From eec075bdf9ce29f37cb6e57e23385090d76edba7 Mon Sep 17 00:00:00 2001 From: Patrick Roza Date: Wed, 19 Nov 2025 08:54:17 +0100 Subject: [PATCH] improve: uniquely identify terminal apps for window rules and focus. Unify waybar behaviour to use launch-or-focus (#3389) * improve: uniquely identify btop when launched from waybar. * align btop app id * add migration to uniquely identify btop * also add unique app ids to lazydocker and terminal editor * introduce new omarchy-launch-tui that sets class. * align all the tuis and behaviour in waybar * update migration accordingly * fixes * separate terminal from tui * fix: double setsid uswm-app -- * Standardize namespace on org.omarchy and lowercase --------- Co-authored-by: David Heinemeier Hansson --- bin/omarchy-cmd-screensaver | 4 ++-- bin/omarchy-launch-about | 2 +- bin/omarchy-launch-editor | 2 +- bin/omarchy-launch-floating-terminal-with-presentation | 2 +- bin/omarchy-launch-screensaver | 8 ++++---- bin/omarchy-launch-tui | 3 +++ bin/omarchy-launch-wifi | 2 +- bin/omarchy-lock-screen | 2 +- bin/omarchy-menu | 4 ++-- config/hypr/bindings.conf | 4 ++-- config/waybar/config.jsonc | 4 ++-- default/hypr/apps/system.conf | 4 ++-- migrations/1763386443.sh | 8 ++++++++ 13 files changed, 30 insertions(+), 19 deletions(-) create mode 100755 bin/omarchy-launch-tui create mode 100644 migrations/1763386443.sh diff --git a/bin/omarchy-cmd-screensaver b/bin/omarchy-cmd-screensaver index 3a44369f..b1c7932f 100755 --- a/bin/omarchy-cmd-screensaver +++ b/bin/omarchy-cmd-screensaver @@ -1,13 +1,13 @@ #!/bin/bash screensaver_in_focus() { - hyprctl activewindow -j | jq -e '.class == "com.omarchy.Screensaver"' >/dev/null 2>&1 + hyprctl activewindow -j | jq -e '.class == "org.omarchy.screensaver"' >/dev/null 2>&1 } exit_screensaver() { hyprctl keyword cursor:invisible false pkill -x tte 2>/dev/null - pkill -f com.omarchy.Screensaver 2>/dev/null + pkill -f org.omarchy.screensaver 2>/dev/null exit 0 } diff --git a/bin/omarchy-launch-about b/bin/omarchy-launch-about index 8505ff0e..a64f4b6d 100755 --- a/bin/omarchy-launch-about +++ b/bin/omarchy-launch-about @@ -1,3 +1,3 @@ #!/bin/bash -exec setsid uwsm-app -- xdg-terminal-exec --app-id=com.omarchy.Omarchy -e bash -c 'fastfetch; read -n 1 -s' +exec setsid uwsm-app -- xdg-terminal-exec --app-id=org.omarchy.terminal -e bash -c 'fastfetch; read -n 1 -s' diff --git a/bin/omarchy-launch-editor b/bin/omarchy-launch-editor index f120001e..7597cfcc 100755 --- a/bin/omarchy-launch-editor +++ b/bin/omarchy-launch-editor @@ -4,7 +4,7 @@ omarchy-cmd-present "$EDITOR" || EDITOR=nvim case "$EDITOR" in nvim | vim | nano | micro | hx | helix) - exec setsid uwsm-app -- xdg-terminal-exec "$EDITOR" "$@" + exec omarchy-launch-tui "$EDITOR" "$@" ;; *) exec setsid uwsm-app -- "$EDITOR" "$@" diff --git a/bin/omarchy-launch-floating-terminal-with-presentation b/bin/omarchy-launch-floating-terminal-with-presentation index c074cbf6..cc779efd 100755 --- a/bin/omarchy-launch-floating-terminal-with-presentation +++ b/bin/omarchy-launch-floating-terminal-with-presentation @@ -1,4 +1,4 @@ #!/bin/bash cmd="$*" -exec setsid uwsm-app -- xdg-terminal-exec --app-id=com.omarchy.Omarchy --title=Omarchy -e bash -c "omarchy-show-logo; $cmd; omarchy-show-done" +exec setsid uwsm-app -- xdg-terminal-exec --app-id=org.omarchy.terminal --title=Omarchy -e bash -c "omarchy-show-logo; $cmd; omarchy-show-done" diff --git a/bin/omarchy-launch-screensaver b/bin/omarchy-launch-screensaver index 2dfd0c9b..932ee470 100755 --- a/bin/omarchy-launch-screensaver +++ b/bin/omarchy-launch-screensaver @@ -6,7 +6,7 @@ if ! command -v tte &>/dev/null; then fi # Exit early if screensave is already running -pgrep -f com.omarchy.Screensaver && exit 0 +pgrep -f org.omarchy.screensaver && exit 0 # Allow screensaver to be turned off but also force started if [[ -f ~/.local/state/omarchy/toggles/screensaver-off ]] && [[ $1 != "force" ]]; then @@ -22,19 +22,19 @@ for m in $(hyprctl monitors -j | jq -r '.[] | .name'); do case $terminal in *Alacritty*) hyprctl dispatch exec -- \ - alacritty --class=com.omarchy.Screensaver \ + alacritty --class=org.omarchy.screensaver \ --config-file ~/.local/share/omarchy/default/alacritty/screensaver.toml \ -e omarchy-cmd-screensaver ;; *ghostty*) hyprctl dispatch exec -- \ - ghostty --class=com.omarchy.Screensaver \ + ghostty --class=org.omarchy.screensaver \ --font-size=18 \ -e omarchy-cmd-screensaver ;; *kitty*) hyprctl dispatch exec -- \ - kitty --class=com.omarchy.Screensaver \ + kitty --class=org.omarchy.screensaver \ --override font_size=18 \ -e omarchy-cmd-screensaver ;; diff --git a/bin/omarchy-launch-tui b/bin/omarchy-launch-tui new file mode 100755 index 00000000..67440b2b --- /dev/null +++ b/bin/omarchy-launch-tui @@ -0,0 +1,3 @@ +#!/bin/bash + +exec setsid uwsm-app -- xdg-terminal-exec --app-id=org.omarchy.$(basename $1) -e "$1" "${@:2}" diff --git a/bin/omarchy-launch-wifi b/bin/omarchy-launch-wifi index 28e4d300..fc1e2c83 100755 --- a/bin/omarchy-launch-wifi +++ b/bin/omarchy-launch-wifi @@ -1,3 +1,3 @@ #!/bin/bash -exec setsid omarchy-launch-or-focus com.omarchy.Impala "uwsm-app -- xdg-terminal-exec --app-id=com.omarchy.Impala -e impala" +exec setsid omarchy-launch-or-focus org.omarchy.impala "omarchy-launch-tui impala" diff --git a/bin/omarchy-lock-screen b/bin/omarchy-lock-screen index 5417afff..f57d4526 100755 --- a/bin/omarchy-lock-screen +++ b/bin/omarchy-lock-screen @@ -9,4 +9,4 @@ if pgrep -x "1password" >/dev/null; then fi # Avoid running screensaver when locked -pkill -f com.omarchy.Screensaver +pkill -f org.omarchy.screensaver diff --git a/bin/omarchy-menu b/bin/omarchy-menu index 79ec3feb..5c067324 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -37,7 +37,7 @@ menu() { } terminal() { - xdg-terminal-exec --app-id=com.omarchy.Omarchy "$@" + xdg-terminal-exec --app-id=org.omarchy.terminal "$@" } present_terminal() { @@ -173,7 +173,7 @@ show_setup_menu() { options="$options\n Defaults\n󰱔 DNS\n Security\n Config" case $(menu "Setup" "$options") in - *Audio*) xdg-terminal-exec --app-id=com.omarchy.Wiremix -e wiremix ;; + *Audio*) omarchy-launch-or-focus org.omarchy.wiremix "omarchy-launch-tui wiremix" ;; *Wifi*) rfkill unblock wifi omarchy-launch-wifi diff --git a/config/hypr/bindings.conf b/config/hypr/bindings.conf index f8171f9d..5d98dd65 100644 --- a/config/hypr/bindings.conf +++ b/config/hypr/bindings.conf @@ -8,8 +8,8 @@ bindd = SUPER SHIFT, B, Browser, exec, $browser bindd = SUPER SHIFT ALT, B, Browser (private), exec, $browser --private bindd = SUPER SHIFT, M, Music, exec, omarchy-launch-or-focus spotify bindd = SUPER SHIFT, N, Editor, exec, omarchy-launch-editor -bindd = SUPER SHIFT, T, Activity, exec, $terminal -e btop -bindd = SUPER SHIFT, D, Docker, exec, $terminal -e lazydocker +bindd = SUPER SHIFT, T, Activity, exec, omarchy-launch-tui btop +bindd = SUPER SHIFT, D, Docker, exec, omarchy-launch-tui lazydocker bindd = SUPER SHIFT, G, Signal, exec, omarchy-launch-or-focus signal "uwsm-app -- signal-desktop" bindd = SUPER SHIFT, O, Obsidian, exec, omarchy-launch-or-focus obsidian "uwsm-app -- obsidian -disable-gpu --enable-wayland-ime" bindd = SUPER SHIFT, W, Typora, exec, uwsm-app -- typora --enable-wayland-ime diff --git a/config/waybar/config.jsonc b/config/waybar/config.jsonc index 80a24dcc..1f632eaa 100644 --- a/config/waybar/config.jsonc +++ b/config/waybar/config.jsonc @@ -57,7 +57,7 @@ "cpu": { "interval": 5, "format": "󰍛", - "on-click": "xdg-terminal-exec btop" + "on-click": "omarchy-launch-or-focus org.omarchy.btop \"omarchy-launch-tui btop\"" }, "clock": { "format": "{:L%A %H:%M}", @@ -106,7 +106,7 @@ }, "pulseaudio": { "format": "{icon}", - "on-click": "xdg-terminal-exec --app-id=com.omarchy.Wiremix -e wiremix", + "on-click": "omarchy-launch-or-focus org.omarchy.wiremix \"omarchy-launch-tui wiremix\"", "on-click-right": "pamixer -t", "tooltip-format": "Playing at {volume}%", "scroll-step": 5, diff --git a/default/hypr/apps/system.conf b/default/hypr/apps/system.conf index 08f10771..522cef3e 100644 --- a/default/hypr/apps/system.conf +++ b/default/hypr/apps/system.conf @@ -3,12 +3,12 @@ windowrule = float, tag:floating-window windowrule = center, tag:floating-window windowrule = size 875 600, tag:floating-window -windowrule = tag +floating-window, class:(blueberry.py|com.omarchy.Impala|com.omarchy.Wiremix|com.omarchy.Omarchy|org.gnome.NautilusPreviewer|com.gabm.satty|Omarchy|About|TUI.float) +windowrule = tag +floating-window, class:(blueberry.py|org.omarchy.impala|org.omarchy.wiremix|org.omarchy.terminal|org.gnome.NautilusPreviewer|com.gabm.satty|Omarchy|About|TUI.float) windowrule = tag +floating-window, class:(xdg-desktop-portal-gtk|sublime_text|DesktopEditors|org.gnome.Nautilus), title:^(Open.*Files?|Open [F|f]older.*|Save.*Files?|Save.*As|Save|All Files|.*wants to [open|save].*|[C|c]hoose.*) windowrule = float, class:org.gnome.Calculator # Fullscreen screensaver -windowrule = fullscreen, class:com.omarchy.Screensaver +windowrule = fullscreen, class:org.omarchy.screensaver # No transparency on media windows windowrule = opacity 1 1, class:^(zoom|vlc|mpv|org.kde.kdenlive|com.obsproject.Studio|com.github.PintaProject.Pinta|imv|org.gnome.NautilusPreviewer)$ diff --git a/migrations/1763386443.sh b/migrations/1763386443.sh new file mode 100644 index 00000000..53e24261 --- /dev/null +++ b/migrations/1763386443.sh @@ -0,0 +1,8 @@ +echo "Uniquely identify terminal apps with custom app-ids using omarchy-launch-tui" + +# Replace terminal -e calls with omarchy-launch-tui in bindings +sed -i 's/\$terminal -e \([^ ]*\)/omarchy-launch-tui \1/g' ~/.config/hypr/bindings.conf + +# Update waybar to use omarchy-launch-or-focus with omarchy-launch-tui for TUI apps +sed -i 's/xdg-terminal-exec btop/omarchy-launch-or-focus org.omarchy.btop "omarchy-launch-tui btop"/' ~/.config/waybar/config.jsonc +sed -i 's/xdg-terminal-exec --app-id=com\.omarchy\.Wiremix -e wiremix/omarchy-launch-or-focus org.omarchy.wiremix "omarchy-launch-tui wiremix"/' ~/.config/waybar/config.jsonc