Skip to content

Instantly share code, notes, and snippets.

@phoenixeliot
Created May 15, 2017 23:22
Show Gist options
  • Save phoenixeliot/f9e87c0913b8e8970b7797da3d7f2aec to your computer and use it in GitHub Desktop.
Save phoenixeliot/f9e87c0913b8e8970b7797da3d7f2aec to your computer and use it in GitHub Desktop.
Phoenix's Mjolnir configuration
local grid = require "mjolnir.sd.grid"
local hotkey = require "mjolnir.hotkey"
local window = require "mjolnir.window"
grid.MARGINX = 0
grid.MARGINY = 0
grid.GRIDWIDTH = 12
grid.GRIDHEIGHT = 2
-- a helper function that returns another function that resizes the current window
-- to a certain grid size.
local gridset = function(x, y, w, h)
return function()
cur_window = window.focusedwindow()
grid.set(
cur_window,
{x=x, y=y, w=w, h=h},
cur_window:screen()
)
end
end
local modifiers = {"ctrl", "shift"}
hotkey.bind(modifiers, 'z', grid.pushwindow_nextscreen)
hotkey.bind(modifiers, 's', gridset(0, 0, 5, 2)) -- left half
hotkey.bind(modifiers, 'h', grid.maximize_window)
hotkey.bind(modifiers, 't', gridset(5, 0, 7, 2)) -- right half
hotkey.bind(modifiers, 'd', gridset(0, 0, 5, 1)) -- top left
hotkey.bind(modifiers, 'r', gridset(0, 0, 12, 1))
hotkey.bind(modifiers, 'w', gridset(5, 0, 7, 1)) -- top right
hotkey.bind(modifiers, 'x', gridset(0, 1, 5, 1)) -- bottom left
hotkey.bind(modifiers, 'm', gridset(0, 1, 12, 1))
hotkey.bind(modifiers, 'c', gridset(5, 1, 7, 1)) -- bottom right
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment