Introduction

I'm a big advocate of using keyboard shortcuts in order to be more efficient. One shortcut that I use all the time on Mac is cmd+q to close the active application. The only problem is that I also us cmd+w a lot to to close the active tab in the current browser, text editor, finder window, etc. And since w and q are right next to each other on most keyboards, I would hoften end up closing entire applications when all I wanted to do was close the current tab.

To remedy this I added a bit of functionality to my Mac that requires double clicking cmd+q in order to close an application.

Required Application

To get started I downloaded Hammerspoon. Hammerspoon is an automation tool for macOS that uses the Lua scripting engine.

Once Hammerspoon is downloaded you need to add an init.lua file in ~/.hammerspoon.

bash

undefined

Add the script

Once Hammerspoon is downloaded all you need to do is add this script to the init.lua file and you're good to go.

lua

undefined