Skip to content

Commit

Permalink
Add support for mapping a Hyper binding to a custom function
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrudolph committed Apr 20, 2018
1 parent b71f3ff commit 3601e5e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions hammerspoon/hyper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ if not status then
end

for i, mapping in ipairs(hyperModeAppMappings) do
hs.hotkey.bind({'shift', 'ctrl', 'alt', 'cmd'}, mapping[1], function()
hs.application.launchOrFocus(mapping[2])
local key = mapping[1]
local app = mapping[2]
hs.hotkey.bind({'shift', 'ctrl', 'alt', 'cmd'}, key, function()
if (type(app) == 'string') then
hs.application.open(app)
elseif (type(app) == 'function') then
app()
else
hs.logger.new('hyper'):e('Invalid mapping for Hyper +', key)
end
end)
end

0 comments on commit 3601e5e

Please sign in to comment.