i3 window manager - multi-monitor workspaces
By default, the i3 tiling window manager allows switching workspaces on each monitor separately. We can achieve switching the workspace at all monitors at once, so that we will have something like multi-monitor workspaces instead.
(1) Define monitor names. These can be easily obtained by running the xrandr
command without any arguments.
(2) Set workspace names. We will have 4 “A” workspaces for the first monitor and 4 “B” workspaces for the second monitor. This will allow us to have 4 “multi-monitor” workspaces.
(3) Bind workspaces to specific monitors, so that the “A” workspaces will be always opened on the first monitor and the “B” workspaces on the second one.
(4) Define workspaces switching, so that both workspaces (for both monitors) will be switched at once. Note that the “workspace per monitor” logic of i3 is still preserved - here we only create the illusion of multi-monitor workspaces by actually switching the workspaces on both monitors at once.
There is a disadvantage that after switching, the workspace “A” will always be the active one (even if workspace “B” was active previously). This is because we actually do 2 separate actions when the switching key is pressed - switch to “B” workspace and then immediately to the corresponding “A” workspace. It can be made the other way around if preferred - each of the 4 lines could switch to “A” workspace first and then subsequently to the “B” workspace, leaving the “B” workspace as the active one.
(5) Define windows moving to specific workspaces. Here, a window will move always to the “A” workspace, even if it was on some “B” workspace previously. This is a slight disadvantage, too.
(6) Note that if you have more monitors or want more workspaces, you can edit the configuration accordingly by copying the relevant parts more times.