Writing

Feed Software, technology, sysadmin war stories, and more.

Tuesday, August 13, 2013

Quantifying your ideal dev environment is surprisingly hard

You know that saying "you don't know what you've got until it's gone"? Well, it's starting to make sense. I could never quantify my usual development environment until I started trying to function without it. It just felt "off", but I couldn't make a list of things which bothered me. I never kept using it for long enough to figure it out.

Now, I've been using a Mac as the sole driver of the screen(s) in front of me for the past couple of weeks, and it's been interesting. There are some bits I was able to get back, but sometimes the utilities I added to help make things more adjustable wind up causing their own problems.

All of this is getting me to get a handle on what it is I actually "miss" when I'm using some foreign dev environment. Some of these things can be duplicated on new systems, but others are just too hard to get working.

Here's what I've been able to determine so far.

I like having enough space to see at least four terminals without overlap. This has actually grown over the years, since I used to run X at 1024x768 on a 17" CRT and my aterms (as in Afterstep) used to overlap. One was buried in the NW corner of my screen and the other was in the SE, and they'd overlap a small square in the center. I could handle that. Over the years, things slowly improved to where I could have several terminals running with no overlap.

This is because I usually have one (on top) for editing code and one (on the bottom) for compiling and running that code, with a third for auxiliary stuff. That is, up top, I might be editing foo.cc, and on the bottom might be doing my "bb lib/foo && bin/lib/foo" calls, while on the third terminal I have "less" running with some header file for a library I'll be calling.

Usually, if I have more open, they tend to get paired up the same way: editor on top, running code on the bottom. If there's client/server stuff going on, then that's at least four (dev, dev, run, run), plus others as needed.

The Mac has no problem with this. I have a nice big screen with a crisp resolution and I can fit tons of terminals on it. That part is fine.

What bugs me, however, is that I can't partition them nicely. The terminal windows apparently all have to be on one "space" or another (or whatever they call it this year).

I tend to use another workspace for "heads down hack mode" stuff. In Fluxbox, that's just an ALT-F2, F3, ... away. My main screen (via ALT-F1) has a bunch of log tails running so it's not good when avoiding distractions is desirable. On the Mac, I'd be trying to escape my IM client, IRC client, web browser, mailer, and more.

On the Mac, I have those spaces, but they come at a terrible price. The entire screen slides off and slides back on when you switch between them. You can't just flip, flip, flip. The actual keys you use to select them don't really feel right, either: like you can go left and right, but not direct to a particular screen.

I may simply have not found the right key combos yet, but that "let's slide everything around" stuff really stinks. I don't know how to turn it off. If you ever have your Mac laptop connected to an external monitor, this actually gets worse, since it slides the whole mess.

I like ALT-TAB to cycle between windows. I also like it to stick to the things which I have on screen. This way, I can have a workspace with four terminals running, and I won't ever get pulled away from them. If I want to go to another terminal in another workspace, I can just ALT-Fx to that workspace first. Easy.

On the Mac, every program is always eligible for ALT-TAB targets, so I have to be careful about what the next one in order may be. Lots of stuff will wind up flopping back up in my face right after I deliberately hid it if I don't hit TAB enough times before letting go of ALT.

Despite all this, you can't flip between terminals that way on the Mac. They are all windows which are part of the single program, so you have to CTRL-TAB between them. It's a small adjustment, sure, but it's bothersome. I thought I'd like the whole CMD-1, CMD-2, ... thing to pick terminals, but it turns out to introduce other problems.

I really like my #1 to be the window nearest the top, my #2 to be below that, and so on. The problem is that those numbers are determined by the order in which you've opened them, or re-opened them if you closed some in the series. Sometimes, I'll start doing something, and the thing I'm doing will "belong" in a certain place on the screen. Maybe I'm editing source. I want that near the top of the screen. Maybe I'm compiling. I want that near the bottom.

However, if that "editing source" window is not #1, then it's going to be in the wrong place in the window order, and I'm going to do CMD-1 and get the wrong window. ALT-TAB doesn't care which one is which, since it's entirely based on which ones I've been to recently, and it's fast enough to just keep going until I get the right one. Remember, there are only a couple on any given workspace. The others aren't up for selection.

Then there are my hotkeys. I have the infernal Windows "Menu" key bound to a short script which will kick off a terminal. I used to just run rxvt directly, but since switching to urxvt found myself needing to force things which really called for a script.

For anyone who really wants to run terminals like me for some reason, this is the script:

#!/bin/sh

export LC_CTYPE=en_US.UTF-8

export TERM=xterm

if (test "$#" == "0")

then

urxvt -fn 7x14 -geometry 80x25 -fn 7x14 +sb -bg black -fg green -tn $TERM &

else

urxvt -fn 7x14 -geometry 80x25 -fn 7x14 +sb -bg black -fg green -tn $TERM -e $* &

fi

(No, you are not expected to understand or like my font or color choices.)

The point is that I can pick a space (ALT-Fx) and then just smack Menu a few times and will receive a bunch of terminals which are ready to go. That brings me to two more things: window positioning and size.

I can hold down ALT and use a left-button-drag to position a window. I don't have to grab it on the title bar or anywhere else in particular. If I can grab it, I can move it. Likewise, ALT with a right-button-drag will let me resize any window I can grab.

So, when I'm ready to do something new, I usually go ALT-F2, then Menu a couple of times, reach for my mouse and slide them around into whatever configuration fits what I'm about to do, then I let go of the mouse and use the keyboard from then on out. I actually push the mouse out of the way much of the time, since it's pointless when writing programs this way.

I've talked about my "F9" maximize keys somewhere else in the past, so I'll be brief this time. In short, I can maximize a window vertically, horizontally, or both, or restore it back down using F9 with or without various modifier keys.

If you want to do this too, here it is:

None F9 :MaximizeWindow
Mod1 F9 :MaximizeVertical
Shift F9 :MaximizeHorizontal

F9 is one of those keys which are hard to miss because there's a big gap between it and F8. It also means I can come at it from below and not hit anything else on the way.

When you're trying to go quickly, this sort of thing matters.

There are programs like BetterTouchTool and Zooom2 and iTerm which attempt to provide some of this behavior on the Mac. I have not found a combination which has managed to duplicate all of the above yet. One of them has actually introduced a failure mode where Terminal.app will stop accepting input until I click on the title bar (!) at which point it will act like I pasted in three or four full lines of garbage (!!). The results of this in my shell or editor are anything but pretty.

I'm pretty sure that a $300 E-machines laptop would make a great terminal-running machine. I'd give it a real external keyboard, a wireless mouse, and a nice big screen, but the machine itself doesn't need to be much. Running X and a bunch of xterms just isn't asking that much of a machine any more.

I'm also pretty sure it would never give me stupid beachballs and unexplainable lag when all I wanted to do is open a terminal and start typing. If it did lag, it would be because I asked it to do something big right then and there, and it would make sense.

I tried. I really did. I think it's time to give up and move on to a known-good situation.