From 5f697e28a4d363d0d7e7436ceb368acf60568758 Mon Sep 17 00:00:00 2001 From: Landon Grindheim Date: Wed, 30 Sep 2020 09:30:29 -0400 Subject: [PATCH 1/2] Define window functions on `hs.window` metatable Starting at Hammerspoon commit 4698dc6, window functions began being defined on the metatable of the window object. This commit extends that pattern. Until now, the only place in this repository where functions are defined directly on Hammerspoon objects is in this file. While I have some doubts about the approach recently introduced by Hammerspoon maintainers, it seems to have since seen further adoption. --- hammerspoon/windows.lua | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/hammerspoon/windows.lua b/hammerspoon/windows.lua index 99b422bf..d389465d 100644 --- a/hammerspoon/windows.lua +++ b/hammerspoon/windows.lua @@ -1,11 +1,12 @@ hs.window.animationDuration = 0 +window = hs.getObjectMetatable("hs.window") -- +-----------------+ -- | | | -- | HERE | | -- | | | -- +-----------------+ -function hs.window.left(win) +function window.left(win) local f = win:frame() local screen = win:screen() local max = screen:frame() @@ -22,7 +23,7 @@ end -- | | HERE | -- | | | -- +-----------------+ -function hs.window.right(win) +function window.right(win) local f = win:frame() local screen = win:screen() local max = screen:frame() @@ -39,7 +40,7 @@ end -- +-----------------+ -- | | -- +-----------------+ -function hs.window.up(win) +function window.up(win) local f = win:frame() local screen = win:screen() local max = screen:frame() @@ -56,7 +57,7 @@ end -- +-----------------+ -- | HERE | -- +-----------------+ -function hs.window.down(win) +function window.down(win) local f = win:frame() local screen = win:screen() local max = screen:frame() @@ -73,7 +74,7 @@ end -- +--------+ | -- | | -- +-----------------+ -function hs.window.upLeft(win) +function window.upLeft(win) local f = win:frame() local screen = win:screen() local max = screen:fullFrame() @@ -90,7 +91,7 @@ end -- +--------+ | -- | HERE | | -- +-----------------+ -function hs.window.downLeft(win) +function window.downLeft(win) local f = win:frame() local screen = win:screen() local max = screen:fullFrame() @@ -107,7 +108,7 @@ end -- | +--------| -- | | HERE | -- +-----------------+ -function hs.window.downRight(win) +function window.downRight(win) local f = win:frame() local screen = win:screen() local max = screen:fullFrame() @@ -125,7 +126,7 @@ end -- | +--------| -- | | -- +-----------------+ -function hs.window.upRight(win) +function window.upRight(win) local f = win:frame() local screen = win:screen() local max = screen:fullFrame() @@ -142,7 +143,7 @@ end -- | | HERE | | -- | | | | -- +---------------+ -function hs.window.centerWithFullHeight(win) +function window.centerWithFullHeight(win) local f = win:frame() local screen = win:screen() local max = screen:fullFrame() @@ -159,7 +160,7 @@ end -- | HERE | | -- | | | -- +-----------------+ -function hs.window.left40(win) +function window.left40(win) local f = win:frame() local screen = win:screen() local max = screen:frame() @@ -176,7 +177,7 @@ end -- | | HERE | -- | | | -- +-----------------+ -function hs.window.right60(win) +function window.right60(win) local f = win:frame() local screen = win:screen() local max = screen:frame() @@ -188,7 +189,7 @@ function hs.window.right60(win) win:setFrame(f) end -function hs.window.nextScreen(win) +function window.nextScreen(win) local currentScreen = win:screen() local allScreens = hs.screen.allScreens() currentScreenIndex = hs.fnutils.indexOf(allScreens, currentScreen) From 3e0eb1c59714ed407ea8b433ec979b9b26ecb921 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Sat, 10 Oct 2020 09:18:02 -0400 Subject: [PATCH 2/2] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Bump=20Hammerspoon=20d?= =?UTF-8?q?ependency=20to=200.9.81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d8b9b2e8..5cfac5a2 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ This setup is honed and tested with the following dependencies. - macOS High Sierra, 10.13 - [Karabiner-Elements 12.2.0][karabiner] -- [Hammerspoon 0.9.73][hammerspoon] +- [Hammerspoon 0.9.81][hammerspoon] ## Installation