Discussion:
Tabbed Terminals in TMux?
kario tay
2015-01-19 03:53:41 UTC
Permalink
Hi -

I've been researching tiled window managers (WM) for the
following two features that aren't obvious in TMux:

1. Ability to use a terminal instance (running TMux)
as the "background" or "wallpaper" -- the way that a
tiling WM would do;

2. Ability to display multiple terminals within
a single pane, using a "tabbed" interface to switch
between them -- the way that most web browsers do
as you open new tabs over time.

---

Specifically for item #2, the Notion WM does this
"tabbed" style, as does the i3 WM. It's a clever feature
that could drastically reduce the amount of screen space
required for multiple panes in TMux.

Imagine being able to define your panes as usual. Within
one pane's space, define terminal instances that you see
as a set of tabs across the pane's top (one for vim,
one for emacs, one for the commandline, for example):

|----------------------------------------------------|
| * 1-vim * | 2-emacs | 3-cmdline | |
|------------+-----------+-------------+-------------|
| |
| Hello, world! |
| |
| Vim is an editor.... etc. |
| |

You can switch between them with 'Ctrl-Alt-Tab' or
other keyboard sequence define however you want.

I would install a tiled WM for this, but each has its
drawbacks: memory usage, need for learning a whole new
programming language just to configure the WM,
feature limitations and odd quirks, etc.

None of the tiled WMs are as versatile, simple (most
of the time) and robust as TMux.

So I thought I might pass this thought on to you.
Have you had similar thoughts and/or come up with
a "tabbed TMux terminal" solution that works for you?

Thanks for any ideas you might have.

____________________________________________________________
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.
Check it out at http://mysecurelogon.com/manager
kario tay
2015-01-22 21:49:42 UTC
Permalink
Thanks Martin and Nathan (everyone else from the TMux list,
scroll down to read their solutions for the question).

I decided to use my window manager and create a script
to tile my terminals (tabbed) on login. It's actually working
really well (after a lot of tweaking the window placement).
The "modular" approach turns out to be far more flexible
than TMux's "ice block of terminals overtaking the whole screen"
approach. Having tabbed terminals also vastly reduces the screen
real-estate required to meaningfully see everything at a glance.
I'd imagine that cutting out the "TMux middleman" probably
streamlines moment-to-moment memory usage as well.

i3 was Dependency Hell, sadly, due to Harfbuzz (the last piece
that refused to install and finally awoke me to the fact that DepHell
was nearly at hand). It does look fairly amazing, though, so one day
I'll be sure to give i3 another shot (if only for the sake of having done so).
Maybe by then they'll have sorted out the deps and smoothed
the install process a bit more.


-----Original Message-----
From: ***@archlinux.us
Sent: Mon, 19 Jan 2015 11:12:30 -0300
To: ***@inbox.com
Subject: Re: Tabbed Terminals in TMux?

Hey Kario,
Busy day here so TL;DR (perhaps later), check this conf.:

~ > cat .tmux.conf
# Let's get some fresh FISH
set-option -g default-shell "/usr/bin/fish"

# Change binding key
unbind C-b
set -g prefix C-v
set -s escape-time 1

# Reload the file with Prefix r
bind r source-file ~/.tmux.conf \; display "Reloaded!"

# Make main tmux window use the whole screen no matter from where you are attaching to it
setw -g aggressive-resize on

# use UTF8
set -g utf8
set-window-option -g utf8 on
set-option -g status-utf8 on

set -g history-limit 20000
set -g aggressive-resize on
# Let's make Weechat stop complaining about tmux running inside rxvt-unicode-256color
set -g default-terminal "screen-256color"

# highlight status bar on activity
set-window-option -g monitor-activity on
set-option -g visual-activity off

# status bar
set-option -g status on
set -g status-bg black
set -g status-fg white
set-option -g visual-bell off
set -g status-utf8 on
set-option -g status-utf8 on

# automatically set window title
setw -g automatic-rename on

# windows titles on the statys bar
set-option -g set-titles on
set-option -g set-titles-string '#T [#S:#I #H] #W'

# Easy Windows (Tabs) moving
#This don't works with urxvt
#bind-key -n C-S-Left swap-window -t -1
#bind-key -n C-S-Right swap-window -t +1

# Set the color of the window list
#setw -g window-status-fg colour50 ## Light-blue (light)
setw -g window-status-fg colour123 ## Cyan (light)


# Set status bar transparent or coloured for better contrast
set -g status-bg default
#set -g status-bg colour233

# set colors for the active window
setw -g window-status-current-fg colour15
setw -g window-status-current-bg colour197
setw -g window-status-current-attr bright

# pane colors
set -g pane-border-fg colour245
set -g pane-active-border-fg colour210

# Command / message line
set -g message-fg white
set -g message-bg black
set -g message-attr bright

# Update the status bar every five seconds
set -g status-interval 5

# center align window list
set-option -g status-justify left

# Define left and right wings
## White colour255 Grey colour245
set -g status-left-length 32
set -g status-right-length 90
set-option -g status-left "#[fg=default]#(tmux display-message -p '#S') #[fg=colour255]|"
set-option -g status-right "#[fg=default]#(cut -d ' ' -f 1-3 /proc/loadavg) #[fg=colour255] • #[fg=default]#(cat /sys/class/power_supply/BAT0/capacity)% #[fg=colour255] • #[fg=default]#(date +%a), #(date +%b) #(date +%d) #[fg=colour46]#(date +%R)"

