Created
December 20, 2016 13:28
-
-
Save philsnow/c19506dec17597ab9e4bf02f8d23e603 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Modal bindings, have to resort to this because on mac there | |
-- isn't a reserved modifier key for interacting with the OS. | |
modal_keymap = hs.hotkey.modal.new("cmd", "escape") | |
modal_keymap:bind('', 'escape', nil, function() modal_keymap:exit() end) | |
-- Maximize toggling | |
local window_table = {} | |
function toggleFocusedWindowFullscreen() | |
local focused_window = hs.window.focusedWindow() | |
local old_frame = window_table[focused_window:id()] | |
if old_frame == nil then | |
window_table[focused_window:id()] = focused_window:frame() | |
focused_window:maximize() | |
else | |
window_table[focused_window:id()] = nil | |
focused_window:setFrame(old_frame) | |
end | |
end | |
modal_keymap:bind('', 'return', nil, function() | |
modal_keymap:exit() | |
toggleFocusedWindowFullscreen() | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment