-
Notifications
You must be signed in to change notification settings - Fork 0
/
window.lua
43 lines (37 loc) · 871 Bytes
/
window.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
local prefix = require("prefix")
local utils = require("utils")
hs.window.animationDuration = 0
----------------
-- Grid
----------------
hs.grid.setGrid('4x4', nil, nil)
hs.grid.setMargins({0, 0})
prefix.bind('', 'g', function() hs.grid.show() end)
----------------
-- zoom
----------------
prefix.bind('', 'z', function()
local win = hs.window.focusedWindow()
if win and not undo[win:id()] then
undo:push()
-- fullscreen
win:move({0, 0, 1, 1})
else
undo:pop()
end
end)
-- undo for window operations
undo = {}
function undo:push()
local win = hs.window.focusedWindow()
if win and not undo[win:id()] then
self[win:id()] = win:frame()
end
end
function undo:pop()
local win = hs.window.focusedWindow()
if win and self[win:id()] then
win:setFrame(self[win:id()])
self[win:id()] = nil
end
end