i3 the tiling Window manager

What do you have and what do you want?

Moderators: b1o, jkerr82508

User avatar
Posts: 9329
Joined: 14 Mar 2010, 16:34

i3 the tiling Window manager

Postby viking60 » 04 Jul 2016, 12:06

So I decided to go "mouse free" and install the i3 tiling window manager. :tux5:
It is all about shortcuts so you really do not need the mouse.

I installed the i3 group logged out and there I had i3 as an option on my login manager.

On this first run an auto config routine started so I simply "Entered" my way through it. This sets my Windows key to be "mod" aka the key to press to make something happen.
It created ~/.config/i3/config which can be edited to set up your i3 like you want it (it works out of the box though).

I logged in to a very minimal black screen so I had to be a chicken an read up on i3.
To get started I simply could press Win-key (hereafter called mod) + ENTER and one terminal fired up. to get another terminal I simply repeated it. That was easy!
from the terminal I fired up firefox and it popped up nicely next to the terminals.

To "zoom in one" of the windows I could simply press mod+f (for "full")

NIce.. but I really don't need an open terminal that is occupied with running programs so I installed dmenu.

I am setting this thing up in Arch and dmenu is preset in the default i3 settings with mod+d ..but dmenu is not installed with i3.

Now I could start any program I wanted from the dmenu.

I can navigate from window to window with mod+ arrow keys and change their placement with shift+mod+ arrow keys

..It sounds complicated; but it is not really.

i3 is very light and takes little memory and you will get used to it fairly quickly.

I had two problems:
i3 did not recognize the global norwegian keyboard layout.
I wanted to save my window setup to autostart after reboot.

To get my keyboard working I simply typed

Code: Select all

setxkbmap no
in a terminal.

To get my current window setup to load I had to install perl-anyevent-i3 and perl-json-xs .

Then I ran:

Code: Select all

i3-save-tree --workspace 2 > ~/.config/i3/workspace_N.json

This will save my current workspace to ~/.config/i3/workspace_N.json
I edited the file like this:

Code: Select all

tail -n +2 ~/.config/i3/workspace_N.json | fgrep -v '// splitv' | sed 's|//||g' > ~/.config/i3/workspace_N.json

Now I have to write a script to automagically load the layout:


Code: Select all

i3-msg "workspace M; append_layout ~/.config/i3/workspace_N.json"
(firefox &)
(geany &)
(xfce4-terminal &)
(xfce4-terminal &)
#Setting up norwegian keyboard and making it stick
setxkbmap no

Here I start Firefox, Geany and two xfce4-terminals - but you can start anything you want. And i made my Norwegian keyboard stick.
Remember to make the file executable:

Code: Select all

chmod u+x ~/load_layout.sh

Now it is time to incorporate this in our i3 config file - so I added this line in ~/.config/i3/config:

Code: Select all

$mod+g exec ~/load_layout.sh to ~/.config/i3/config

It binds the config to mod + g so that I only have to hit Win-key + g to get my layout

Now I can type shift+mod+e for exit and log back in to that minimalistic black screen.

typing mod+g
and everything is there as I left it.
There are a lot of things you can configure in i3 so have a look here
also the config file may be placed in a different location than ~/.config/i3/config in that case just alter all my references to it in above code too your location.

To start quickly without reading everything; here is a shortcut map:
Keys used with mod (Win-key)
Keys used with shift+mod (shift+Win-key)
Video coming up....
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

Return to “Software”