Skip to content

Instantly share code, notes, and snippets.

@rizumita
Created December 20, 2016 02:57
Show Gist options
  • Save rizumita/5b9333d4ff4a5fa11a930a466ef47248 to your computer and use it in GitHub Desktop.
Save rizumita/5b9333d4ff4a5fa11a930a466ef47248 to your computer and use it in GitHub Desktop.
Delayed Command+Q by Hammerspoon
local qStartTime = 0.0
local qDuration = 1.5
hs.hotkey.bind({"cmd"}, "Q", function()
qStartTime = hs.timer.secondsSinceEpoch()
end, function()
local qEndTime = hs.timer.secondsSinceEpoch()
local duration = qEndTime - qStartTime
if duration >= qDuration then hs.application.frontmostApplication():kill() end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment