Fix notification focus for agent terminals (#6801)

* Fix notification focus for agent terminals

* Restrict notification title fallback to agents

* Simplify the focus fallback to a lazy two-tier query

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Aleksandar Tomašević
2026-08-13 20:28:43 +02:00
committed by GitHub
co-authored by Claude Fable 5 David Heinemeier Hansson
parent 14dc3a31d1
commit 82ae514609
2 changed files with 41 additions and 5 deletions
+9 -2
View File
@@ -1,6 +1,6 @@
#!/bin/bash
# omarchy:summary=Focus a Hyprland window by application class
# omarchy:summary=Focus a Hyprland window by application identity
# omarchy:args=<app-name>
# omarchy:examples=omarchy hyprland focus app Slack
@@ -12,10 +12,17 @@ usage() {
app=${1:-}
[[ -n $app ]] || usage
# Agent terminals notify as kitty/foot/etc. while their shared window class is
# org.omarchy.agent, leaving the terminal name only in initialTitle. So match
# by class first, then fall back to the launch-time title of agent windows.
address=$(
hyprctl clients -j 2>/dev/null |
jq -r --arg pattern "$app" \
'[.[] | select((.class // "") | test($pattern; "i"))] | first.address // empty'
'def matches($value): ($value // "") | test($pattern; "i");
first(
(.[] | select(matches(.class))),
(.[] | select(.initialClass == "org.omarchy.agent" and matches(.initialTitle)))
).address // empty'
)
[[ -n $address ]] || exit 1