Problem with i3 Workspace Names
I got the configuration bug this morning and decided to change my i3 window manager setup. I have used the i3 tiling window manager for years but never bothered setting up workspace names, relying instead on the default numbering system.
The i3 documentation claims that you can use a quoted number prefix to associate a name to a number using a colon (ie "1: www"). Maybe I mis-interpreted this as I fumbled repeatedly trying to configure names using this syntax.
Use Variables to Identify Workspaces
Instead of trying to use the confusing and non-functional combination of strings and numbers I instead decided that variables were a better solution: allowing me to rename them from one location.
Assigning a variable in the i3 configuration is simple:
set $<variable_name> <variable_content>
I created ten workspace name variables to identify them. Some of them are not strings, as I rarely use them, and don't mind leaving them as numbers for now.
set $wksp1 "1: VSCode" set $wksp2 "2: Firefox" set $wksp3 "3: Terminal" set $wksp4 "4: Debug" set $wksp5 5 set $wksp6 "6: Misc" set $wksp7 7 set $wksp8 "8: Krusader" set $wksp9 "9: Spotify" set $wksp10 "10: Kate"
Reconfigure Keyboard Bindings
After creating the workspace variables at the top of the
config file I then changed the references to them in the keyboard binding sections.
# switch to workspace bindsym $mod+1 workspace $wksp1 bindsym $mod+2 workspace $wksp2 ... bindsym $mod+9 workspace $wksp9 bindsym $mod+0 workspace $wksp10
# move focused container to workspace bindsym $mod+Shift+1 move container to workspace $wksp1 bindsym $mod+Shift+2 move container to workspace $wksp2 ... bindsym $mod+Shift+9 move container to workspace $wksp9 bindsym $mod+Shift+0 move container to workspace $wksp10
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.