[hammerspoon] Sigh, escaping in fullscreen Safari

pull/28/head
Alpha Chen 9 years ago
parent 935ef48c33
commit 29371bb36b

@ -7,13 +7,13 @@ end
-- Application shortcuts -- Application shortcuts
local safari_esc = hs.hotkey.new({}, "escape", function() end, function() -- local safari_esc = hs.hotkey.new({}, "escape", function() end, function()
if current_app():name() == "Safari" then -- if current_app():name() == "Safari" then
hs.eventtap.keyStroke({"alt"}, "escape") -- hs.eventtap.keyStroke({"alt"}, "escape")
end -- end
end) -- end)
local safari_esc = hs.hotkey.new({"cmd"}, "w", function() end, function() local safari_close_tab = hs.hotkey.new({"cmd"}, "w", function() end, function()
if current_app():name() == "Safari" then if current_app():name() == "Safari" then
current_app():selectMenuItem({"File", "Close Tab"}) current_app():selectMenuItem({"File", "Close Tab"})
end end
@ -21,10 +21,10 @@ end)
local wf = hs.window.filter local wf = hs.window.filter
wf.new("Safari"):subscribe(wf.windowFocused, function() wf.new("Safari"):subscribe(wf.windowFocused, function()
safari_esc:enable() -- safari_esc:enable()
safari_close_tab:enable() safari_close_tab:enable()
end):subscribe(wf.windowUnfocused, function() end):subscribe(wf.windowUnfocused, function()
safari_esc:disable() -- safari_esc:disable()
safari_close_tab:disable() safari_close_tab:disable()
end) end)

Loading…
Cancel
Save