I’ve been using linux a LONG time, and without a doubt the best and most versatile graphical environment I have ever used is the i3 tiling window manger. Technically I use a fork called i3-gaps, but I will talk about that in another post one day. What makes i3 the best (for me) is that it fits the way I work, is easily customized, and that all the navigation can be done with the keyboard. Two really cool features of i3 are the scratchpad and vim like marks.
The scratchpad is a place you can send floating windows where you can quickly retrieve them when needed. Think of it sort of like minimizing a window–except that with i3 windows are not minimized. i3 is a tiling window manager and all windows are by default opened in the largest dimensions possible. If a window is the only window opened on a workspace, then it is maximized; and if any more windows are opened on that workspace they are tiled to take up half the space of the previously opened window on that workspace. Any tiled window can be turned into a floating window (and toggled back into a tiled window) with the following keystroke (where the mod key is either set to the windows key or the alt key, depending on your i3 config file–in my case I have the mod key set to the windows key and mod1 set to the alt key):
mod+shift+space is a toggle, meaning repeating the keystroke will disable floating for the window and return it to a tiling window.
Once a window is turned into a floating window it can be sent to the scratchpad like this:
Technically, you don’t have to turn a window into a floating window before you send it the scratchpad; i3 does that for you when you send something to the scratchpad. mod+shift+minus will send any window, whether it is tiled, tabbed, or floating to the scratchpad; but any window that is retrieved from the scratchpad is brought back as a floating window.
When a window is sent to the scratchpad it disappears. Like I said, it is sort of like minimizing a window, except that status bars in i3 show workspace numbers, not windows; that means that there is no status bar indicator showing where that window went. What good is a disappearing window if you can’t bring it back? Any window sent to the scratchpad can be retrieved like this:
What makes this cool is that you can take any window that you don’t need right now, and set it aside, out of the way, until you need it again, and then bring it right back to the front, where and when you need it. You can even configure programs to start in a floating window that is sent straight to the scratchpad at start up. I have my i3 config file set up to automatically start the RPN calculator orpie, and a urxvt terminal window opened in a floating window and sent to the scratchpad as soon as I start i3. In the case of urxvt, my config file has this in it:
exec --no-startup-id urxvt -name scratchterm
for_window [instance="scratchterm"] move scratchpad
What if you decide that you no longer want a program to be in the scratchpad? Simply retrieve it from the scratchpad (mod+minus), and do a mod+shift+space to return it to a tiled window.
Once you have sent several windows to the scratchpad, you can bring them back with a mod+minus; this will bring them back one (and only one) at a time in a cycling sequence based on the order that they were sent to the scratchpad. What that means is, if you have eight windows in the scratchpad, you will have to repeat the mod+minus keystroke until the one you are looking for cycles back around. This can become a little bit of a time waster, and that is where vim like marks come in.
Why are they called vim like marks? Marks in vim allow you to record your current position so that you can return to it later. In i3 marks can be applied to windows that allow you to directly jump to a specific window. In the case of windows that don’t reside in the scratchpad, going to a marked window will switch to the appropriate workspace and focus the marked window. That is cool enough all by itself, but combined with the scratchpad, it gets even better.
I avoided using marks for a while, because I have i3 configured to not draw window decorations (title bars and borders), and I though this meant I couldn’t use marks. I have since found out two things, marks do not have to be drawn on window decorations to use then, and i3 can even be configured to not show marks in window decorations.
So, how do you use marks, and what makes using them so great coupled with the scratchpad? The way I use marks in i3 is by using the i3-input tool to assign a mark to a window that can be used to retrieve that specific window from the scratchpad. This allows me to assign a keystroke to mark a window and another to later go to that marked window whenever I choose. Simply adding the following to your i3 config file will do the trick:
# read 1 character and mark the current window with this character
bindsym $mod+m exec i3-input -F 'mark %s' -l 1 -P 'Mark: '
# read 1 character and go to the window with the character
bindsym $mod+g exec i3-input -F '[con_mark="%s"] focus' -l 1 -P 'Goto: '
With this, when I type mod+m the i3-input tool will open a one line terminal to accept input, and I can mark the focused window with a one character mark. Then, I can send that window to the scratchpad with all the other windows that are already there. Later I can just type mod+g and then input the one character mark I assigned, and boom, the marked window is retrieved from the scratchpad. I didn’t have to type mod+minus, 8 times to cycle through the scratchpad windows until I found it.
That’s just the way I use the scratchpad with marks, and that just scratches the surface (see what I did there?). You can configure i3 to move containers and windows to a mark, use marks with a window’s class and title (or named instance like I used in the urxvt example above) to jump to a specific window, and marks can be be replaced removed and even toggled.
Scratching the itch where x marks the spot is something that should never be typed in a blog.