misc:tools:hammerspoon

HammerSpoon

HammerSpoon is a handy automation app for Mac

Once you have downloaded you should then see the hammer icon in your taskbar

  • Right click on the hammer and go to preferences
  • You will first need to enable accessibility option for hammerspoon in your Mac before you can use it (you will probably need to restart hammerspoon after this to see the pref enabled)

  • Next right the hammer and choose Open Config. This is where you add any of your automation commands. It uses a programming language called Lua. Some possible commands are listed below
  • Once you have added your commands and saved the config file you will need to right click on the hammer icon and choose reload config, for those commands to be loaded

Type out contents of ClipBoard

Simulates typing of text saved in your clipboard. This is particularly useful when using Teamviewer where Windows login screens will not let you use standard paste functionality for entering passwords

This code use ALT + SHIFT + V to execute the automation (but you can change the key combination used):

hs.hotkey.bind({"alt", "shift"}, "V", function() hs.eventtap.keyStrokes(hs.pasteboard.getContents()) end)

Open specific url in Chrome tab

Open a Chrome tab to a specific webpage using a key command (ALT + SHIFT + J) - in this case the TMF Jobsheets Web-app

hs.hotkey.bind({"alt", "shift"}, "J", function() hs.urlevent.openURLWithBundle('https://accounts.msupply.org:6710/#/daily-jobsheets-add', 'com.google.Chrome') end)

Launch Hammerspoon at login preference does not stay enabled

1) Go to System Settings > General > Login Items > Select Hammerspoon.app from Open at login list > Click minus button (-)
2) Inside Hammerspoon.app click Launch at login again and it should persist.

  • misc/tools/hammerspoon.txt
  • Last modified: 2025/01/10 00:23
  • by Nick Pendergrast