Farfetched blog

View My GitHub Profile

Notes

09 Mar 2025

It’s a pain to do global keyboard shortcuts on mac; here’s how I set one up to create a new note in Simplenote.

  1. Use the preinstalled Automator program
  2. to create a new Application, and
  3. use the Run AppleScript action, and
  4. be inspired by my script to activate the Simplenote app, and select its “New” menu item from the “Note” menu:

     tell application "Simplenote"
         activate
    	    
         tell application "System Events"
             tell application process "Simplenote"
                 tell menu bar 1
                     tell menu bar item "Note"
                         tell menu "Note"
                             click menu item "New"
                         end tell
                     end tell
                 end tell
             end tell
         end tell
     end tell
    
  5. Install Karabiner, and make sure you restart your mac before you try to grant Input Monitoring permission to karabiner_grabber.
  6. In the Karabiner settings,
  7. create a Complex Modification, and
  8. be inspired by mapping my script above to command-J

     {
         "description": "New note",
         "manipulators": [
             {
                 "from": {
                     "key_code": "j",
                     "modifiers": {
                         "mandatory": ["command"],
                         "optional": ["any"]
                     }
                 },
                 "to": [{ "shell_command": "open -a 'New note'" }],
                 "type": "basic"
             }
         ]
     }
    

    See the Karabiner modifiers documentation.

RSS