-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsizeUp.lua
49 lines (41 loc) · 1 KB
/
sizeUp.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
local hotkey = require "mjolnir.hotkey"
local grid = require "mjolnir.bg.grid"
local sizeUp = {}
local function snapWindow(direction)
grid.GRIDHEIGHT = 2
grid.GRIDWIDTH = 2
if direction == "left" or direction == "right" then
grid.resizewindow_thinner()
if direction == "left" then
grid.pushwindow_left()
elseif direction == "right" then
grid.pushwindow_right()
end
grid.pushwindow_up()
grid.resizewindow_taller()
elseif direction == "up" or direction == "down" then
grid.resizewindow_shorter()
if direction == "up" then
grid.pushwindow_up()
elseif direction == "down" then
grid.pushwindow_down()
end
grid.pushwindow_left()
grid.resizewindow_wider()
end
end
function sizeUp.init(modifier)
hotkey.bind(modifier, "left", function()
snapWindow("left")
end)
hotkey.bind(modifier, "right", function()
snapWindow("right")
end)
hotkey.bind(modifier, "up", function()
snapWindow("up")
end)
hotkey.bind(modifier, "down", function()
snapWindow("down")
end)
end
return sizeUp