On some servers, I use shell scripts similar to the example below to quickly recreate a familiar workspace in tmux for myself after reboots and to provide customized tmux sessions for other users on these servers.
One particularly useful featue of tmux' send-keys is that command lines can be pre-written without executing them, e.g.:
# execute command by sending the return key at the end (C-m)
send-keys 'mysql database -u root -p' C-m \; \
# do not execute command by not sending the return key
send-keys 'mysql database -u root -p' \; \
This pre-writing can be useful for commands that should only be executed on demand, e.g. because they require interactive input or launch resource-hungry processes. Also, commands launched in tmux using send-keys do not make the terminal session/pane disappear after they terminated, which is useful to keep the layout the same at all times.
On some servers, I use shell scripts similar to the example below to quickly recreate a familiar workspace in tmux for myself after reboots and to provide customized tmux sessions for other users on these servers.
I would like to see similar functionality in Tilix for similar reasons. I'm aware that session layouts can be saved and that it is possible to execute tilix-specific commands and execute child processes in tilix and in saved sessions. However, unless I overlooked something, these solutions are not as flexible or powerful as the solution provided by tmux. tmux provides the
send-keys
argument to send arbitrary sequences of key presses to the active terminal session.One particularly useful featue of tmux'
send-keys
is that command lines can be pre-written without executing them, e.g.:This pre-writing can be useful for commands that should only be executed on demand, e.g. because they require interactive input or launch resource-hungry processes. Also, commands launched in tmux using
send-keys
do not make the terminal session/pane disappear after they terminated, which is useful to keep the layout the same at all times.