Skip to content

Instantly share code, notes, and snippets.

@jialeicui
Last active February 3, 2021 05:21
Show Gist options
  • Save jialeicui/7f42a8b86a877187a7c1cfb377ac9abe to your computer and use it in GitHub Desktop.
Save jialeicui/7f42a8b86a877187a7c1cfb377ac9abe to your computer and use it in GitHub Desktop.
hammerspoon.lua
hs.hotkey.bind({"cmd", "alt", "shift"}, "M", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x
f.y = max.y
f.w = max.w
f.h = max.h
win:setFrame(f)
end)
function current_app_name()
local win = hs.window.focusedWindow()
return win ~= nil and win:application():name() or ""
end
function toggle_app(app)
if (current_app_name() == app) then
hs.application.find(app):hide()
else
hs.application.launchOrFocus(app)
end
end
hs.hotkey.bind({"cmd"}, 'u', function()
toggle_app("Terminal")
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment