Tmux

Presentation of the tmux multiplexer

untagged

441 Words

2025-02-16 19:01 +0100


I use alacritty as my main terminal emulator. I spend a lot of time on it. But there is one feature missing : the tabs ! Of course i could switch to another terminal emulator with that feature but i love alacritty. I also would like to stay as minimalist as possible. That's where a terminal multiplexer comes in. There are many options out there : - Gnu screen - Tmux - Zellij I've tested all of them, the one i feel the more comfortable with is tmux. == Tmux functionnality i use To start a command in tmux the default is ctrl + b + command. In order to be readable i will only list the command : [cols="1,1", grid="cols"] |=== |c |create a new tab |, |rename the current tab |3 |go to tab number three |p |go to previous tab |n |go to next tab |x |close the tab |? |view all keybindings, exit with q |d |detach from the current session |=== From the terminal there are few usefull commands: [cols="1,1"] |=== |tmux ls |list sessions |tmux attach -t 0 |attach to the session number 0 |tmux source .tmux.conf |load/reload config file |=== That's all the keybindings i use for now, tmux can also split the terminal but i've got a tiling window manager so i'don't use that. And other features aren't useful for me. == Start Tmux on terminal launch To start tmux at every start of my terminal, i've added tmux in my .bashrc file. [source, shell] ---- # # ~/.bashrc # # If not running interactively, don't do anything [[ $- != *i* ]] && return alias ls='ls --color=auto' alias sudo='doas' #PS1='[\u@\h \W]\$ ' fastfetch #PS1='\e[36m[\u@\h:\e[34m\w]\]\e[00m$ ' eval "$(starship init bash)" # start tmux tmux # Created by `pipx` on 2024-05-04 14:54:14 export PATH=$HOME/.local/bin:$HOME/.local/share/gem/ruby/3.3.0/bin:${PATH} export GEM_PATH=/usr/lib/ruby/gems/3.2.0/:$HOME/.local/share/gem/ruby/3.3.0/ # Correct a bug with java and wayland export _JAVA_AWT_WM_NONREPARENTING=1 # default screenshot directory GRIM_DEFAULT_DIR=/home/mathieu/Screenshots XDG_SCREENSHOTS_DIR=/home/mathieu/Screenshots # Enables autocompletion of options for bashfuscator eval "$(/sbin/register-python-argcomplete bashfuscator)" ---- == Adaptation The default setup is ok but lacks the mouse scroll, in order to enable it i've written a .tmux.conf file : [source, console] ---- #.tmux.conf # Enable mouse mode set -g mouse on # Enable clipboard set -s set-clipboard external ---- Then i use the following command : [source, bash] ---- tmux source .tmux.conf ---- There is one feature that is different from what i normally do, in my terminal i use middle mouse button to paste highlighted info from other apps. In order to do that inside tmux i have to press shift + middle button. If it is from tmux to tmux i just press middle click.