Created
March 29, 2020 08:13
-
-
Save steermomo/0b26cddfaa8c4183bc4c85ae4e94194e to your computer and use it in GitHub Desktop.
Hammerspoon config
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
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Y", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.x = f.x - 10 | |
f.y = f.y - 10 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "K", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.y = f.y - 10 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "U", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.x = f.x + 10 | |
f.y = f.y - 10 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "H", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.x = f.x - 10 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "L", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.x = f.x + 10 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "B", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.x = f.x - 10 | |
f.y = f.y + 10 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "J", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.y = f.y + 10 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "N", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
f.x = f.x + 10 | |
f.y = f.y + 10 | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "ctrl"}, "Left", 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 / 2 | |
f.h = max.h | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "ctrl"}, "Right", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:frame() | |
f.x = max.x + max.w / 2 | |
f.y = max.y | |
f.w = max.w / 2 | |
f.h = max.h | |
win:setFrame(f) | |
end) | |
hs.hotkey.bind({"cmd", "ctrl"}, "Up", 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) | |
itunes_state = 0 | |
hs.hotkey.bind({"cmd", "ctrl"}, "P", function() | |
state = hs.itunes.getPlaybackState() | |
if state == hs.itunes.state_playing then | |
hs.itunes.pause() | |
elseif state == hs.itunes.state_paused then | |
hs.itunes.play() | |
end | |
end) | |
hs.hotkey.bind({"cmd", "ctrl"}, "N", function() | |
if hs.itunes.isRunning() and hs.itunes.isPlaying() then | |
hs.itunes.next() | |
end | |
end) | |
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "R", function() | |
hs.reload() | |
end) | |
hs.alert.show("Config loaded") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment