mirror of
https://github.com/theniceboy/.config.git
synced 2026-05-11 17:36:05 +08:00
agent tracker + tmux update
This commit is contained in:
parent
cd9c92b1c2
commit
5064629d61
68 changed files with 15041 additions and 3483 deletions
27
tmux/scripts/resurrect_op_session.sh
Executable file
27
tmux/scripts/resurrect_op_session.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
# Resurrect strategy for `op` (opencode).
|
||||
# Called by tmux-resurrect as: script <pane_full_command> <dir>
|
||||
# Returns the command to run in the pane.
|
||||
|
||||
pane_full_command="$1"
|
||||
|
||||
session_name=$(tmux display-message -p '#{session_name}' 2>/dev/null || true)
|
||||
window_index=$(tmux display-message -p '#{window_index}' 2>/dev/null || true)
|
||||
pane_index=$(tmux display-message -p '#{pane_index}' 2>/dev/null || true)
|
||||
|
||||
state_dir="${XDG_STATE_HOME:-$HOME/.local/state}/op"
|
||||
|
||||
if [[ -n "$session_name" && -n "$window_index" && -n "$pane_index" ]]; then
|
||||
locator="${session_name}:${window_index}.${pane_index}"
|
||||
key="${locator//[^a-zA-Z0-9_]/_}"
|
||||
loc_file="$state_dir/loc_${key}"
|
||||
if [[ -f "$loc_file" ]]; then
|
||||
session_id=$(cat "$loc_file")
|
||||
if [[ -n "$session_id" ]]; then
|
||||
echo "OP_TRACKER_NOTIFY=1 op -s ${session_id}"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "OP_TRACKER_NOTIFY=1 op"
|
||||
Loading…
Add table
Add a link
Reference in a new issue