Shostack + Friends Blog Archive

 

Command-Q Getting Me Down

The Mac’s Terminal.app is way too easy to quit; it seems to absorb any command-Q typed near it, even if the menubar is showing you that you’re in another app. (This may be an interaction with the preference FocusFollowsMouse.) Anyway, having just lost a bunch of terminals with useful data in them, I went and found this MacOSXHints page, which gives me:


defaults write NSGlobalDomain NSUserKeyEquivalents '{"Quit Terminal" = "@$Q";}'
terminal-menu-framed.jpg

The post’s author, SAO, states that you need to do this from xterm, with terminal quit. That is incorrect (at least on 10.3.9). I ran that, quit and restarted terminal, and it worked great.

4 comments on "Command-Q Getting Me Down"

  • DM says:

    Yeah I had this problem as well. My solution was to remove SSH from the list of processes Terminal ignored when checking wether to close a window or not. Terminal->Window Settings->Processes.
    -DM

  • Adam says:

    I actually have ssh in the list. Because it doesn’t seem to have any effect, I think that it’s built around commands entered, which means that I’d need to cover all of my ssh aliases.

  • Adam: You have ssh in the list, and it’s being ignored. It’s a “close if only these processes are running” list. Remove it, and Terminal will ask you before closing that window.
    It works with aliases, too; I have plenty of ssh aliases, and when I just re-tested the behavior with one, I got: “Closing this window will terminate the following processes inside it: tcsh, ssh”

  • dr.kaos says:

    Another suggestion — I start screen automatically when I launch Terminal.app.

    There are several obvious benefits to this, not the least of which is that if for any reason I accidently exit terminal, I can open a new terminal and simply reconnect to my screen session (screen -r, or -x if screen doesn’t recognize the disconnect) without having lost anything happening in any of my four active terminals.

    I also use screen recursively (opening it on any remote servers, inside of my local screen session). This means even if my local machine explodes, or I somehow manage to let the smoke out of it, I can go to any other machine, ssh back to the appropriate server, and screen -r (or -x) to pick up right where I left of…

    Suffice it to say, screen is one of my favorite tools, and I wouldn’t leave home without it.

Comments are closed.