QBlocker

QBlocker

A few months ago I switched from Chrome to Safari as my main browser. I enjoy using Safari to Chrome in almost every way but there was one feature of Chrome that I missed.

There's an option you can enable in Chrome that will force you to hold CMD + Q to quite the app. As some who uses CMD + W to quit windows or tabs frequently, I often found myself accidentally quitting Safari.

Solutions

There are of course a number of solutions to the problem.

  1. Stop being such a sausage-fingered idiot and learn the difference between the Q and W key.
  2. Re-map the CMD + Q shortcut to something else.
  3. Continue using Chrome.

None of these really appealed to me so I started working on an app that would intercept the CMD + Q shortcut and replicate Chrome's handy little feature for all Mac apps that use the standard quit shortcut.

Building QBlocker

It turns out it's surprisingly easy for anyone to build something like this — an app that intercepts global events. All OS X wants is for the use to turn on some accessibility settings and then an app can intercept any key stroke or mouse movement.

It would be extremely easy for anyone to build a key logger and send your keystrokes to some server in China. Why aren't Apple forcing these apps to be signed?

Once you've intercepted the key stroke it's up to you to decide what you want to do with it. You could simply pass it on to the next responder, transform it into another event (like TextExpander), or perform an action and pass nothing down the chain.

QBlocker counts the number of times you've held the key down and will own pass the event along to the application in use when that time has passed. Before that it notifies the user to hold the key combo to quit.

Download

I've put QBlocker up on its own website but it's also open source and available on Github where any contribution is welcome.

✌️