Update 20250924: As of the release of macOS Tahoe, you can also use the new “Shortcuts” app to achieve this! These shortcuts can’t be assigned to keyboard shortcuts yet, but you can run them via Spotlight.
Using the power of OSX Automator!
Automator offers many handy actions in OSX. After creating an “automation” in Automator, you can save it as a “Quick Action” and assign a keyboard shortcut to it in System Preferences.
Documentation: https://support.apple.com/en-au/guide/automator/welcome/mac
If you like, you can click “Run” in the top-right corner to test the action.
Open System Preferences
> Keyboard
> Shortcuts
> Services
> General
and assign a keyboard shortcut to the Quick Action.
Done! Enjoy your new shortcut 🤓🙈
After creating the logic, close the window to save your shortcut. You’ll then be able to rename it.
Despite the name, it doesn’t seem like it’s currently possible to assign a keyboard shortcut to a shortcut created in the Shortcuts app.
Instead, you can run it via Spotlight (Cmd + Space) by typing the name of the shortcut. This can be made easier by “adding quick keys” to the Spotlight search, in this example I’ve chosen the letter "t"