Created
June 22, 2016 03:26
-
-
Save noroot/eb96563a588efeb9e3c0c430b918d89f to your computer and use it in GitHub Desktop.
Mjonir configuration
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
local application = require "mjolnir.application" | |
local hotkey = require "mjolnir.hotkey" | |
local window = require "mjolnir.window" | |
local fnutils = require "mjolnir.fnutils" | |
local hints = require "mjolnir.th.hints" | |
local appfinder = require "mjolnir.cmsj.appfinder" | |
local tiling = require "mjolnir.tiling" | |
-- hotkey.bind({"cmd", "alt", "ctrl"}, "D", function() | |
-- local win = window.focusedwindow() | |
-- local f = win:frame() | |
-- f.x = f.x + 10 | |
-- win:setframe(f) | |
-- end) | |
local grid = require "mjolnir.sd.grid" | |
local hotkey = require "mjolnir.hotkey" | |
grid.MARGINX = 0 | |
grid.MARGINY = 0 | |
grid.GRIDWIDTH = 2 | |
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 mash = {"ctrl", "shift"} | |
hotkey.bind(mash, 'n', grid.pushwindow_nextscreen) | |
hotkey.bind(mash, 'a', gridset(0, 0, 1, 2)) -- left half | |
hotkey.bind(mash, 's', grid.maximize_window) | |
hotkey.bind(mash, 'd', gridset(1, 0, 1, 2)) -- right half | |
hotkey.bind({"cmd"},"e",hints.windowHints) | |
-- You can also use this with appfinder to switch to windows of a specific app | |
hotkey.bind({"ctrl","cmd"},"k",function() hints.appHints(appfinder.app_from_name("Emacs")) end) | |
hotkey.bind(mash, "c", function() tiling.cyclelayout() end) | |
hotkey.bind(mash, "j", function() tiling.cycle(1) end) | |
hotkey.bind(mash, "k", function() tiling.cycle(-1) end) | |
hotkey.bind(mash, "space", function() tiling.promote() end) | |
-- If you want to set the layouts that are enabled | |
tiling.set('layouts', { | |
'fullscreen', 'main-vertical' | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment