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