box.matto.nl
Enjoying Open Source Software

Start Tmux from .xinitrc

When I boot up my laptop and log in, Tmux is already running and a terminal screen is attached to it. I have added a line to my .xinitrc that takes care of this.

Most of the stuff I do, is being done on the command line. I prefer text mode applications. Almost all of my writing is in Markdown. For email I use mutt, and just write plain text messages in Vim.

After logging in, Tmux is started, the i3 window manager is started and a window is opened with a st terminal screen attached to my Tmux session.

So, without having to do anything other besides typing in my username and password, I am looking at a terminal screen in a Tmux session.

I like to use the feature in Tmux to copy text to a buffer and paste text from this buffer. After having been using Screen for many years, it took me quit some time to get ussed to the Tmux way of copying (having to use Enter after selecting a region), but currently it is in my muscle memory.

Before I got this setup, I used the window manager (ratpoison in the past, i3 since some time) to start a new terminal session and some time later regretting not to have first started Tmux and thus must copy and paste by the use of the mouse.

I don't like using the mouse very much, defenitly not on the not-so-ergonomic trackpad.

With my new setup, without thinking I start working in new Tmux panes.

So, to do some copy and paste action, I use the Tmux method, with just some keyboard keys and without any mouse actions.

This also results in most of the time using just one or two st terminal screens. The downside is that I sometimes have eight or nine Tmux windows, some of them devided in two panes ...

This is the line in my .xinitrc that takes care of this:

tmux has-session -t workpad || st -n workpad -e tmux new -s workpad &

Tags: tmux i3 st