Jorisvandijk.com

Living on Linux

My i3 config: Part one

I use Linux. I have been since 2010. Currently my flavor of Linux is Arch. On it I use the i3 window manager and have been since 2014. It is, in my opinion, the ultimate way to use your desktop.

Previous website

I have a lot to talk about considering this window manager, as I have made it my own in many different ways. It remains a perpetual work in progress for me, as I keep fine tuning and -honestly- messing with it to get it to do exactly what I want... no, what I need it to do.

Current i3 config

My current i3 config, the file you need to edit in order to change aspects of the i3 window manager, keeps changing. It's always evolving as I am using my system. You can see the current version in my dotfiles.

A closer look

Let's have a look at my i3 config file and go line-by-line through it to understand what everything in it is doing.

Mod, font and gaps

After the file header you'll find this bit:

floating_modifier  Mod4
font pango: monofur 15
gaps inner 20
gaps outer 25
gaps bottom -5

The first line handles which modifier key I set on my configuration. Mod4 means the Mod key. Or the Super key. Or even the Windows key. At any rate, this is the key I need to press, followed by another key to make "stuff" happen.

The font line is simple. This sets the font for all window titles and for the i3bar at the bottom. I personally don't use window title bars, so in my case this just sets the font for the i3bar, which is the transparent bar at the bottom of the screen, in the above screenshot, which shows the battery, clock and system tray.

What follows are the settings for gaps. The version of i3 I use is called i3-gaps, which enables this behavior. It sets the gaps on the outside of the windows and the gaps between them. The bottom one gets a -5, because it also has a transparent bar there, which is 5 high. With this setup all outside gaps are the same size and the bottom one has a bar over it.

Window rules

Next up is the following bit:

for_window [class="^.*"] border     pixel 0
for_window [class="mpv"] fullscreen enable
for_window [class="firefox" urgent="latest"]focus
for_window [class="floatterm"] floating enable,
resize set 800 600, move position center

The first line indicates all windows have no border (or title bar). The second line makes sure any MPV window is full-screened when launched. The Firefox line, which is the third here, makes sure that when a tab is launched from outside of Firefox, it will get focus. This means that when you click a link outside of Firefox, it will bring Firefox into focus on the page that link linked to.

The last line sets certain values to windows with the "floatterm" class, which is a class I've set for windows that should act like a popup in the middle of the screen, with their content running. I'll get more into this at a later stage.

Variables

Next up would be the variables I set:

set $1 bindsym Mod4
set $2 exec --no-startup-id
set $3 bindsym Mod4+Shift
set $4 kitty
set $5 exec --no-startup-id bin/SwitchLaunch
set $6 exec_always --no-startup-id

I've decided to make sure that whenever I am going to reuse a bit of code, I am setting it as a variable. In this bit you can see "set" means "use as". The "$x" means "we'll name this as". Anything after it will be what the $ value meant. So for example, "$1" literally means "bindsym Mod4".

I am going to continue this at a later stage, but the above will get you started on how to understand my i3 config and how to get yours to do what you need it to.

Get more information on the next part of this post.