mirror of
https://github.com/boxpositron/absolute-dotfiles.git
synced 2026-10-24 08:23:19 +00:00
feat(omo): reset hand-set Ghostty tab titles when a tab gets focus
A tab renamed in Ghostty ignores the title tmux sends, so it stops showing its session name. omo-status focus now clears that override through Ghostty's set_tab_title action, finding the tab by its terminal title, so every tab shows its tmux session again.
This commit is contained in:
@@ -7,6 +7,8 @@
|
|||||||
# Each pane running omo keeps its own state in the pane option @omo_state, and
|
# Each pane running omo keeps its own state in the pane option @omo_state, and
|
||||||
# the tab shows the most urgent one. Focusing the tab clears red, amber and green,
|
# the tab shows the most urgent one. Focusing the tab clears red, amber and green,
|
||||||
# and selects the pane whose banner you were sent (@omo_jump, set by omo-notify).
|
# and selects the pane whose banner you were sent (@omo_jump, set by omo-notify).
|
||||||
|
# It also clears any title you gave the Ghostty tab by hand, so tabs always show
|
||||||
|
# their tmux session's name.
|
||||||
#
|
#
|
||||||
# Usage: omo-status set <pane> <working|input|done|error|clear>
|
# Usage: omo-status set <pane> <working|input|done|error|clear>
|
||||||
# omo-status focus <client> (run by the tmux client-focus-in hook)
|
# omo-status focus <client> (run by the tmux client-focus-in hook)
|
||||||
@@ -51,6 +53,22 @@ looking_at() {
|
|||||||
tmux list-clients -t "$session" -F '#{client_flags}' | grep -q focused
|
tmux list-clients -t "$session" -F '#{client_flags}' | grep -q focused
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# A tab renamed in Ghostty ignores tmux's title until the override is cleared.
|
||||||
|
# Finds the tab by its terminal title, which tmux keeps as "[marker ]<session>".
|
||||||
|
reset_tab_title() {
|
||||||
|
osascript - "$1" <<'APPLESCRIPT' >/dev/null 2>&1
|
||||||
|
on run argv
|
||||||
|
set sessionName to item 1 of argv
|
||||||
|
if application "Ghostty" is not running then return
|
||||||
|
tell application "Ghostty"
|
||||||
|
repeat with term in (every terminal whose name is sessionName or name ends with (" " & sessionName))
|
||||||
|
perform action "set_tab_title:" on term
|
||||||
|
end repeat
|
||||||
|
end tell
|
||||||
|
end run
|
||||||
|
APPLESCRIPT
|
||||||
|
}
|
||||||
|
|
||||||
case ${1:-} in
|
case ${1:-} in
|
||||||
set)
|
set)
|
||||||
pane=${2:?pane id required} state=${3:?state required}
|
pane=${2:?pane id required} state=${3:?state required}
|
||||||
@@ -80,6 +98,7 @@ case ${1:-} in
|
|||||||
esac
|
esac
|
||||||
done < <(tmux list-panes -s -t "$session" -F '#{pane_id} #{@omo_state}')
|
done < <(tmux list-panes -s -t "$session" -F '#{pane_id} #{@omo_state}')
|
||||||
show_most_urgent "$session"
|
show_most_urgent "$session"
|
||||||
|
reset_tab_title "$(tmux display-message -p -t "$session" '#{session_name}')"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
sed -n '2,/^$/s/^# \{0,1\}//p' "$0" >&2
|
sed -n '2,/^$/s/^# \{0,1\}//p' "$0" >&2
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ Custom scripts and binaries are stored in `.local/bin/`:
|
|||||||
- `cldir`: Change directory with Claude context
|
- `cldir`: Change directory with Claude context
|
||||||
- `owt`: Git worktree workspaces for coding agents (see [Agent workspaces](#agent-workspaces-owt))
|
- `owt`: Git worktree workspaces for coding agents (see [Agent workspaces](#agent-workspaces-owt))
|
||||||
- `omo-notify`: Sound, tab marker and notification for OmO's hooks. Ghostty posts the notification, so clicking it opens the session's tab and pane
|
- `omo-notify`: Sound, tab marker and notification for OmO's hooks. Ghostty posts the notification, so clicking it opens the session's tab and pane
|
||||||
- `omo-status`: Coloured marker in front of the Ghostty tab title for each tmux session running omo: 🔴 stopped with an error, 🟡 waiting for your answer, 🟢 finished, 🔵 working. A tab with several agents shows the most urgent one; focusing the tab clears red, amber and green
|
- `omo-status`: Coloured marker in front of the Ghostty tab title for each tmux session running omo: 🔴 stopped with an error, 🟡 waiting for your answer, 🟢 finished, 🔵 working. A tab with several agents shows the most urgent one; focusing the tab clears red, amber and green, and undoes any title you gave the tab by hand so it always shows its session name
|
||||||
- `docker-nuke`: Force-restart a wedged Docker Desktop, capturing diagnostics to `~/.local/state/docker-nuke/` first (`--dry-run` to preview, `--no-restart` to leave it down, `--deep` for root helpers)
|
- `docker-nuke`: Force-restart a wedged Docker Desktop, capturing diagnostics to `~/.local/state/docker-nuke/` first (`--dry-run` to preview, `--no-restart` to leave it down, `--deep` for root helpers)
|
||||||
|
|
||||||
The `links` step of `setup-mac.sh` links each script into `~/.local/bin`, which `.zshrc` puts on your PATH. `pbcopy` and `pbpaste` are OSC 52 clipboard shims for headless servers, so they are not linked on macOS.
|
The `links` step of `setup-mac.sh` links each script into `~/.local/bin`, which `.zshrc` puts on your PATH. `pbcopy` and `pbpaste` are OSC 52 clipboard shims for headless servers, so they are not linked on macOS.
|
||||||
|
|||||||
Reference in New Issue
Block a user