Switching between layouts in i3

Following my previous post on how to define, save and restore layouts, in this post I’ll show you a way to quickly switch between layouts.

As shown in the last post not only is it possible to load a desired workspace layout, but also you can automatically populate the placeholders with applications of your choice. Imagine you’ve created two layouts: workspace_1-basic.json and workspace_1-generic.json.

You can create two short scripts to load the layouts and populate them with programs. Please note that we need to kill all the existing windows in the workspace. Otherwise, the loaded layout will append itself next to the existing windows on the workspace. It’s not the most graceful way of killing windows but I couldn’t find any other way of doing it. Furthermore, do not forget to add the trailing & to indicate that the job needs to be executed in the background. Otherwise, the first program will block loading any subsequent ones.

~/.i3/i3-load.basic.sh

# Kill all the existing containers
# Add more instances of the 'focus parent' command if you ever have more containers
i3-msg 'workspace 1; focus parent; focus parent; focus parent; focus parent; focus parent; kill'
i3-msg 'workspace 1; append_layout /home/sycamorex/.i3/workspace_1-basic.json'

# Start programs
xterm -name topleft -e 'ncmpcpp' &
xterm -name bottomleft &
xterm -name topright -e 'emacs -nw' &
xterm -name bottomright &

~/.i3/i3-load.generic.sh

# Kill all the existing containers
# Add more instances of the 'focus parent' command if you ever have more containers
i3-msg 'workspace 1; focus parent; focus parent; focus parent; focus parent; focus parent; focus parent; kill'
i3-msg 'workspace 1; append_layout /home/sycamorex/.i3/workspace_1-generic.json'

# start programs
xterm -name topleft -e 'ncmpcpp' &
xterm -name middleleft -e 'irssi' &
xterm -name bottomleft -e 'mc' &
xterm -name topright -e 'htop' &
xterm -name bottomright -e 'emacs -nw'

We can bind them to keys in i3 main config file:
~/.i3/config

bindsym $mod+g exec /home/sycamorex/.i3/i3-load-generic.sh
bindsym $mod+b exec /home/sycamorex/.i3/i3-load-basic.sh

Please note that the layout feature is still fresh. It hasn’t even reached the stable branch of i3 yet. As far as I know, it’ll be part of version 4.8 of i3 (whenever it’s released). See my previous post on how to install the development branch of i3 that will let utilise this feature.

Happy tiling!!!

Perharps you’ve read the articles saying that not getting enough care about health may add your risk of countless heartiness woes. Online is the best method to buy remedies. For example Antabuse is used in determined folk with chronic alcoholism. This medicament can help keep you from drinking because of the unpalatable side effects that will occur if you consume alcohol while capture Antabuse. Viagra which is used to treat failure to get or keep an erection and other states united to erectile disfunction. A lot of men ask about cialis from canada. What is the most great information you must know about cialis online usa? Questions, like , are linked divers types of medicinal problems. Positively, a sexual disfunction refers to a problem during any phase of the sexual response cycle that prevents the couple from experiencing satisfaction from the sexual living. Unhealthy lifestyle choices, venous leak, melancholia, and several medicines can reduce your wish. Your body can not react well to stress. Note that your sex therapist has preassigned Viagra or any other drug because she has judged that the profit to you is biger than the risk of potential side effects. Remember, if you have any other questions about Viagra ask your pharmacist.

Leave a Reply

Your email address will not be published. Required fields are marked *