There's a recurring issue with window management at work:

I work on a task, so I have lots of open windows for that task. I don't
like to minimize/iconify windows (my window manager doesn't even have
that function anymore), but instead I organize them in multiple
workspaces. For example something along these lines:

-   Workspace 1: An editor and a terminal for running `make` (which also
   shows potentially large compiler output). I mostly work in the
   editor, but I switch between these two windows repeatedly. Maybe a
   third window showing a manpage.
-   Workspace 2: Four terminal windows, each running SSH, connected to
   some servers. I use these to run the program that I just compiled on
   workspace 1 remotely on those servers.
-   Workspace 3: The same set of SSH connections, but here they're
   showing `tail -f some.log`.
-   Workspace 4: Also a terminal with SSH, but a different server, it's
   a corner case that isn't closely related to the other four servers.

I think you get the idea.

This works pretty well, *unless* something unexpected comes up and I
have to interrupt working on that task. I now have to perform a context
switch in my brain -- and on my computer. So, I begin using new
workspaces, say workspace 5, where I'll spawn new windows related to
this new task.

That gets confusing really quick. In the heat of the moment, I keep
forgetting what my "first" workspace for this second task was. Was it 5?
Or 7? Or 3?

So, ideally, I'd want a clean state for this new task. Put all the
existing windows aside and start from scratch. When I'm done, I want to
go back to how things were before the interruption.

I think I have finally come up with a lightweight solution for this.

I used to have hotkeys like this:

   { KeyPress, Mod4Mask, XK_1, "katriac workspace_select 1" },
   { KeyPress, Mod4Mask, XK_2, "katriac workspace_select 2" },
   { KeyPress, Mod4Mask, XK_3, "katriac workspace_select 3" },
   { KeyPress, Mod4Mask, XK_4, "katriac workspace_select 4" },
   { KeyPress, Mod4Mask, XK_5, "katriac workspace_select 5" },
   { KeyPress, Mod4Mask, XK_6, "katriac workspace_select 6" },
   { KeyPress, Mod4Mask, XK_7, "katriac workspace_select 7" },
   { KeyPress, Mod4Mask, XK_8, "katriac workspace_select 8" },
   { KeyPress, Mod4Mask, XK_9, "katriac workspace_select 9" },
   { KeyPress, Mod4Mask, XK_0, "katriac workspace_select 10" },

   { KeyPress, Mod4Mask, XK_F1,  "katriac workspace_select 11" },
   { KeyPress, Mod4Mask, XK_F2,  "katriac workspace_select 12" },
   { KeyPress, Mod4Mask, XK_F3,  "katriac workspace_select 13" },
   { KeyPress, Mod4Mask, XK_F4,  "katriac workspace_select 14" },
   { KeyPress, Mod4Mask, XK_F5,  "katriac workspace_select 15" },
   { KeyPress, Mod4Mask, XK_F6,  "katriac workspace_select 16" },
   { KeyPress, Mod4Mask, XK_F7,  "katriac workspace_select 17" },
   { KeyPress, Mod4Mask, XK_F8,  "katriac workspace_select 18" },
   { KeyPress, Mod4Mask, XK_F9,  "katriac workspace_select 19" },
   { KeyPress, Mod4Mask, XK_F10, "katriac workspace_select 20" },
   { KeyPress, Mod4Mask, XK_F11, "katriac workspace_select 21" },
   { KeyPress, Mod4Mask, XK_F12, "katriac workspace_select 22" },

In other words, a fixed set of hotkeys. Mod4 + 1 is always the exact
same workspace. I now replaced it with this:

   { KeyPress, Mod4Mask, XK_t, "katriac-topic interactive_select" },

   { KeyPress, Mod4Mask, XK_1, "katriac-topic workspace_select 1" },
   { KeyPress, Mod4Mask, XK_2, "katriac-topic workspace_select 2" },
   { KeyPress, Mod4Mask, XK_3, "katriac-topic workspace_select 3" },
   { KeyPress, Mod4Mask, XK_4, "katriac-topic workspace_select 4" },
   { KeyPress, Mod4Mask, XK_5, "katriac-topic workspace_select 5" },
   { KeyPress, Mod4Mask, XK_6, "katriac-topic workspace_select 6" },
   { KeyPress, Mod4Mask, XK_7, "katriac-topic workspace_select 7" },
   { KeyPress, Mod4Mask, XK_8, "katriac-topic workspace_select 8" },
   { KeyPress, Mod4Mask, XK_9, "katriac-topic workspace_select 9" },
   { KeyPress, Mod4Mask, XK_0, "katriac-topic workspace_select 10" },

   { KeyPress, Mod4Mask, XK_F1,  "katriac workspace_select 1" },
   { KeyPress, Mod4Mask, XK_F2,  "katriac workspace_select 2" },
   { KeyPress, Mod4Mask, XK_F3,  "katriac workspace_select 3" },
   { KeyPress, Mod4Mask, XK_F4,  "katriac workspace_select 4" },
   { KeyPress, Mod4Mask, XK_F5,  "katriac workspace_select 5" },
   { KeyPress, Mod4Mask, XK_F6,  "katriac workspace_select 6" },
   { KeyPress, Mod4Mask, XK_F7,  "katriac workspace_select 7" },
   { KeyPress, Mod4Mask, XK_F8,  "katriac workspace_select 8" },
   { KeyPress, Mod4Mask, XK_F9,  "katriac workspace_select 9" },
   { KeyPress, Mod4Mask, XK_F10, "katriac workspace_select 10" },

The function keys still refer to a fixed set of workspaces. Those are
indeed static, fixed ones: Mod4 + F1 will now always jump to my (main)
browser window. Mod4 + F3 will always jump to IRC.

But the hotkeys for 1 thru 0 all go through a special script
`katriac-topic`. This script also provides an interactive mode: I can
create new "topics" and select the currently active one. Then, when I
press Mod4 + 5, it will jump to the fifth workspace *for this particular
topic*.

So, I now have a relatively small set of hotkeys, but I can access way
more workspaces than before. The assumption being that I don't jump
between *topics* all the time, but only between workspaces of one topic.

Bonus points because I didn't have to implement any new features in my
WM.