Few month ago I started to use i3wm.
I can say this is very good concept. It’s fast, simple and clean.After getting used to that I decided to apply same concepts to the tmux.
In this blog post, I talk about how Alt+Tab is not good while making development.
As you know that human brain loves to create relations between other objects.
For Ex: If we describe some place to another person we generally start to explain by using known areas in the city like bank or main square etc. The reason of this they are known and they are staying in same position for a long time. It’s kind of mapping feature which our brain loves to do that. 1
One of the thing that made me surprise after installing i3wm, there is no Alt+Tab in this windows manager2. Person who use this wm have to use WindowsKey+number combination to switch different application.
My configuration is:
1 2 3 4 |
Windowskey + 1 is Firefox Windowskey + 2 is Emacs Windowskey + 3 is Microsoft teams Windowskey + 4 is tmux |
I just respected that and tried to use computer without it. After time, I started to think Alt+tab is not effective. The main reason Alt+Tab never shows application windows in same order. It’s so dynamic. 3
The world which we live is not like that and our brain didn’t evolve like that. It loves object to stay in same location, same order etc. 4If the object is not on the same point, brain active search mode and this is additional cost for us.
I decided to use this workflow also in tmux.
Also, If you want to apply same workflow for tmux which is text-ui part of my work.
Here is code which makes it possible.
1 2 3 4 5 6 7 8 9 10 |
bind-key 0 if-shell 'tmux select-window -t :0' '' 'new-window -t :0' bind-key 1 if-shell 'tmux select-window -t :1' '' 'new-window -t :1' bind-key 2 if-shell 'tmux select-window -t :2' '' 'new-window -t :2' bind-key 3 if-shell 'tmux select-window -t :3' '' 'new-window -t :3' bind-key 4 if-shell 'tmux select-window -t :4' '' 'new-window -t :4' bind-key 5 if-shell 'tmux select-window -t :5' '' 'new-window -t :5' bind-key 6 if-shell 'tmux select-window -t :6' '' 'new-window -t :6' bind-key 7 if-shell 'tmux select-window -t :7' '' 'new-window -t :7' bind-key 8 if-shell 'tmux select-window -t :8' '' 'new-window -t :8' bind-key 9 if-shell 'tmux select-window -t :9' '' 'new-window -t :9' |
Pseudo is here
1 2 3 4 5 6 7 |
if you press prefix + number if window is exist; switch window else create new window(number) endif endif |
I hope it will be useful also for you.