i3 and Cognitive Load
The i3 tiling window manager is a great way to decrease cognitive load by removing the chaos of overlapping windows. I have a dual monitor side-by-side setup. I like having my odd numbered workspaces on the left monitor and even-numbered workspaces on the right. While researching how to assign names to workspaces I discovered that you can assign specific workspaces to specific monitors. This is another great way to decrease cognitive load: remove the need for a number-per-monitor habit and automate my odd/even numbering scheme.
Identify Your Monitors
Monitors are named via the output that they are connected to. In order to identify your monitors you need to run the
xrandr --current command.
$ xrandr --current Screen 0: minimum 8 x 8, current 3840 x 1200, maximum 4096 x 4096 DVI-I-0 disconnected (normal left inverted right x axis y axis) DVI-I-1 disconnected (normal left inverted right x axis y axis) TV-0 disconnected (normal left inverted right x axis y axis) DVI-I-2 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 519mm x 324mm 1920x1200 60.0*+ 1680x1050 60.0 1600x1200 60.0 1440x900 75.0 59.9 1280x1024 75.0 1280x960 60.0 1280x720 60.0 1152x864 60.0 1024x768 75.0 70.1 60.0 800x600 75.0 72.2 60.3 56.2 640x480 75.0 72.8 59.9 DVI-I-3 connected 1920x1200+1920+0 (normal left inverted right x axis y axis) 518mm x 324mm 1920x1200 60.0*+ 1680x1050 60.0 1600x1200 60.0 1280x1024 75.0 60.0 1280x960 75.0 1024x768 75.0 60.0 800x600 75.0 60.3 640x480 75.0 59.9
The connected monitors identified from this output are "DVI-I-2" and "DVI-I-3". I identified "DVI-I-3" as the right monitor by dissecting the pixel offset information contained in the resolution string. This string is defined as: width x height + x-offset + y-offset. "1920x1200+1920+0" means that x-offset is 1920 pixels: a full monitor's width to the right of the other monitor.
Create Monitor ID Variables
Rather than use the "DVI-I-#" string in the monitor-workspace assignment I decided it would be better to assign the monitors to variables in the i3 config file (
# monitors set $monitor_left DVI-I-2 set $monitor_right DVI-I-3
In a prior post I also assigned workspace names to variables . I highly recommend this: it makes identifying the workspaces very simple.
Assigning Workspaces to Monitors
The basic syntax for assigning a workspace to a monitor/output in i3 is simple:
workspace <workspace_id> output <monitor_id>
My configuration looks like this:
# Setup workspaces workspace $wksp1 output $monitor_left workspace $wksp2 output $monitor_right workspace $wksp3 output $monitor_left workspace $wksp4 output $monitor_right workspace $wksp5 output $monitor_left workspace $wksp6 output $monitor_right workspace $wksp7 output $monitor_left workspace $wksp8 output $monitor_right workspace $wksp9 output $monitor_left workspace $wksp10 output $monitor_right
Note: These changes did not appear after I ran the standard i3 reload (Mod + Shift + r). I had to logout and log back in to get the changes to appear.