Hacker News new | ask | show | jobs
by 0rca 1265 days ago
For MacOS there is Hammerspoon, that provides immensely powerful scripting, but can merely open and close the apps, too.

  -- ~/.hammerspoon/init.lua
  function define_shortcut(appName, key, mod)
    hs.hotkey.bind(mod, key, function()
      hs.application.enableSpotlightForNameSearches(true)
      local app = hs.application.find(appName)
      if app and app:isFrontmost() then
        app:hide()
      else
        hs.application.open(appName)
      end
    end)
  end

  define_shortcut("Alacritty", "F1", {})
  define_shortcut("Firefox", "F2", {})