Shonzilla, a pattern-seeking animal

Life is a game of patterns and chance, and those who play well will win.


Twitter

See also (via Entrecard)

programming coupons powered by RetailMeNot.com

Thu Apr 1

HOW TO: Prevent Mac apps to quit on you

Have you ever accidentally typed Command+Q (which is the standard Quit command on Mac OS X) instead of Command+W (standard for closing a window or a tab)?

I know I did… one time too many after which I googled for like 2 minutes and found how to fix this. Another 10 minutes later, here’s a digest with two concrete examples for all of you to peruse.

Mac software can store various settings in the so called Mac OS X user defaults system. Windows users may liken this to Windows Registry. It’s quite similar but somewhat easier to use. For example, you can access the defaults system from the command line using the full glory of command line tools which is exactly what I’m using here.

  1. Choose the application which quit shortcut you want to reconfigure (e.g. Chrome) and note down the text next to the quit shortcut (e.g. Quit Google Chrome
  2. Find the application’s domain in the defaults system by running this from the command line (with “-i” we’re ignoring case and finding this more quickly):
    defaults read | grep -i “chrome” 
  3. In the result to the command above look for the application’s domain which looks similar to internet domains only in reverse (e.g. com.google.Chrome)
  4. Now reconfigure the shortcut by using the application’s domain, the shortcut text and shortcut definition:
    defaults write com.google.Chrome NSUserKeyEquivalents ‘{ “Quit Google Chrome” = “@$Q”; }’
  5. Restart the application for the change to take effect.

In case you want to define a different shortcut, use the following special characters for using Command/⌘, Option, Shift and Control buttons:

@ - Command/⌘
~ - Option
$ - Shift
^ - Control

After running all the above 5 steps correctly, you should have changed the shortocut for quit operation from ⌘+Q to ⌘+Shift+Q. Changes you make in defaults system will also remain active after restarting your Mac.

Here’s the similar change I’ve made on my Mac to prevent Eclipse from accidentally quitting on me (by redefining the quit shortcut to Cmd+Control+Q):

defaults write org.eclipse.Eclipse NSUserKeyEquivalents “{ ‘Quit Eclipse’= ‘^@Q’; }”

To assign Quit Eclipse shortcut to Cmd+Shift+Q you would need to escape $ sign because of the way shell parses the command line (to access reference environment variables and command parameters):

defaults write org.eclipse.Eclipse NSUserKeyEquivalents “{ ‘Quit Eclipse’= ‘@\$Q’; }”

Other signs you do not need to escape.

Sun Nov 16

Use Google Chrome and Gmail for mailto: links

Here’s a useful tip for all of you internet power users…
Go through these questions first.
  1. Are you using GMail to send (most if not all of) your mails?
  2. Are you using Google Chrome under Windows as your default web browser?
  3. Would you link your GMail’s compose mail dialog to popup whenever you click an email link (those beginning with mailto: instead of http:)?

If you score yes three times, then this is for you.

Copy-paste the snippet below into your text editor, replace username with your Windows username and save it as anyfile.reg.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\mailto\shell\open\command]
@="\"C:\\Documents and Settings\\username\\Local Settings\\Application Data\\Google\\Chrome\\Application\\chrome.exe\" -app=https://mail.google.com/mail?extsrc=mailto&url=%1"

Google Chrome team was smart enough not to include version specific information in the file path to chrome.exe meaning this hack will work with any of your future versions of Chrome as well.

Fri Sep 5
Watch this comic explaining in detail features Google Chrome web browser.

Watch this comic explaining in detail features Google Chrome web browser.