If you use tmux a lot, then you probably have a script that looks like this:
bash
tmux new-window -n $WINDOW_NAME
tmux split-window -h
tmux select-pane -t 0
tmux send-keys "fish" C-m
tmux send-keys "nvim" C-m
tmux select-pane -t 1
tmux send-keys "fish" C-m
tmux resize-pane -R 80
tmux -2 attach-session -t $SESSION
Scripts like the one above set up and open a tmux session with specified commands and layout.
But if I wanted to have another pane that ran my tests, or another for note taking, I'd have to create an entirely new script.
I also wanted to be able to use some program like fzf or skim to pick a directory to open.
This got super annoying.
Dmux aims to handle all of this for you. Its main job is to open up configurable "workspaces" in whatever directory you want. It also allows you to specify everything you would normally set in a script like the one above.
For example, the above script using dmux would be:
dmux -c nvim fish <path>
Then if I wanted the workspace to open 3 panes instead of two, I could add:
dmux -c nvim fish "npm i" -p 3 <path>
But say I wanted to use fzf to select a dir to open up.
Well, if I have it installed on my system, then I just have to leave off the
If this part is a bit slow to get started, no worries, you can speed up the dir searching by installing fd.
You can also use whatever combination of dir searching, selector, or hardcoded path you want by piping a path into dmux:
fd -td | fzf | dmux
or having a path argument:
dmux <path>
There's a ton of other fantastic projects out there that also do similar things that you should check out: * tmuxinator * tmuxomatic - Unmaintained * teamocil - Unmaintained
bash
brew tap zdcthomas/tools
brew install dmux
Or if you have rust installed
bash
git clone https://github.com/zdcthomas/dmux
cd dmux
cargo install --path .
Coming soon
dmux
alone will use fzf
to open up a list of dirs in ~
. This is equivalent to saying fd -td . ~/ | fzf | dmux
dmux <path>
or <path> | dmux
will open the workspace in the provided pathdmux clone
will clone a git repo and open the repo in a workspacedmux layout
will describe the current Tmux layout (this is mostly )dmux --help
for more informationDmux's configuration tries to be very inclusive in terms of config file types. Dmux supports
JSON, YAML, TOML,
and HJSON
. It also supports a variety of paths including
~/.dmux.conf.{file_type}
~/.config/dmux/dmux.conf.{file_type}
and on Linux
$XDG_CONFIG_HOME/dmux/dmux.conf.{file_type}
This config file has a profile named javascript
and defaults set
```toml layout = "5e09,281x67,0,0{133x67,0,0,17,147x67,134,0[147x33,134,0,18,147x33,134,34{73x33,134,34,136,73x33,208,34[73x16,208,34,164,73x16,208,51,165]}]}" sessionname = "development" numberof_panes = 5 commands = ["nvim", "fish"]
[javascript] numberofpanes = 3 session_name = "frontend" commands = ["nvim", "fish", "yarn watch"] ```
Currently dmux relies on fzf to select a target dir to open the workspace in. If you have fd installed dmux will use it to speed up dir searching.
npm i
or mix deps.get