From cfb3a485b4b6148707d8b260554bf90c54f66e18 Mon Sep 17 00:00:00 2001 From: Peter Klijn Date: Sun, 28 Aug 2022 12:25:08 +0100 Subject: [PATCH] Added screen and window sizes to reset function --- hammerspoon_mocks.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hammerspoon_mocks.lua b/hammerspoon_mocks.lua index fe3587c..f6a527d 100644 --- a/hammerspoon_mocks.lua +++ b/hammerspoon_mocks.lua @@ -4,6 +4,9 @@ local hotkey = { bindings = {}, } +local defaultScreenRect = { x = 0, y = 0, w = 1200, h = 800 } +local defaultWindowRect = { x = 100, y = 100, w = 1000, h = 600 } + function hotkey.bind(mods, key, fn) lu.assertNotNil(mods) lu.assertNotNil(key) @@ -12,7 +15,7 @@ function hotkey.bind(mods, key, fn) end local screen = { - rect = { x = 0, y = 0, w = 1200, h = 800 }, + rect = defaultScreenRect, } function screen:frame() @@ -20,7 +23,7 @@ function screen:frame() end local window = { - rect = { x = 0, y = 0, w = 1200, h = 800 }, + rect = defaultWindowRect, _screen = screen, } @@ -51,6 +54,8 @@ local mocks = { function mocks:reset() self.hotkey.bindings = {} + self.window.rect = defaultWindowRect + self.window._screen.rect = defaultScreenRect end return mocks