Automating the startup of a dev workflow
Jan 2, 2024 · 3 min readHopefully, this is the first of many small posts showing how I automate my workflow.
Back around 2008, I had a mentor/buddy for my new job. Rys. He was a wonderful, knowledgeable, and supportive buddy who always seemed to be one step ahead.
One day he noticed that I came into the office each day, opened the terminal, and created x amount of tabs, which I then named (So I knew what each terminal was there for, e.g. logs, database, git, and codebases etc).
He asked me:
“How much time would you save if you could automate that?”
Sitting there, stunned, I wasn’t sure how to do what he said, but that question has stuck with me throughout my career. Then over the years, I’ve started to automate more and more, because I would remember Rys asking me how much time I would save.
So, I now have an alias defined as follows:
start-company() {
open -a Music
open -a Slack
open -a "Google Chrome"
open -a Obsidian
open -a Notion
open -a Miro
open -a "Visual Studio Code"
}
Where company
is the name of the company I work for. This may seem small, and maybe even obvious, but running start-company
each time I boot my machine is substantially quicker than opening each application in turn.
Running this command is the first of many stacked habits I have in the morning. For more information on stacking habits, check out Atomic Habits. I’m hopefully going to write up other habits I have for my workflow.
So I have my terminal and other applications open, but how about naming those darn terminal windows Rys asked me about all those years ago?
Well, I now use tmux and tmuxinator. I have had many failed tmux
attempts over the years, but I’m firmly bedded in now.
What is tmux
?
tmux is a terminal multiplexer: it enables a number of terminals to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached.
That nicely brings us to tmuxinator
:
Create and manage tmux sessions easily.
Therefore I can start a tmux
session, via tmuxinator
, which has a defined configuration. So one example would be:
name: dotfiles
root: ~/
windows:
- bms: cd ~/git/github/benmatselby
- work: cd ~/git/github/[company-name]
- dotfiles: cd ~/git/github/benmatselby/dotfiles
- life: cd ~/git/github/benmatselby/life
When I now run tmuxinator start dotfiles
(I have this aliased to txs
), I get 4 named windows/tabs in a tmux
session, all in the correct working directory. This is a massive time saving for me. I have many tmuxinator
configuration files now. Each project generally gets its own configuration.
Hopefully, this setup is useful, or maybe interesting to you. Happy automating folks 😊