Hammerspoon : Workspace automation

Hammer and spoon, Not the items we’ll be using together a lot but when it comes to automating things in macOS, Hammerspoon can do almost everything that we possibly want.

Hammerspoon

So what really is Hammerspoon? Well it’s an automation tool for macOS. Hammerspoon act as a bridge between the operating system and a Lua scripting engine. What can Hammerspoon do for you?

  • Talk to other applications
  • Add things to menu bar
  • Attach keybinding to specific functions
  • Display notifications
  • Move windows

Checkout documentation for more.

Being a software engineer, Productivity is much important factor. When I was looking to increase my productivity, I found Hammerspoon. For adding any new automation, all you need to do is write script in init.lua using available APIs and Reload Hammerspoon Configs. At First I tried to automate launch of an application(iTerm) with Key bindings.

After that I wanted to keep copy history and use previously copied text, so I added following to the script which will update copy history while copying content using cmd + 0.

After that to display copy history and use previously copied text, I added following to the script.

Use : Whenever you want to see copy history you need to press cmd + alt + E, It will create chooser window and you can copy the previously copied texts by going to particular index and press return.

These are the two automation I did with Hammerspoon, If you want to explore more, please visit Hammerspoon. Thank you !

Software Engineer at Gojek Tech.