mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
Add patched copy of built-in grid extension
This commit is contained in:
22
hammerspoon/Makefile
Normal file
22
hammerspoon/Makefile
Normal file
@@ -0,0 +1,22 @@
|
||||
.SILENT:
|
||||
|
||||
ext/grid.lua:
|
||||
echo "fetching ext/grid.lua..." && \
|
||||
curl -s -L -o ext/grid.lua \
|
||||
https://raw.githubusercontent.com/Hammerspoon/hammerspoon/master/extensions/grid/init.lua && \
|
||||
make patch_ext/grid.lua
|
||||
|
||||
.PHONY: patch_ext/grid.lua
|
||||
patch_ext/grid.lua:
|
||||
echo "patching ext/grid.lua..." && \
|
||||
patch -p0 < ext/grid.patch
|
||||
|
||||
.PHONY: remove_ext/grid.lua
|
||||
remove_ext/grid.lua:
|
||||
( \
|
||||
test -f "ext/grid.lua" && rm "ext/grid.lua" && \
|
||||
echo "removed ext/grid.lua" \
|
||||
) || exit 0
|
||||
|
||||
.PHONY: update_ext/grid.lua
|
||||
update_ext/grid.lua: remove_ext/grid.lua ext/grid.lua
|
||||
1163
hammerspoon/ext/grid.lua
Normal file
1163
hammerspoon/ext/grid.lua
Normal file
File diff suppressed because it is too large
Load Diff
35
hammerspoon/ext/grid.patch
Normal file
35
hammerspoon/ext/grid.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
--- ext/grid.lua 2017-08-05 01:44:03.000000000 +0100
|
||||
+++ ext/grid.patched.lua 2017-08-05 01:43:43.000000000 +0100
|
||||
@@ -319,6 +319,32 @@ function grid.set(win, cell, scr)
|
||||
w = cell.w * cellw - (margins.w * 2),
|
||||
h = cell.h * cellh - (margins.h * 2),
|
||||
}
|
||||
+
|
||||
+ -- calculate proper margins - this fixes doubled margins betweeen windows
|
||||
+ -- shamelessly borrowed from:
|
||||
+ -- https://github.com/szymonkaliski/Dotfiles/blob/8f2bbf973fa31e001e183de03b65fae408877f00/Dotfiles/hammerspoon/overrides.lua#L79-L106
|
||||
+ if cell.h < screengrid.h and cell.h % 1 == 0 then
|
||||
+ if cell.y ~= 0 then
|
||||
+ newframe.h = newframe.h + margins.h / 2
|
||||
+ newframe.y = newframe.y - margins.h / 2
|
||||
+ end
|
||||
+
|
||||
+ if cell.y + cell.h ~= screengrid.h then
|
||||
+ newframe.h = newframe.h + margins.h / 2
|
||||
+ end
|
||||
+ end
|
||||
+
|
||||
+ if cell.w < screengrid.w and cell.w % 1 == 0 then
|
||||
+ if cell.x ~= 0 then
|
||||
+ newframe.w = newframe.w + margins.w / 2
|
||||
+ newframe.x = newframe.x - margins.w / 2
|
||||
+ end
|
||||
+
|
||||
+ if cell.x + cell.w ~= screengrid.w then
|
||||
+ newframe.w = newframe.w + margins.w / 2
|
||||
+ end
|
||||
+ end
|
||||
+
|
||||
win:setFrameInScreenBounds(newframe) --TODO check this (against screen bottom stickiness)
|
||||
return grid
|
||||
end
|
||||
Reference in New Issue
Block a user