feature: allow `default-command` to be a window-level option
Author: LunarLambdaCreated Sep 17, 2026Updated Sep 17, 2026
I would be interested in writing a PR for this.
The idea is such:
- Promote
default-commandto a window-scoped option - (Optionally) add a flag to
new-session¹ andnew-windowthat setsdefault-commandto the givencommand
My motivation for this is as follows:
I currently have a script that lets me create a dedicated ssh tmux session, where default-command is set to ssh some_host.
- I have to use a separate session, as there doesn't seem to be a good way to replicate this behaviour with a single window.
- Because sessions are keyed by their name, I have do extra checks to avoid error messages in my script
- Creating a session with a different
default-commandcurrently requires two commands:new-session -s "target" "ssh host" ; set -t "target" default-command "ssh host", which is both very verbose and potentially error-prone.
For reference, my script can be found here https://git.buny.computer/lambda/dotfiles/src/branch/main/tmux/scripts/ssh.sh#L20-L22
It would be great if I could simplify the session handling down to a single new-window -n "[ssh] $host" -9 "ssh $host" command, where -9 is the bikeshed placeholder for the proposed new flag.
Source: tmux/tmux