Skip to content

Instantly share code, notes, and snippets.

@keysie
Last active March 2, 2017 11:18
Show Gist options
  • Save keysie/655bc720338505af3724a8374ab1842a to your computer and use it in GitHub Desktop.
Save keysie/655bc720338505af3724a8374ab1842a to your computer and use it in GitHub Desktop.
# Bind session kill
bind k kill-session
# Rebind pane splitting
unbind %
bind | split-window -h
bind - split-window -v
# Show date+time | network connection | battery status in right status
set -g status-right-length 70
set -g status-right "#(date '+%a, %d.%m.%y, %H:%M') | network: #(nmcli -t -f NAME connection show --active) | #(upower -i $(upower -e | grep 'BAT') | grep -E "state" | grep -oE "\(dis\)\{0,1\}charging") #(upower -i $(upower -e | grep 'BAT') | grep -E "percentage:" | grep -oE "[0-9]{2,3}\%")"
# add this code at the bottom of ~.profile
# this code kickstarts the script to start tmux
# to make sure this only happens when loggin on from tty1
# there is a case-clause in place
case $(tty) in /dev/tty[1]*)
tmux-default.bash
esac
Todo-list to achieve this:
1. install tmux
2. set up tmux configuration in ~/.tmux.conf
3. set up a script to launch tmux in a custom setup (tmux-default.bash)
4. place tmux-default.bash in some folder like /usr/local/bin (make sure they can only be accessed and are owned by root!)
5. add code to ~/.profile to launch tmux-default.bash at startup
6. set up ubuntu to boot without x-server (see respective file)
7. set up a permanent system alias (e.g. via /etc/bash.bashrc) like --> alias startx="sudo service lightdm start" <--
8. configure desktop manager to directly log you in on start (you will need to enter your password to start x anyway).
Edit /etc/default/grub with your favourite editor, e.g. nano:
sudo nano /etc/default/grub
Find this line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Change it to:
GRUB_CMDLINE_LINUX_DEFAULT="text"
Update GRUB:
sudo update-grub
For systems that use systemd
This is an additional step for systemd releases, e.g. Ubuntu 15.04, the steps above for grub are still necessary.
You need to tell systemd to not load the graphical login manager:
sudo systemctl enable multi-user.target --force
sudo systemctl set-default multi-user.target
-> x-server can now be started with sudo service lightdm start
#!/bin/bash
# Create new tmux session
tmux new-session -d -s keysie-default
# Create some windows
tmux new-window -t keysie-default:1 -n 'iPython' 'ipython'
tmux new-window -t keysie-default:2 -n 'SysMon' 'top'
# Select window 1 and configure it in more detail
tmux select-window -t keysie-default:0
tmux rename-window 'Main'
tmux split-window -h
tmux split-window -v
# Select window 3 and config more details
tmux select-window -t keysie-default:2
tmux split-window -h
tmux split-window -v
# Connect to the session and start
tmux select-window -t keysie-default:0
tmux -2 attach-session -t keysie-default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment