Last active
November 5, 2019 08:17
-
-
Save sergeylukin/202be0a38d7690feb973841520ebee78 to your computer and use it in GitHub Desktop.
Hammerspoon Hyper key configuration
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
--Reload config | |
local hyper = { "cmd", "alt", "ctrl", "shift" } | |
hs.hotkey.bind(hyper, "0", function() | |
hs.reload() | |
hs.notify.new({title="Hammerspoon", informativeText="Config loaded"}):send() | |
end) | |
--Resize windiows | |
hs.window.animationDuration = 0 | |
hs.hotkey.bind(hyper, "h", function() | |
local win = hs.window.focusedWindow(); | |
if not win then return end | |
win:moveToUnit(hs.layout.left50) | |
end) | |
hs.hotkey.bind(hyper, "j", function() | |
local win = hs.window.focusedWindow(); | |
if not win then return end | |
win:moveToUnit(hs.layout.maximized) | |
end) | |
hs.hotkey.bind(hyper, "k", function() | |
local win = hs.window.focusedWindow(); | |
if not win then return end | |
win:moveToScreen(win:screen():next()) | |
end) | |
hs.hotkey.bind(hyper, "l", function() | |
local win = hs.window.focusedWindow(); | |
if not win then return end | |
win:moveToUnit(hs.layout.right50) | |
end) | |
--Hyper + a/s/d/f for quick App switch | |
local applicationHotkeys = { | |
a = 'Brave Browser', | |
s = 'Google Chrome', | |
d = 'iTerm', | |
f = 'Finder', | |
e = 'Sublime Text' | |
} | |
for key, app in pairs(applicationHotkeys) do | |
hs.hotkey.bind(hyper, key, function() | |
hs.application.launchOrFocus(app) | |
end) | |
end | |
--Lock screen | |
hs.hotkey.bind(hyper, "q", function() | |
hs.caffeinate.lockScreen() | |
end) | |
--Fullscreen | |
hs.hotkey.bind(hyper, "return", function() | |
local win = hs.window.frontmostWindow() | |
win:setFullscreen(not win:isFullscreen()) | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment