[hammerspoon] Don't un-fullscreen Safari on <esc>

pull/28/head
Alpha Chen 9 years ago
parent 1f1ed4cc11
commit 3fa8a87cd4

@ -3,6 +3,14 @@ local mash = {"cmd", "alt", "ctrl", "shift"}
-- Application shortcuts -- Application shortcuts
hs.hotkey.bind({}, "escape", function()
if current_app():name() == "Safari" then
hs.eventtap.keyStroke({"alt"}, "escape")
else
hs.eventtap.keyStroke({}, "escape")
end
end)
-- hs.hotkey.bind({"cmd", "shift"}, "[", function() -- hs.hotkey.bind({"cmd", "shift"}, "[", function()
-- current_app():selectMenuItem({"Window", "Select Previous Tab"}) -- current_app():selectMenuItem({"Window", "Select Previous Tab"})
-- end) -- end)
@ -13,31 +21,31 @@ local mash = {"cmd", "alt", "ctrl", "shift"}
-- Window management -- Window management
hs.hotkey.bind(mash, "h", function() -- hs.hotkey.bind(mash, "h", function()
local win = hs.window.focusedWindow() -- local win = hs.window.focusedWindow()
local f = win:frame() -- local f = win:frame()
local screen = win:screen() -- local screen = win:screen()
local max = screen:frame() -- local max = screen:frame()
f.x = max.x -- f.x = max.x
f.y = max.y -- f.y = max.y
f.w = max.w / 2 -- f.w = max.w / 2
f.h = max.h -- f.h = max.h
win:setFrame(f) -- win:setFrame(f)
end) -- end)
hs.hotkey.bind(mash, "l", function() -- hs.hotkey.bind(mash, "l", function()
local win = hs.window.focusedWindow() -- local win = hs.window.focusedWindow()
local f = win:frame() -- local f = win:frame()
local screen = win:screen() -- local screen = win:screen()
local max = screen:frame() -- local max = screen:frame()
f.x = max.x + (max.w / 2) -- f.x = max.x + (max.w / 2)
f.y = max.y -- f.y = max.y
f.w = max.w / 2 -- f.w = max.w / 2
f.h = max.h -- f.h = max.h
win:setFrame(f) -- win:setFrame(f)
end) -- end)
function current_app() function current_app()
return hs.application.frontmostApplication() return hs.application.frontmostApplication()

Loading…
Cancel
Save