To explain what Spawn Mode entails, as far as how I use it is concerned, I will first go over the concepts of Window Managers, and Vim. These are wonderful tools that are at the core of how I prefer to use computers, and I think, that most ‘power users’ greatly benefit from them.
Window Managers or: How to Enforce Peaceful, Diplomatic Relations Between All Your Windows
The XSM approach—in alignment with the philosophy of the debloated, minimal desktop environment—favors the use of Window Managers over more traditional means of operating a personal computer, such as through Desktop Environments.
Hot keys, clean, uncluttered workspaces, void of distracting icons and docks; and the grid layout approach for window management come in favor of the typical, DE scenario: all windows in a cluster, stacked unorderly on top of each other, with a complete mess of application icons, folders, and various documents in the background, on the desktop. There’s nothing wrong with working like that, per se, but I think very few people would deliberately choose it, if they had only been exposed to Window Managers before Desktop Environments.
For an optimized, clean working environment that brings the most amount of efficiency—tailored to those who will be using computers on a regular basis, especially the power user—it seems hard to beat a Window Manager(WM) when working on a desktop computer or laptop. For our purposes, we will focus on i3, as that is the WM used for XSM. I3 is what’s known as a manual tiler; that means you have more fine grained control over where each window spawns. You can modify i3 to be more automatic in how it tiles windows, or you can find a WM that automatically tiles windows by default. There are many options available, though other WMs won’t be discussed here.
Vim Philosophy, Vimism?
Previously, we’ve gone over how Tmux brings all your terminal applications together neatly in tabs, we should also note that the WM of our choice, i3 for XSM, organizes everything else: the browser and any other applications, to all get along and share the space on the screen in an orderly way across multiple workspaces when necessary. Putting all that aside, let’s focus on how things are usually done in this type of Workflow.
Normally, when using a WM, you define your key bindings in the configuration file, as anything you like, for any actions that you desire. It’s common to use a modifier key, usually the alt key or the Windows key, so that all your system management hot keys all lead with the same key (this key is also know as the Mod key). This serves to organize everything neatly in your mind so that various program hot keys don’t interfere with the overall global hot keys of the system. This is the basic concept of the Workflow inside a Window Manager, but what has that workflow got to do with Vim?
For anyone who’s read this far, and is wondering what Vim is—Vim is a text editor; a tool for editing text, and the right tool for that job, no doubt. There are many resources you can find on Vim, and why it’s such a good tool for editing text.
The way these two connect is through the idea within XSM to marry the Window Manager with the modal design philosophy of Vim.
When working with Vim, you have your Normal Mode, where all the keys function how you would expect them to, normally; hence “Normal Mode”. Then, when you switch mode, let’s say to Insert Mode, every key press takes on an entirely new meaning, unique to that particular mode. Why is this so good? Well, just stop to think about that for a moment. In the case of “Insert Mode”, you press the “i” key to enter into the mode. That’s a single press of a fairly accessible key, without the use of any modifiers, that has given you a whole new world of possibilities—or at least a whole new keyboard’s worth. As far as I’m concerned, the less you have to stretch your fingers between two or three keys, the better; though as we will see in a bit, we can’t get away from the pesky finger stretching entirely.
It all comes down to the limitations we’re faced with on a regular keyboard, doesn’t it? There’s a set, final amount of keys. No more, and no less than what is laid out in front of you. Imagine if you didn’t have your shift key, or your alt key. Now you know exactly how Vim users feel when they are forced to edit text in any other program besides Vim (that doesn’t have a Vim Emulator Mode, which lots of them do).
What if I told you to think of your Window Manager as being modal, with normal mode being just as it is now. A set of hot keys that are active when you hold down your Mod key. That’s indeed exactly what I do when working on XSM. Holding your system’s modal key puts you in a sort of “Normal Mode”. From there you can start a new terminal window with the Enter key, switch to other windows with your regular h, j, k, and l keys that you’d use in Vim to move around, and so on.
Spawn Mode
This is where things get interesting. Now that we are working from the basis of having “Normal Mode” inside our Window Manager, what other modes are there?
The short answer: any sort of mode you wish to create, of course. But the mode I’d like to talk about now is something I call Spawn Mode
“Spawn Mode” is a special mode in XSM that is all about spawning programs, scripts, characters and anything that creates some kind of persistant thing (characters, windows, Tmux tabs, etc).
The Sacrifice and the Magic of Keymaps
In theory, you could—perhaps even should—use your Mod key to switch into different modes when working with your Window Manager, since that is an action related to the system in that way. In practice though, you’ll lose that Vim–like feel if you do. What I think you ought to do instead, is to sacrifice a lesser used key. That might sound very radical, losing the functionality of one whole key for something, well whatever this “Spawn Mode” thing might be, right; but it’s really a sacrifice for the greater good.
Look at your keyboard. What is a key you could probably do without? In my case, the obvious choice is the key right next to the left Shift key, before the “z”. You may not have a key there, but if you do, you may consider it.
Pressing this key puts me in “Spawn Mode”. From there I can use keys on the right hand side of the keyboard to enter brackets and other symbols. These keys now serve the purpose of “spawning” certain characters that otherwise require holding multiple keys at once to do.
If I press “r” in “Spawn Mode” my program launcher starts. If I press “w”, I can select special characters to insert. Pressing “q”, queries a selection of scripts and modules, but also daemons that run in the background, anything that creates a persistent presense or window of some kind. The emergent pattern should be obvious. As long as there’s persistence, “Spawn Mode” is used.
To make it even better, I’ve set up the bindings in i3 so that some of them automatically puts me back in “Normal Mode” when they are selected. That’s how the “r” binding works, as an example; when I press it, the program launcher starts and I get instantly put back in “Normal Mode”. It creates a certain flow that is hard to describe, and even harder to achieve in any other way. There are two reasons for this:
- We never have to press two keys at once, which allows us to roll off the keys in a very satisfying way.
- Whenever something persistent is needed—whether it’s a special character, application, script, or tab—there is now this concept of “Spawning” which leads the finger instinctively to the right key in anticipation of a similar action
The magic lays within a combination of i3’s layout functionality and loading in a custom key map when the “Spawn Mode” key is pressed. Akin to the way Modes are displayed in Vim, I named the layout -- SPAWN --
to indicate that you’re in “Spawn Mode” and I use the same color on the layout text as the Mode text in Vim (which would be displayed as -- INSERT --
for “Insert Mode”). This promotes consistency throughout the system.
Using this modal approach has made working with Window Managers even better than before. It adds another level of depth that I never knew I was missing.