Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .hammerspoon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,22 @@ local apps = {
-- not via a hotkey).
local lastApp = nil
local previousAppByKey = {}
local startupModifiers = { "ctrl", "alt", "cmd", "shift" }

local function releaseStartupModifiers()
local modifiers = hs.eventtap.checkKeyboardModifiers()

for _, modifier in ipairs(startupModifiers) do
if modifiers[modifier] then
hs.eventtap.event.newKeyEvent({}, modifier, false):post()
end
end
end

local function bindAppLauncher(key, app)
hs.hotkey.bind(hyper, key, function()
releaseStartupModifiers()

local frontmost = hs.application.frontmostApplication()

if frontmost and frontmost:bundleID() == app.bundleID then
Expand Down Expand Up @@ -57,4 +70,4 @@ end
-- Special actions
hs.hotkey.bind(hyper, "\\", hs.reload)

hs.alert.show("Hammerspoon config loaded")
hs.alert.show("Hammerspoon config loaded")