TextMate News

Anything vaguely related to TextMate and macOS.

Controlling inactive windows

Here’s a tip about another neat OS X feature that I’ve really grown to like, and a plead to other developers (like those working on Carbon/iTunes/Finder at Apple) to support it fully. It’s about dealing with unfocused windows.

The case that most people probably know is closing an unfocused window by clicking its close button. By closing a window, the application to which the window belongs, is not made active. This is good because we’re removing clutter, and after having removed it, there’s no logical choice for a new candidate to receive focus (so let’s not take away focus from what the user did).

In TextMate I replicated this behavior for tabs, as can be seen below. The case where the application is inactive is probably rare, but it works very well for when the window is just not the active one. Something I really wish OmniWeb had, for when links open in new windows, and I want to close the tab in the (now) inactive source window (yes, I did file a request).

Besides closing windows (which doesn’t have focus) it turns out that you can move them around, make selections, use all their controls, a.s.o.

The trick is to hold down the ⌘ modifier key while using the mouse.

I use it a lot when I have a window behind my active window, which has data I need to read, but is only partially visible. Holding down ⌘ while using the normal window movement gesture (click and hold the button on the title bar) allows you to drag around the window, without bringing it to front, or activate it.

Be aware though that holding down ⌘ and clicking the proxy icon (in the title bar) will show a menu with the parent folders of the document for which the icon is a proxy (another nice Mac OS feature).

proxy menu

As for using the controls in an inactive window, there are at least two scenarios where I find this useful.

  1. When working in the active window, but needing to view data in the inactive window, I have shown an example of this above, where I move, size and scroll in TextMate’s HTML preview while the main window is kept active, so it doesn’t mess up the window ordering.
  2. When a dialog with Okay/Cancel or similar is not active, clicking either choice will close it, so since I’m not interested in having its application become active and brought to front, I use ⌘ with the click.

categories General OS X Tips

16 Comments

Definitely adding this to my bag of time saving tricks!

Wow.. those command-tricks are pretty neat :) OS X never ceases to amaze me :)

Very neat trick. Keep up the great work with TextMate – it’s the best editor I have ever used.

Sorry this comment is out of place, but the relevant page, regarding “Self updating build”, won’t let me post. I guess it’s because I’m so late reading it, it thinks I’m a forum-trawling spammer. shrug I’m hoping this post lets me comment, and it’s not something about my host/ip/browser/cookies/etc.

Anyway… In regards to “Self updating build”…

I love this feature… EXCEPT that I’m a pack-rat who loves to keep all the builds that I download.

This doesn’t keep the archive around. Could you add a “Reveal” button for use after the download is complete, so that I can copy the file into my “Archived Downloads” folder before the install process deletes the tbz file? – PLEASE! :-)

In fact, a proxy icon of the file would be even better in my opinion, because (at least in my case) then we could just simply drag (default action should be copy though, not move even on same filesystem or you break the update system when the original tbz goes missing) the file into the folder where we keep such things. =)

Thanks!

-jab

James: proxy icon sounds like a good idea, I’ve added that. The default action is determinted by the receiving application, which for Finder is “create an alias”, but you can override that by holding down a modifier key, so should be fine.

As for the spam prevention, that’s strange.

What I do is let JS calculate a value based on your IP, so it fails if you POST from a cached page, but the failure page should log it, and re-calculate the value (which should be correct since the failure page is the result of a POST, so shouldn’t be cached).

I don’t see any entry in my log for a rejected comment posted within the last 24 hours. Though I won’t rule out that my system isn’t perfect :)

25 October 2005

by Greg Humphreys

Nice tip, I didn’t know about dragging around windows in the back. Holding down the command key while clicking in the titlebar of Safari is also incredibly useful!

-Greg

26 October 2005

by Anonymous

I’m loving the new status bar stuff in 611 and 632! A couple of thoughts:

The “Bundle stuff” pop-up – the release notes say “For lack of a better name.” Would it be appropriate to name this “Automation”, for consistency with the menu from which it gets its items? Maybe shorten to “Auto” or something?

Eventually it would be nice to be able to have preferences for what appears in the status bar. I don’t change my tab size very often, for example, so I don’t really need it there. I can see more things being added to the status bar over time (every build I keep looking for the infamous function popup :-) ) and with my windows usually set to around 80 characters wide, there isn’t much more room down there.

Thanks so much for your work, Allan!

Anonymous: next build has the menu show just as a gear icon and next to the language popup.

Tab size I want to have in the status bar because this will be (implicitly) per language, so it’s important to have it visible, e.g. I have 2 spaces for indent with Ruby, 4 spaces for plists, tabs with a size of 3 for my other sources etc.

For a function popup, have a look at this plugin.

Even though I already knew these tricks, it’s nice to see them mentioned - and implemented!

In the post you note that command+dragging the proxy icon or title will pop down the path menu, but I also think you should mention that should one need to drag the proxy icon in the background one can just drag it without modifier keys. (However, some apps, like QuickTime Player, will bring the window to the front.)

03 November 2005

by Jay Soffian

TM is getting better and better. Question regarding soft-wrap. Would it be possible to have soft-wrapped lines respect the indentation of the previous line?

So that a really long line like this
wraps like this instead of
like this.

Also, aren’t folded blocks of code supposed to retain the folding across closing/opening the file? They don’t seem to be for me, at least with Python code.

j.

03 November 2005

by Jay Soffian

Hmm, my leading spaces got eaten. Let’s try again using “.” for space.

….long lines of code should
….wrap like this

….instead of
like this.

Thanks.

j.

Note that command-dragging of background windows has been around since Mac OS 8. Maybe even 7.5.5 (Oooh, I’m dating myself with that one) (No, not that kind of date)

Having certain controls react without activating the window is nice.

Using the command key to drag background windows w/o bringing them forward has been around since at least System 7 .. possibly earlier. (It has been too long since I used System 6 for me to remember..) .. it works in both Carbon and Cocoa applications.

I love the Cocoa feature which allows you to command-click on other controls to use them w/o bringing the window forward. I find it useful to scroll windows in the background, for example. It always bugs me when Carbon programs (I’m looking at you, Finder) don’t allow this.

One thing to watch out for is bugs… prior to Tiger, command-clicking in a toolbar icon in a non-frontmost window would cause the action to occur in the application’s frontmost window, not the window you clicked in. (bad for things like “delete”) .. also, recent versions of Safari have a bug where command-clicking the back/forward buttons in a background window can create tabs in the frontmost window.

I love this feature and use it a lot. I just wish it would also work with the mouse’s scroll wheel. i.e. Cmd-scroll over a background window would cause it to scroll up and down (and left and right with the mighty mouse.)

How about forcing windows to stay inactive? Some actions in TextMate, like for example running tests in ruby – creates a new window of textmate – and steals focus! But I dont want to make it steal my focus, I just want to “see” the window update, without switching back and forth to the editor.

Any way to do that?

Evgeny: Not presently, but there is a good chance options along these lines will appear in the future.