Created
October 25, 2015 18:41
-
-
Save garriguv/49bd7e6fc048e0094346 to your computer and use it in GitHub Desktop.
Mjolnir 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
local hotkey = require "mjolnir.hotkey" | |
local window = require "mjolnir.window" | |
local screen = require "mjolnir.screen" | |
local modifier = {"cmd", "alt", "ctrl"} | |
-- left half | |
hotkey.bind(modifier, "left", function() | |
local win = window.focusedwindow() | |
local screenFrame = screen.mainscreen():frame() | |
local frame = win:frame() | |
frame.x = 0 | |
frame.y = 0 | |
frame.w = screenFrame.w / 2 | |
frame.h = screenFrame.h | |
win:setframe(frame) | |
end) | |
-- right half | |
hotkey.bind(modifier, "right", function() | |
local win = window.focusedwindow() | |
local screenFrame = screen.mainscreen():frame() | |
local frame = win:frame() | |
frame.x = screenFrame.w / 2 | |
frame.y = 0 | |
frame.w = screenFrame.w / 2 | |
frame.h = screenFrame.h | |
win:setframe(frame) | |
end) | |
-- center resize | |
hotkey.bind(modifier, "up", function() | |
local win = window.focusedwindow() | |
local screenFrame = screen.mainscreen():frame() | |
local frame = win:frame() | |
frame.w = screenFrame.w / 1.5 | |
frame.h = screenFrame.h / 1.5 | |
frame.x = screenFrame.w / 2 - frame.w / 2 | |
frame.y = screenFrame.h / 2 - frame.h / 2 | |
win:setframe(frame) | |
end) | |
-- center | |
hotkey.bind(modifier, "down", function() | |
local win = window.focusedwindow() | |
local screenFrame = screen.mainscreen():frame() | |
local frame = win:frame() | |
frame.x = screenFrame.w / 2 - frame.w / 2 | |
frame.y = screenFrame.h / 2 - frame.h / 2 | |
win:setframe(frame) | |
end) | |
-- full screen | |
hotkey.bind(modifier, "space", function() | |
local win = window.focusedwindow() | |
local screenFrame = screen.mainscreen():frame() | |
win:setframe(screenFrame) | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment