Created
February 3, 2021 05:21
-
-
Save jialeicui/a3e876375a75ffb169378b5c804abdf1 to your computer and use it in GitHub Desktop.
hammerspoon.lua
This file contains hidden or 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
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