Add zellij alongside tmux
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
# Agentic Session Preferences
|
||||
|
||||
## Tmux session titling
|
||||
- Treat this chat as the controller for the current tmux session.
|
||||
- Run the tmux rename one-liner eagerly without checking whether TMUX is set first.
|
||||
## Multiplexer session titling
|
||||
- Treat this chat as the controller for the current tmux or zellij session.
|
||||
- If the current session is in tmux, run the tmux rename one-liner eagerly without checking whether TMUX is set first.
|
||||
- If the current session is in zellij, run the zellij rename commands eagerly without checking whether ZELLIJ is set first.
|
||||
- Maintain a session/window/pane title that updates when the task focus changes substantially.
|
||||
- Prefer automatic titling: infer a concise <task> from the current user request and context without asking.
|
||||
- Title format: "<project> - <task>".
|
||||
@@ -11,11 +12,13 @@
|
||||
- <task> is a short, user-friendly description of what we are doing.
|
||||
- Ask for a short descriptive <task> only when the task is ambiguous or you are not confident in an inferred title.
|
||||
- When the task changes substantially, update the <task> automatically if clear; otherwise ask for an updated <task>.
|
||||
- When a title is provided or updated, immediately run this one-liner:
|
||||
- When a title is provided or updated, immediately run the matching command for the active multiplexer:
|
||||
|
||||
tmux rename-session '<project> - <task>' \; rename-window '<project> - <task>' \; select-pane -T '<project> - <task>'
|
||||
|
||||
- Assume you are inside tmux, so do not use -t unless the user asks to target a specific session.
|
||||
zellij action rename-session '<project> - <task>' && zellij action rename-tab '<project> - <task>' && zellij action rename-pane '<project> - <task>'
|
||||
|
||||
- Assume you are inside the active multiplexer, so do not use tmux `-t` or zellij targeting flags unless the user asks to target a specific session/tab/pane.
|
||||
- For Claude Code sessions, a UserPromptSubmit hook will also update titles automatically based on the latest prompt.
|
||||
|
||||
## Pane usage
|
||||
|
||||
@@ -1,25 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -z "${TMUX:-}" ]]; then
|
||||
if [[ -n "${ZELLIJ:-}" ]]; then
|
||||
multiplexer="zellij"
|
||||
elif [[ -n "${TMUX:-}" ]]; then
|
||||
multiplexer="tmux"
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
input=$(cat)
|
||||
|
||||
read -r cwd prompt <<'PY' < <(python3 - <<'PY'
|
||||
mapfile -d '' -t parsed < <(PAYLOAD="$input" python3 - <<'PY'
|
||||
import json, os, sys
|
||||
try:
|
||||
data = json.load(sys.stdin)
|
||||
data = json.loads(os.environ.get("PAYLOAD", ""))
|
||||
except Exception:
|
||||
data = {}
|
||||
|
||||
cwd = data.get("cwd") or os.getcwd()
|
||||
prompt = (data.get("prompt") or "").strip()
|
||||
print(cwd)
|
||||
print(prompt)
|
||||
sys.stdout.write(cwd)
|
||||
sys.stdout.write("\0")
|
||||
sys.stdout.write(prompt)
|
||||
sys.stdout.write("\0")
|
||||
PY
|
||||
)
|
||||
cwd="${parsed[0]:-}"
|
||||
prompt="${parsed[1]:-}"
|
||||
|
||||
if [[ -z "${cwd}" ]]; then
|
||||
cwd="$PWD"
|
||||
@@ -46,7 +54,7 @@ if [[ -z "$task" ]]; then
|
||||
task="work"
|
||||
fi
|
||||
|
||||
# Trim to a reasonable length for tmux status bars.
|
||||
# Trim to a reasonable length for multiplexer UI labels.
|
||||
if [[ ${#task} -gt 60 ]]; then
|
||||
task="${task:0:57}..."
|
||||
fi
|
||||
@@ -54,7 +62,7 @@ fi
|
||||
title="$project - $task"
|
||||
|
||||
state_dir="${HOME}/.agents/state"
|
||||
state_file="$state_dir/tmux-title"
|
||||
state_file="$state_dir/${multiplexer}-title"
|
||||
mkdir -p "$state_dir"
|
||||
|
||||
if [[ -f "$state_file" ]]; then
|
||||
@@ -66,5 +74,11 @@ fi
|
||||
|
||||
printf '%s' "$title" > "$state_file"
|
||||
|
||||
# Update session, window, and pane titles.
|
||||
tmux rename-session "$title" \; rename-window "$title" \; select-pane -T "$title"
|
||||
# Update session, window/tab, and pane titles.
|
||||
if [[ "$multiplexer" == "tmux" ]]; then
|
||||
tmux rename-session "$title" \; rename-window "$title" \; select-pane -T "$title"
|
||||
else
|
||||
zellij action rename-session "$title"
|
||||
zellij action rename-tab "$title"
|
||||
zellij action rename-pane "$title"
|
||||
fi
|
||||
|
||||
@@ -170,6 +170,7 @@
|
||||
"tig",
|
||||
"tmate",
|
||||
"tmux",
|
||||
"zellij",
|
||||
"unoconv",
|
||||
"vim",
|
||||
"w3m",
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
- Prefer `just run` (foreground) and `just restart` (background) when running taffybar during iterative work.
|
||||
- If running manually, prefer `direnv exec . cabal run` (or `nix develop -c cabal run` if direnv is not active) so you get the right build inputs and environment.
|
||||
|
||||
## Tmux session titling
|
||||
- If the TMUX environment variable is set, treat this chat as the controller for the current tmux session.
|
||||
## Multiplexer session titling
|
||||
- If the `TMUX` or `ZELLIJ` environment variable is set, treat this chat as the controller for the current tmux or zellij session.
|
||||
- Maintain a session/window/pane title that updates when the task focus changes substantially.
|
||||
- Prefer automatic titling: infer a concise <task> from the current user request and context without asking.
|
||||
- Title format: "<project> - <task>".
|
||||
@@ -14,11 +14,13 @@
|
||||
- <task> is a short, user-friendly description of what we are doing.
|
||||
- Ask for a short descriptive <task> only when the task is ambiguous or you are not confident in an inferred title.
|
||||
- When the task changes substantially, update the <task> automatically if clear; otherwise ask for an updated <task>.
|
||||
- When a title is provided or updated, immediately run this one-liner:
|
||||
- When a title is provided or updated, immediately run the matching command for the active multiplexer:
|
||||
|
||||
tmux rename-session '<project> - <task>' \; rename-window '<project> - <task>' \; select-pane -T '<project> - <task>'
|
||||
|
||||
- Assume you are inside tmux, so do not use -t unless the user asks to target a specific session.
|
||||
zellij action rename-session '<project> - <task>' && zellij action rename-tab '<project> - <task>' && zellij action rename-pane '<project> - <task>'
|
||||
|
||||
- Assume you are inside the active multiplexer, so do not use tmux `-t` or zellij targeting flags unless the user asks to target a specific session/tab/pane.
|
||||
|
||||
## Pane usage
|
||||
- Do not create extra panes or windows unless the user asks.
|
||||
@@ -30,4 +32,3 @@
|
||||
|
||||
## Skills
|
||||
A skill is a set of local instructions to follow that is stored in a `SKILL.md` file.
|
||||
|
||||
|
||||
@@ -110,6 +110,7 @@ in {
|
||||
shellAliases = {
|
||||
df_ssh = "TERM='xterm-256color' ssh -o StrictHostKeyChecking=no";
|
||||
ta = "tmux attach";
|
||||
za = "zellij attach";
|
||||
};
|
||||
initContent = lib.mkMerge [
|
||||
(lib.mkOrder 550 ''
|
||||
|
||||
@@ -82,6 +82,7 @@ with lib;
|
||||
df_ssh = "TERM=xterm-256color ssh -o StrictHostKeyChecking=no";
|
||||
fix_nix = "LD_LIBRARY_PATH='' nix";
|
||||
ta = "tmux attach";
|
||||
za = "zellij attach";
|
||||
};
|
||||
variables = {
|
||||
ROFI_SYSTEMD_TERM = "ghostty -e";
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
silver-searcher
|
||||
skim
|
||||
tmux
|
||||
zellij
|
||||
unzip
|
||||
wget
|
||||
xkcdpass
|
||||
|
||||
Reference in New Issue
Block a user