[hammerspoon] Don't close Safari windows w/cmd+w

pull/28/head
Alpha Chen 9 years ago
parent 99cd81f76b
commit 769398a7d2

@ -13,11 +13,19 @@ local safari_esc = hs.hotkey.new({}, "escape", function() end, function()
end end
end) end)
local safari_esc = hs.hotkey.new({"cmd"}, "w", function() end, function()
if current_app():name() == "Safari" then
current_app():selectMenuItem({"File", "Close Tab"})
end
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()
end):subscribe(wf.windowUnfocused, function() end):subscribe(wf.windowUnfocused, function()
safari_esc:disable() safari_esc:disable()
safari_close_tab:disable()
end) end)
-- hs.hotkey.bind({"cmd", "shift"}, "[", function() -- hs.hotkey.bind({"cmd", "shift"}, "[", function()

Loading…
Cancel
Save