# resize panes like vim
bind < resize-pane -L 10
bind > resize-pane -R 10
bind - resize-pane -D 10
bind + resize-pane -U 10

## Join windows: <prefix> s, <prefix> j
bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'"

# tmux status bar messages last only about a second (default value is: 750ms)
set-option -g display-time 7000

# Move on split windows
bind -n C-Left selectp -L
#bind -n C-h select-pane -L
bind -n C-Down selectp -D
#bind -n C-j select-pane -D
bind -n C-Up selectp -U
#bind -n C-k select-pane -U
bind -n C-Right selectp -R
#bind -n C-l select-pane -R

# As urxvt-tabbed
bind -n S-Down new-window
bind -n S-Up last-window
bind -n S-Left previous-window
bind -n S-Right next-window
#bind -n M-"[" copy-mode
#bind -n M-"]" paste-buffer
#bind -n M-'=' choose-buffer
#bind -n M-K confirm-before kill-pane
#bind -n M-"'" confirm-before kill-session

# quick view of processes
bind '~' split-window "exec htop"
bind 'F1' split-window 'exec watch -n2 "dmesg | tail -f"'
bind 'F2' split-window 'exec watch -n1 "who -uH"'
bind 'F3' split-window 'exec watch -n2 "route -n"'
bind 'F2' split-window 'exec watch -n2 "ip addr show"'

bind 'F4' split-window 'exec watch -n2 "route -n"'
bind 'F5' split-window 'exec watch -n0 "ls -l /dev/disk/by-id/*usb*"'

bind 'F6' split-window 'exec watch -n2 "lsblk"'
bind 'F7' split-window 'exec watch -n2 "blkid"'
# a2 lm-sensors [F8]
bind 'F8' split-window 'exec watch -n2 "sensors"'
bind 'F9' split-window 'exec watch -n1 "acpi -tab"'
bind 'F10' split-window 'exec watch -n1 "acpi -tV"'
bind 'F11' split-window 'exec watch -n1 "netstat -tonp"'

# Reorder tmux windows
bind-key -n C-S-Left swap-window -t -1
bind-key -n C-S-Right swap-window -t +1

# Select windows as you would with tags in your WM
bind-key -n M-0 select-window -t 0
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9

# // end of working settings


#//


#------------=============================================-----------------#

# /-----------------------------\
# Old stuff
# \-----------------------------/

# Move status to the top
#set-option -g status-position bottom

#set -g status-right-length 43

#set-option -g default-terminal "rxvt-256color"
#set -g default-terminal "rxvt-256color"

#setw -g mode-keys emacs
#set-option -gw window-status-activity-style fg=colour50,bg=black,reverse
#setw -g monitor-activity on
#set -g visual-activity on
#set-option -g status-right "#[fg=colour46] #H #[fg=default]* #[fg=colour245]#(cat /sys/class/power_supply/BAT0/capacity)% #[fg=default]* #[fg=colour255]#(cut -d ' ' -f 1-3 /proc/loadavg)"
#set-option -g status-left "#[fg=colour255]#(date +%R) #[fg=colour46]*#[fg=default] #(date +%B), #(date +%A) #[fg=colour255]#(date +%d)"
#set-option -g status-left " #[fg=colour255]#(date +%R) #[fg=colour46]*#[fg=default] #(date +%A·%B·%d)"

#Works best when aligned to center# set-option -g status-left "#[fg=colour255]#(date +%R) #[fg=colour46]•#[fg=colour250] #(date +%B), #(date +%A) #[fg=colour255]#(date +%d)"
#Works best when aligned to center# set-option -g status-right " #[fg=colour250]#(cat /sys/class/power_supply/BAT0/capacity)% #[fg=colour46]• #[fg=colour250]#(cut -d ' ' -f 1-3 /proc/loadavg)"

# Resize windows
#bind -r Left resizep -L
#bind -r Down resizep -D
#bind -r Up resizep -U
#bind -r Right resizep -R

#------------=============================================-----------------#
-----Original Message-----
Sent: Mon, 19 Jan 2015 07:29:43 +0000
Subject: Re: Tabbed Terminals in TMux?
Tmux doesn't support 'tabbing' as you mean it. Many people,
including me, are using nested sessions instead. With the
correct configuration this can work extremely good.
Some are also using two different servers but personally
I don't see an advantage of two servers for nesting.
You can either pass the prefix down (pressing it twice)
to the nested session or bind a key combination to pass the
combination to switch to a window.
command_check="#{pane_current_command} =~ "
regex_tmuxssh="[[ $command_check tmux|ssh ]]"
#Use square brackets to cycle through windows
bind -r '[' previous-window
bind -r ']' next-window
#binding for switching windows in nested tmux session
#it checks if the pane holds a tmux-session; if it sends the prefix and
the combination to switch windows; If no swap the windows
bind '{' run "$regex_tmuxssh && tmux send-keys 'M-f' '[' || tmux
swap-window -t -1"
bind '}' run "$regex_tmuxssh && tmux send-keys 'M-f' ']' || tmux
swap-window -t +1"
Personally I mostly switch through windows with numbers, so
this is kind of obsolete, but it works well with nested
sessions.
Or use i3, which is extremely easy to use and to configure
and you don't have to learn a whole language just to
configure it.
-Nathan
--
/"\ ASCII Ribbon Campaign
\ / - against HTML emails
X - against proprietory attachments
/ \ http://en.wikipedia.org/wiki/ASCII_Ribbon_Campaign
____________________________________________________________
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.
Check it out at http://mysecurelogon.com/manager

Loading...