Compare commits

..

2 Commits

4 changed files with 53 additions and 0 deletions

View File

@@ -30,6 +30,10 @@ agent=$(printf '%s\n' "${agents[@]}" | fzf \
--margin="0,$hmargin" \ --margin="0,$hmargin" \
--padding=1) --padding=1)
# Reset cursor so the agent doesn't render starting where fzf left it.
tput cup 0 0
tput ed
if [ -n "$agent" ]; then if [ -n "$agent" ]; then
"$agent" || true "$agent" || true
fi fi

27
notes-cmd.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Open neovim in the notes directory.
# Detaches the client if all panes in the window are dead afterwards.
notes_dir="$HOME/Documents/Notes"
nvim "$notes_dir" || true
# Brief delay to let tmux update pane status
sleep 0.1
window_id=$(tmux display-message -p '#{window_id}')
my_pane=$(tmux display-message -p '#{pane_id}')
# Count live sibling panes (not us, not dead)
other_live=$(tmux list-panes -t "$window_id" -F '#{pane_id} #{pane_dead}' \
| awk -v me="$my_pane" '$1 != me && $2 == "0"' | wc -l | tr -d ' ')
if [ "$other_live" -eq 0 ]; then
# No live siblings — close the popup and kill the window
# (also cleans up any dead siblings).
tmux detach-client
tmux kill-window -t "$window_id" 2>/dev/null || true
else
# User has split off other live panes — only kill ours, keep popup open.
tmux kill-pane 2>/dev/null || true
fi

20
notes.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -e
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
notes_dir="$HOME/Documents/Notes"
# Create the notes session if it doesn't exist
if ! tmux has-session -t notes; then
tmux new-session -ds notes -c "$notes_dir" -n notes "$script_dir/notes-cmd.sh"
fi
# Apply session options on every invocation so updates propagate to live sessions
tmux set-option -t notes status off
tmux set-option -t notes remain-on-exit on
tmux set-option -t notes default-command "$script_dir/notes-cmd.sh"
# Attach to the session
tmux attach-session -t notes

View File

@@ -69,6 +69,7 @@ if -b '~/.config/tmux/check-version.sh ">=" 3.2 && ~/.config/tmux/check-version.
bind A display-popup -d '#{pane_current_path}' -w 50% -h 90% -E ~/.config/tmux/agent.sh bind A display-popup -d '#{pane_current_path}' -w 50% -h 90% -E ~/.config/tmux/agent.sh
bind H display-popup -w 75% -h 75% -E htop bind H display-popup -w 75% -h 75% -E htop
bind I display-popup -d '#{pane_current_path}' -E ~/.config/tmux/interpreter.sh bind I display-popup -d '#{pane_current_path}' -E ~/.config/tmux/interpreter.sh
bind N display-popup -w 75% -h 90% -E ~/.config/tmux/notes.sh
bind P display-popup -w 60 -h 10 -E ~/.config/tmux/project.sh bind P display-popup -w 60 -h 10 -E ~/.config/tmux/project.sh
bind S display-popup -w 60 -h 10 -E ~/.config/tmux/session.sh bind S display-popup -w 60 -h 10 -E ~/.config/tmux/session.sh
bind T display-popup -d '#{pane_current_path}' -E $SHELL bind T display-popup -d '#{pane_current_path}' -E $SHELL
@@ -77,6 +78,7 @@ if -b '~/.config/tmux/check-version.sh ">=" 3.3' {
bind A display-popup -S fg=#54546D -b rounded -d '#{pane_current_path}' -w 75% -h 90% -E ~/.config/tmux/agent.sh bind A display-popup -S fg=#54546D -b rounded -d '#{pane_current_path}' -w 75% -h 90% -E ~/.config/tmux/agent.sh
bind H display-popup -S fg=#54546D -b rounded -w 50% -h 75% -E htop bind H display-popup -S fg=#54546D -b rounded -w 50% -h 75% -E htop
bind I display-popup -S fg=#54546D -b rounded -d '#{pane_current_path}' -E ~/.config/tmux/interpreter.sh bind I display-popup -S fg=#54546D -b rounded -d '#{pane_current_path}' -E ~/.config/tmux/interpreter.sh
bind N display-popup -S fg=#54546D -b rounded -w 75% -h 90% -E ~/.config/tmux/notes.sh
bind P display-popup -B -w 60 -h 10 -E ~/.config/tmux/project.sh bind P display-popup -B -w 60 -h 10 -E ~/.config/tmux/project.sh
bind S display-popup -B -w 60 -h 10 -E ~/.config/tmux/session.sh bind S display-popup -B -w 60 -h 10 -E ~/.config/tmux/session.sh
bind T display-popup -S fg=#54546D -d '#{pane_current_path}' -E $SHELL bind T display-popup -S fg=#54546D -d '#{pane_current_path}' -E $SHELL