Tips On Small-Screen Development
Most of the development team here at BiTE are very well supplied with screen real estate; in fact, I can’t believe how wide and how numerous their monitors are. Very often, someone shares their screen with me, and it’s so insanely wide that it’s almost impossible to see it on my screen, because it has to shrink so much in order to fit.
There’s no denying that a plenitude of pixels is a very good thing to have when you’re writing code. One tends to have a lot of windows open at the same time — processes running in the Terminal, things you’re keeping track of in a web browser, not to mention the frequent need for multiple views of the code you’re editing.
Sometimes, however, you can find yourself trying to do serious development work in the confines of a relatively small two-dimensional space. The implications of this situation have been driven home to me recently, because I find myself working, at the moment, on just a 15-inch portable MacBook Pro screen.
That’s a pretty good size, as it turns out; the computer is small enough to fit handily in a backpack and large enough to make application windows feel pretty big, and I’ve got double resolution (Retina) which is very easy on the eyes. (The 15-inch size is probably an absolute minimum for acceptability. I’ve tried in the past to develop on a 13-inch screen; I was barely able to do it, and it wasn’t pleasant.)
Still, as a result of not having the luxury of a large monitor size, not to mention extra monitors, I have been compelled to give some explicit attention, for the first time in many years, to mustering every possible technique for coping with a distinct lack of space in my virtual world.
Working from just the monitor of a portable computer is a great thing to be able to do, not least because it means you’re portable. You can go anywhere and do anything. But you definitely need to be armed with some basic tricks and tips for making the most of your limited screen real estate. Here, then, are some of mine.
I’m not as keyboard-crazy as some people on the BiTE team — such as Aaron, whose ears tend to have smoke coming out of them if he is forced to lift his fingers from the keyboard for even a moment — but there’s no doubt that knowing the keyboard shortcuts for things can go a long way toward easing navigation of all sorts when you’re working in a confined screen space.
You might think I’m talking only about working with text editors, such as Xcode. To some extent, that’s true. Selecting and navigating text with the keyboard is a really important thing to know how to do. Everyone knows how to navigate text by line (Up arrow and Down arrow), but knowing how to navigate by word (Option-Right arrow and Option-Left arrow) is often just as useful, and you can also jump to the start or end of a line (Command-Right arrow and Command-Left arrow). There are a lot of other text navigation and selection keyboard shortcuts built into the Mac text system, and it’s worth knowing about them.
Quite apart from editing text, though, there are many other sorts of keyboard shortcut that can come in handy, and with a little practice they will become part of your repertory as well. A good example is scrolling.
We are all accustomed to scrolling with two fingers on the trackpad, but you can scroll with the keyboard alone instead, and being able to do so can add up to a lot of time saved. The Up and Down arrows usually scroll a line at a time. To scroll a page at a time using a portable keyboard, you can typically hold the Fn key and use the Up and Down arrows.
To scroll the whole document at a time, hold the Fn key and use the Left and Right arrows; being able to jump quickly to the top or bottom of the page is often a major desideratum. A particularly important case in point is Safari. Jumping around a page that you’re reading in your browser can be very useful. Many web pages have menus at the extreme top or bottom, so it pays to be able to get there quickly.
How are you going to find out about keyboard shortcuts? Probably not by sitting down and reading the documentation. I’m the first to admit that merely reading a dry list of keyboard shortcuts is likely to make one’s eyes glaze over; it’s no way to learn anything. You have to use keyboard shortcuts in order to get them into your fingers, as it were. Typically this happens because you are in the situation where you need one. If you feel yourself stymied and want to know if there’s a keyboard shortcut for what you are trying to do, that’s the moment to take some time to learn that keyboard shortcut.
Even a tiny, trivial-seeming shortcut can make a huge difference. You should have heard the virtual yell that went up from Aaron on Slack the other day when he discovered that, having selected a file in the Finder, you can open it with Command-O — as opposed to Return, which edits the name of the file. It had just never occurred to him that that was possible. He won’t forget that keyboard shortcut now, ever. (Gosh, I wonder if I should tell him that Command-Down arrow does the same thing?)
When you’ve opened a lot of windows in a lot of apps, you can easily become completely lost in the clutter. You surely know that you can switch between running apps with the Command-Tab app switcher; but that’s not a great interface. You have to locate the app you want by visually seeking its icon in the switcher; and when you have managed to switch to the desired app, you still may be dealing with a large number of windows to sort through.
Once you’ve switched to the desired application, there is usually a Window menu that lists the open windows of the current application; but picking the correct window by name from a long list at the bottom of a menu full of other things is not a very nimble way to find a desired window.
Within the currently frontmost application, you can usually cycle through its actual windows with Command-Backtick. The trouble with that is that you are cycling! When you’ve got 20 Safari windows open, it can take a long time to cycle round to the one you’re hunting for. Particularly frustrating is when you accidentally cycle past the one you want, and have to keep on hitting Command-Backtick a lot more times just to come round to it again. (It might help to know that holding Shift as you press Command-Backtick cycles the other way.)
One way to deal more broadly with windows is Mission Control (Control-Up arrow on my machine). It shows you all your windows in all your applications and lets you pick one by clicking it.
Unfortunately, Mission Control is not really such a great interface either. If there are a lot of windows, Mission Control itself is not terribly useful, because you see all windows of all applications at once, reduced to a tiny size to fit together on your screen — so you still can’t pick out the window you want from all the clutter.
A partial solution to that problem is if you’ve checked “Group windows by application” in the Mission Control system preference pane. In that case, you get a more “clumped” view of the windows, and can find your way more easily to the right application, at least. A nice feature of this view is that you are shown the name of every application at once (unlike the Command-Tab app switcher, which is just a row of icons). Unfortunately, if you’ve got a large number of windows open in a particular application, you still can’t see them all, because now they are clumped.
The good news is that Mission Control also has a second mode called “Application windows,” where you are shown all the windows for just the currently frontmost app (Control-Down arrow on my machine). Plus, it is also useful to know this trick: if you hover the mouse over a window in Mission Control, you can see that window at full size, temporarily, by hitting the Space key. So at least you can explore the windows individually, looking for the right one.
Desktop Space Management
A third feature of Mission Control is desktop spaces. You can have multiple desktop spaces. When you switch between them, the entire content of your screen is replaced by a different set of windows. These can be windows from various applications. Thus, a desktop space can represent a topic that you’re working on, as it were.
You can navigate between desktop spaces fairly easily. There’s a keyboard shortcut for switching to the “next” or “previous” desktop space; on my machine, it’s Control-Right arrow or Control-Left arrow. Alternatively, you can enter Mission Control (first mode) and hover the mouse at the top of the screen; thumbnails of all your desktop spaces are displayed across the top of the screen (and this is where you can create or delete a desktop space).
Once again, this is a pretty crappy interface. In Mission Control, why do I have to make an additional special gesture just in order to summon the desktop space thumbnails? For that matter, why do I have to enter Mission Control at all? Why isn’t there a command that just summons a desktop space switcher, parallel to the app switcher?
Anyway, let’s talk about how to use desktop spaces as an organizational tool. Suppose I’ve got two desktop spaces. And let’s say I’m running several servers from the Terminal, each in its own Terminal window, and I want to be able to check on their status from time to time — but the rest of the time, I don’t need to see those Terminal windows at all. Well, if I move all of those Terminal windows into one individual desktop space, I can navigate to them all and away from them all by navigating my desktop spaces.
There are various ways to arrange that. You can drag windows one by one to the side of the screen until they are in the desktop space you want. You can also drag windows to a desktop space while you’re in Mission Control. In fact, if (as I suggested earlier) you’ve checked “Group windows by application” in the Mission Control system preference pane, you can go into Mission Control and drag the icon of the application itself into a desktop space at the top of the screen.
In addition, you can associate an application more broadly with a particular desktop space. This feature is really hard to discover. To use it, get yourself into the desired desktop space. Then locate the target application in the Dock, Control-click or long press on it, and choose Options > (Assign to) This Desktop. You are bringing all existing windows of that application into the current desktop space, and you are also saying to the system that it should remember your choice: the next time you launch this application, its windows will open in that desktop space by default.
Unfortunately, desktop spaces can be confusing. First of all, what desktop space am I even in right now? You’d think there would be some indication in the normal interface — perhaps a little number in the menu bar? — but there isn’t. However, here’s a trick: using System Preferences > Desktop & Screen Saver, you can assign a desktop background. This applies only to the current desktop space, so your desktop spaces can at last have different colored backgrounds.
Another problem is that cycling through an application’s windows with Command-Backtick doesn’t cycle to a window that’s in a different desktop space. If you’ve accidentally opened some windows of the same app in different desktop spaces, you can easily get confused about where a desired window is hiding. Fortunately, seeing all your windows with Mission Control’s “Application windows” mode still works; the interface for that mode ignores the existence of desktop spaces.
Just to complicate matters still further, there are two completely different kinds of desktop space. There are spaces that you have explicitly set aside by adding them to the interface in Mission Control, and there are spaces that come into being spontaneously whenever you put a window into fullscreen mode.
This suggests that it might be worth putting a window into fullscreen mode just for the sake of getting it into its own desktop space! That way, you can navigate to that window by navigating between spaces.
The trouble with this approach is that the only thing in the resulting desktop space is a single window. This means the window is the full width of the screen. For some situations, that may be wider than is comfortable to work with. Sometimes, what you’d like for your window to be fullscreen but not the full width of the screen.
I have a little trick for solving that problem. There’s a splitscreen configuration that lets you divide a fullscreen space between two windows. Instead of just going directly into fullscreen mode, you can choose Window > Tile Window to Left of Screen. This causes the current window to enter fullscreen mode in its own desktop space, but it occupies just half the screen.
However, you can’t actually do anything in this mode until you fill the other half of the screen with something else! This might take some planning. What I like to do is to start by creating an empty window in some neutral application, such as TextMate. This has no purpose except to act as filler on the right side of the screen. In the app where I want to work, I choose Window > Tile Window to Left of Screen. In the other half of the screen, I’m shown a sort of Mission Control view where I can pick a window to occupy that half of the screen. I choose my empty TextMate window.
Mission accomplished! My real working window is now on the left side of a fullscreen desktop space, sharing the screen with an empty window that I can just ignore. Moreover, the pane width is adjustable; I can slide the pane divider to make my real working window occupy any desired fraction of the full screen width.
(Since this is a development blog, I should mention that, in this regard, Xcode and a Simulator window make a particularly happy pair in split-screen mode.)
I am not saying that desktop space management in Mac OS X is great. It isn’t. It’s clunky and confusing. It feels as if several unrelated features have been glued forcibly together to create Mission Control — because, historically, that is exactly what has happened. Once you start using desktop spaces, you’ll probably find yourself switching spaces unaccountably, or unable to find windows that you know exist (because they are off in another space), or making a new window and having it open accidentally into a different space or in fullscreen mode, and on and on. It’s nutty.
Nevertheless, after some experimentation, you may find that the trade-offs are worth it and that multiple desktop spaces, some of them manually created and some of them occupied by fullscreen windows, are a useful way to manage your screen.
Windows, alas, are not the only content-containing entity that needs management. There are also tabs! Tabs effectively divide up a single window into multiple subwindows. Not all applications use tabs, but many do: Safari is a case in point. (Xcode also has window tabs, but you are less likely to use them.)
Tab management is even worse than window management. You can readily get yourself into a situation where you’ve got, say, 20 tabs in a single Safari window, and now you can’t find any of them! Command-Backtick doesn’t cycle through tabs. Mission Control doesn’t display individual tabs. Safari doesn’t even have a menu that lists its own open tabs! (The closest it comes to that is the View > Show Tab Overview menu item, which is not quite the same thing; it shows only the tabs of the current window.)
To some extent, therefore, I’m tempted to say: don’t use tabs. However, with some care, tabs can supplement your use of desktop spaces. For instance, a single Safari window containing three tabs, placed into fullscreen mode, is effectively three Safari windows sharing a single desktop space. That sounds good; but remembering where you left those tabs is still totally up to you.
Find a Good Utility
You can boost your nimbleness and productivity very greatly by taking advantage of one or more third-party utilities. I can’t tell you what third-party utility to use; it needs to be something you’re comfortable with, and it needs to meet your actual needs.
For example, if the problem is window-and-tab navigation, you might like something along the lines of Witch; personally, I tried it and found it didn’t help me iron things out, but you might feel differently. Similarly, there’s a utility for desktop space management, called TotalSpaces; but it isn’t my cup of tea either.
So now I’ll tell you something about a couple of third-party utilities that I do use.
XMenu is a ridiculously simple freeware utility from DEVONtechnologies. You create a folder in your user Library, at the pathname Application Support/XMenu/Custom. Into that folder, you put aliases of frequently used folders. That’s all. There is now a special icon in your menu bar; when you click it, it displays those folders as hierarchical menu items.
The idea is to populate the Custom folder with aliases of areas of your hard disk to which you frequently need access. Instead of going there in the Finder, you pop open the XMenu menu and navigate hierarchically to the menu item that represents the folder where you want to be, and click that. I frequently use this to reach a particular folder and get it open as a window in the Finder.
As I said, this is ridiculously simple. But it is also extremely useful, and I use it all the time. I don’t want to navigate my whole hard drive hierarchically — I just want easy to access to a few select folders where I most frequently work. Xmenu lets me do that.
LaunchBar is a powerful utility that’s so important to me, so fundamental to my thinking and habits, that I am literally unable to work on a computer that lacks it.
LaunchBar has a number of aspects, but at heart it is basically a utility for opening something by its name — or, more accurately, by typing an abbreviation of its name. It has various other useful abilities, moreover, which are in some cases quite unrelated to the notion of opening things.
LaunchBar sits in the background, unseen and undetected, until you press a special keyboard shortcut. (On my computer, I’ve configured that shortcut to be Control-Space.) LaunchBar thereupon springs into action in a little heads-up-display window that appears in front of everything else on the screen.
Here are some of LaunchBar’s features that I use the most:
Open an application by abbreviation. This is the heart of LaunchBar. Thanks to LaunchBar, I don’t need to know where any application is installed. I don’t need to locate any application in the Finder. LaunchBar already knows what applications I have and where they are. If I just know an application’s name, I can go to it, kaboom.
To open Safari, for example, I press the key combination that summons LaunchBar (Control-Space on my machine, as I’ve said), then type S, and then hit Return.
This feature is good both for launching applications and for switching to an already open application. So goodbye, Command-Tab app switcher! In fact, LaunchBar has its own built-in app switcher: summon LaunchBar (Control-Space on my machine) and then hit Command-R (think “running”) to see a list of running applications. Navigate the list with arrow keys or by typing some letters from an application’s name.
Open a recent document. It turns out that when you do what I described in the previous paragraph, so that LaunchBar is now displaying the name of an application, LaunchBar knows a lot of great stuff about that application. One of the things it knows, in many cases, is what documents that application has recently opened. You use the Right arrow key to see those.
For example, Control-Space followed by X means Xcode on my machine. If I then hit Return, I switch to Xcode (as I described a moment ago for Safari). But if, instead, I hit the Right arrow key, I’m now looking at a list of recently opened Xcode projects. I can open one in Xcode by navigating to that project with the keyboard — or by typing part of its name — and then hitting Return. This is one of my absolute favorite LaunchBar features.
What’s more, different applications have different ideas of what constitutes a recent document. For instance, for the Finder, Right arrow presents a list of recently opened folders! These are ordered by date of usage (most recent first), which is much more useful than the alphabetical ordering that the Finder itself might give you. And when you navigate into a folder by way of LaunchBar, you can see its contents alphabetically or by sorted by modified date.
Moreover (still rattling on about the Finder) you can do other things with a folder besides open it. For example, if you hold Option as you hit Right arrow, you are shown information about this folder, including its path. If you select that and hit Right arrow, you are shown the folder’s absolute path and its file URL, and you can select one of them and hit Command-C to copy it — which is something that I need to do surprisingly often.
Safari has yet another idea of what constitutes a recent document. Control-Space followed by S means Safari on my machine; hitting Right arrow then shows me (wait for it…) all tabs currently open in any window in Safari! In other words, LaunchBar solves the tab management issue I was complaining about earlier. I can choose a tab with arrow keys or by typing some of its name. In addition, if Safari History is turned on in LaunchBar’s preferences, then Right arrow gives me a choice between proceeding to Safari’s open tabs, on the one hand, or to its recently opened web addresses, on the other.
Open a document with an application. If I’m working in the Finder, if I’ve selected a file, I can press a special LaunchBar key combination to “send” the Finder selection to LaunchBar for further processing. (On my machine, that key combination is to tap the Fn key twice.) What further processing might we be talking about? Well, if I now type the abbreviation for an application and hit return, LaunchBar tells that application to open that selection.
For instance, suppose I’ve selected a YAML file in the Finder. This is just text, so what application should open it? Let’s say I want to open it with TextMate. I press the Fn key twice, then type TM, and hit Return, and sure enough, TextMate opens that file (launching if necessary). Alternatively, if I hit the Tab key instead of typing a particular application’s abbreviation, I see a list of applications that can open this sort of document, and now I can choose which of those I want to use to open it.
Once again, certain things get special treatment. In particular, folders are treated specially for certain applications. How many times have you found yourself looking at a folder in the Finder and wanting to open a Terminal window and
cdinto that folder? If you’ve selected the folder in the Finder, then you can do that with LaunchBar: on my machine I would hit the Fn key twice, then type T, and hit Return.
Clipboard history. I may have buried the lede accidentally here, because this just might be the most important thing LaunchBar does for me. Every time I copy or cut something, in any application, LaunchBar remembers it, automatically! A keyboard shortcut, Command-Backslash on my machine, then summons a list of these remembered clipboard contents, and selecting one pastes it wherever I’m working.
Because of this feature, I am able to say Copy, Copy, Copy; then switch contexts; then say Paste, Paste, Paste. That’s so much better than Copy-switch, Paste-switch, Copy-switch, Paste-switch…! Also, who hasn’t accidentally lost valuable clipboard contents by doing another Copy on top of something that was copied earlier? With LaunchBar, that loss can’t happen.
That list barely scratches the surface of what LaunchBar can do, but it does give a good overview of what it does for me in my everyday life. It has other abilities too numerous to mention, many of which I probably don’t even know about. (The lack of a decent up-to-date user manual is a constant irritant.) The point is that it’s a crucial tool in my never-ending battle to move the computer interface out of my way and get actual work done.
In all probability, you can never have enough monitors, and the monitors you have will never be large enough. But I’ve gotten surprisingly nimble at using a lot of development tools all at once and keeping a lot of windows open simultaneously, despite having a very small screen. That’s because I’ve got a combination of techniques and utilities that have given me some crucially needed organization.
Thanks to keyboard shortcuts, I can leap around through the working environment. Thanks to desktop spaces, including fullscreen windows, I can make the most of my screen real estate. Thanks to utilities like XMenu and LaunchBar, I can bypass tedious tasks. None of these is perfect; the built-in system management of windows, tabs, and desktop spaces is somewhere between poor and appalling. But together, they make a fairly satisfactory toolset.
I’ve described my experience in personal terms because everyone is different. If you find yourself working on a screen that’s too small, you’ll come up with your own techniques for coping. Don’t copy me; find your own path! Nevertheless, the directions and areas of thought that I’ve outlined in this article should give you some idea of the options that are open to you.