The Cat of Shadow, and Multiplexed Terminals

So for those of you who don’t know (which will probably be most of you…), I have started interning at Shadowcat Systems, where their philosophy (for new staff atleast) is to push you off a cliff, and see how long it takes for you to learn to fly. Currently im still falling, though slightly slower than before, which brings me to the main subject of this post: Tmux.

So, way back (ok so more like mid 2007/8) when I started messing in Linux for desktop and server based stuff, I had the need for keeping terminal’s open even when I was not connected to the server, and for having several open at one time. Now anyone who has used Linux for such purposes have probably used something called Screen – an exceedingly powerful window manager for the command line, though with a very steep learning curve, and (as i found ‘back in the day’) quite a difficult to understand config and use.

Fast forward to a few months ago, when I was first sorting out things with Shadowcat, and I realised that a lot of the time there I would be spending at the command line, and would have need for something quite similar to Screen. Remembering how little I liked said program, I had a look around, and happened across Tmux. Now dont ask me how I came across it, I really cannot remember the details, but all I know is that it makes sense. Ok, as with all command line interfaces and the like, there is always a learning curve, and I dont know how much of this I remembered from using Screen, but it clicked in and worked.

One of the major things I liked, was that there was a permanent statusbar, just like the taskbar seen in Windows/ Linux/ Mac/ insert OS here. I know that screen has the same option, but at the time I didnt know that, and having looked at some of the documentation for how to make that work nicely, I’m quite sure I would have just ran away screaming. Another function I liked was the ability to split windows into ‘panes’, and swapping between them quickly. Again, screen has this functionality (I think, somewhere….), but as before, being able to just pick it up and run with it is always a good sign.

The other major thing that I really like about it now, is how easy it is to customise it. I spent quite a while looking at tmux-powerline, which is a plugin of sorts that is designed to change the look of the statusbar, and update it with loads of quite useful functions. However, I really did not need all that extra stuff, and to be honest was quite confused about the ‘patched fonts’ – which relied on another related project’s documentation and files to work (the fact that the instructions linked to on the other projects documentation no longer exists, and when eventually found on ANOTHER related project, didn’t work either, did not bode well…). And anyway, these fonts were just for a few bits of visual flair… nice, but I felt was unnecessary, and was not going to work in my use-case either. The one major thing I liked about it, was the colour and the rough look of the bar, which I unceremoniously nabbed and then played with until I had what I am currently using.

tmux-current
My current Tmux scheme

As you can see, if you have taken a look at the powerline thingy linked earlier, the colours are quite similar. The one major difference though, is that this doesn’t need any shell scripts to run, and all is in the .tmux.conf file, which I can copy to any machine im working on which has Tmux, and have an environment that I am happy to use all day long. My Tmux config is below, and if anyone would like me to go through it, or have any questions about it, feel free to ask.

#-----------------------------------------------------------
# Tmux Config
#
# Created by Tom "TBSliver" Bloor
#
# Provided as-is, do what you want with it.
# Usual not-my-fault disclaimer if something goes wrong
# after using this!
#-----------------------------------------------------------

# Set Ctrl - a as the standard prefix, globally
set -g prefix C-a

# Unbind Ctrl - b as a shortcut so can use it for something else
unbind C-b

# Bind Ctrl - a as the send-prefix command to stop confusion
# with vim or when using tmux in tmux
bind C-a send-prefix

# set the dafault delay to make tmux more responsive
set -sg escape-time 1

# bind r to reload this conf file
bind r source-file ~/.tmux.conf \; display "Reloaded!"

# set the terminal to use 256 colors
set -g default-terminal "screen-256color"

# set what the current active window status bar should look like
set-window-option -g window-status-current-format "#[fg=colour255, bg=colour27] #I : #W "

# set what the standard status format should be
set-window-option -g window-status-format " #I : #W "

## Set the text (fg) and background
set -g status-fg colour136
set -g status-bg colour235

# set the window status colors and attribute
setw -g window-status-fg default
setw -g window-status-bg default
setw -g window-status-attr dim

# set the pane borders and colors
set -g pane-border-fg colour136
set -g pane-border-bg colour235
set -g pane-active-border-fg colour235
set -g pane-active-border-bg colour136

# set the alert and tmux command line colors
set -g message-fg colour136
set -g message-bg colour235
set -g message-attr bright

# set the window list to centre
set -g status-justify centre

#set utf8 encoding
set -g status-utf8 on

# set the left side of the status bar to show the current active
# session, window and pane
set -g status-left "#[fg=colour234, bg=colour148] #S:#I.#P #[fg=colour0, bg=colour33] #H "

# set the right side of the status bar to show the current date and time
set -g status-right "#[fg=colour136, bg=color235] %a %d-%m-%Y | %H:%M "

# set tmux to monitor for activity in a window, and let the
# window list show activity in a window
setw -g monitor-activity on
set -g visual-activity on

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.