#!/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