Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
-- 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
You can’t perform that action at this time.