From 769398a7d27ee80689aced405b48cb86dc62168d Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Mon, 25 Apr 2016 14:49:49 -0400 Subject: [PATCH] [hammerspoon] Don't close Safari windows w/cmd+w --- .hammerspoon/init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.hammerspoon/init.lua b/.hammerspoon/init.lua index 6638e7c..c556f9d 100644 --- a/.hammerspoon/init.lua +++ b/.hammerspoon/init.lua @@ -13,11 +13,19 @@ local safari_esc = hs.hotkey.new({}, "escape", function() end, function() 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 wf.new("Safari"):subscribe(wf.windowFocused, function() safari_esc:enable() + safari_close_tab:enable() end):subscribe(wf.windowUnfocused, function() safari_esc:disable() + safari_close_tab:disable() end) -- hs.hotkey.bind({"cmd", "shift"}, "[", function()