Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scripts/open-file-viewer-tab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
viewer_bin="$script_dir/../target/release/herdr-file-viewer"

open_tab() {
# extra args: `--workspace <id>` when the decision named an anchor — a
# context-carrying (programmatic) invocation opens the tab in THAT
# workspace, not the host's focused one. Validated by --launch-decision-tab.
exec "$herdr_bin" plugin pane open \
--plugin herdr-file-viewer \
--entrypoint file-viewer \
--placement tab \
--focus
--focus "$@"
}

decision="OPEN"
Expand Down Expand Up @@ -57,6 +60,9 @@ case "$decision" in
pid="${decision#CLOSE }"
exec "$herdr_bin" pane close "$pid"
;;
"OPEN "*)
open_tab --workspace "${decision#OPEN }"
;;
*)
open_tab
;;
Expand Down
8 changes: 7 additions & 1 deletion scripts/open-file-viewer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
viewer_bin="$script_dir/../target/release/herdr-file-viewer"

open_pane() {
# extra args: `--target-pane <id>` when the decision named an anchor — a
# context-carrying (programmatic) invocation splits THAT pane, not the
# host's focused one. The id was validated flag-safe by --launch-decision.
exec "$herdr_bin" plugin pane open \
--plugin herdr-file-viewer \
--entrypoint file-viewer \
--placement split \
--direction right \
--focus
--focus "$@"
}

decision="OPEN"
Expand All @@ -49,6 +52,9 @@ case "$decision" in
pid="${decision#CLOSE }"
exec "$herdr_bin" pane close "$pid"
;;
"OPEN "*)
open_pane --target-pane "${decision#OPEN }"
;;
*)
open_pane
;;
Expand Down
Loading