#5609·tmux

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:

  1. Promote default-command to a window-scoped option
  2. (Optionally) add a flag to new-session¹ and new-window that sets default-command to the given command

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.

  1. 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.
  2. Because sessions are keyed by their name, I have do extra checks to avoid error messages in my script
  3. Creating a session with a different default-command currently 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.