Travis Finkenauer's Blog

Improved i3 Workspace Switcher

I recently switched to the i3 window manager. This was not my first time using a tiling window manager---I have previously used xmonad. My gripe with xmonad was that even though I am familiar with functional programming (specifically OCaml), I did not understand the Haskell configuration script at all, and it seems like I'm not the only one. For me, i3 wins over xmonad in terms of configuration simplicity.

xmonad workspace switching🔗

However, I do like the way xmonad handles workspaces on multiple displays. Each display acts like a viewport into a workspace. When switching to a workspace, the output that has focus will switch to the requested workspace. If the requested workspace was already showing on another output, then the other output and focused output will swap their workspaces.

xmonad workspaces

i3 workspace switching🔗

i3's workspace switching contrasts with xmonad's approach. With i3, each workspace is assigned to an output. When switching to a workspace, the corresponding output displays the requested workspace, displacing the workspace that was previously showing on that output. This makes it more tedious to move a workspace to a specific output.

The Solution🔗

In order to solve this problem, I wrote a script for i3 that emulates xmonad's workspace switching. You can grab the script from Github. I used i3-py to communicate with i3 via the IPC interface, which you can install with pip.

Example Install🔗

Download script

cd ~/.i3
git clone

Add keybindings to your i3 config (for me it's ~/.i3/config)

# Switch to workspace like xmonad
set $x_switch exec --no-startup-id ~/.i3/i3-wk-switch/
bindsym $mod+1 $x_switch 1
bindsym $mod+2 $x_switch 2
bindsym $mod+3 $x_switch 3
bindsym $mod+4 $x_switch 4
bindsym $mod+5 $x_switch 5
bindsym $mod+6 $x_switch 6
bindsym $mod+7 $x_switch 7
bindsym $mod+8 $x_switch 8
bindsym $mod+9 $x_switch 9
bindsym $mod+0 $x_switch 10