tmuxstart

I use tmux because it is rather awesome and I have spent quite a bit of time developing a script to automate starting it. It uses screen compatible key bindings to help with muscle memory. It should just work on debian and be easy to adapt for redhat and others.


I'm not happy with the mouse mode component because it wrecks my OS clipboard functionality so I've still got some work to do (help?). With this much effort it would be a shame to not share it so here it is.


#!/bin/bash
echo
# first window is called console, top 60% is bash
tmux new-session -d -n console -s default
# remap prefix to Control + a
tmux set -g prefix C-a
tmux unbind C-b
tmux bind C-a send-prefix
# windows start at '1'
set -g base-index 1
# allow resize
tmux setw -g aggressive-resize on
# allow mouse mode
tmux set -g mode-mouse on
tmux set -g mouse-resize-pane on
tmux set -g mouse-select-pane on
tmux set -g mouse-select-window on
# lower left 50% x 40% is logs
tmux split-window -p 40 'bash -c "tail -Fn20 /var/log/syslog"'
# lower right 50% x 40% is htop
tmux split-window -h htop
# window for work (bash)
tmux new-window -c ~/Documents/Projects/ -n work
# window for root
tmux new-window -n root 'sudo su -'
# window for htop
tmux new-window -n htop 'htop'
# window for syslog 
tmux new-window -n syslog 'bash -c "tail -Fn20 /var/log/syslog"'
# focus on desired window
tmux selectw -t 0
tmux selectp -t 0
# wish I could remember what this does
tmux a -t default

Saturday 15th October 2016 9:36 am

Back to blog.peeto.net blog