Edit:
The simplest way to do this is to modify the default-command
variable tmux provides. So in the tmux config file (~/.tmux.config
?):
# in tmux.conf
set-option -g default-command 'systemd-run --user --scope bash'
Older solution (round about, not needed)
I’m not sure tbh.
For the time being, I dug in a little more and realised I could run each tmux “window” in isolation. To create a new window in tmux
one goes :new-window <command>
. So, one can use:
:new-window systemd-run --user --scope bash
And one can override the default bindings so that new windows are created like this:
# in .tmux.conf
bind-key c new-window systemd-run --user --scope bash
So, there’s only the one tmux server, but each window is isolated. Testing out the oom killer by running tail /dev/zero
in one tmux window caused it to be killed, but did not affect other tmux windows or sessions, or the server.
So, i think this is perhaps the “cleanest” way to go about it.