From 9ba095c29d6ba2c2ef1fd56b00b78966162b86a5 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Fri, 13 May 2022 14:46:46 -0400 Subject: [PATCH] hammerspoon fix for 3 monitors --- hammerspoon.symlink/Spoons/MoveWindow.spoon/init.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hammerspoon.symlink/Spoons/MoveWindow.spoon/init.lua b/hammerspoon.symlink/Spoons/MoveWindow.spoon/init.lua index a1b5dd6..eb8295d 100644 --- a/hammerspoon.symlink/Spoons/MoveWindow.spoon/init.lua +++ b/hammerspoon.symlink/Spoons/MoveWindow.spoon/init.lua @@ -15,9 +15,17 @@ function obj:init() local win = hs.window.focusedWindow() -- get the screen where the focused window is displayed, a.k.a. current screen local screen = win:screen() + -- local nextScreen = screen:next() -- compute the unitRect of the focused window relative to the current screen -- and move the window to the next screen setting the same unitRect - win:move(win:frame():toUnitRect(screen:frame()), screen:next(), true, 0) + -- win:move(win:frame():toUnitRect(screen:frame()), screen:next(), true, 0) + win:moveToScreen(screen:next(), true, true, 0) + end) + + hs.hotkey.bind({ "alt", "ctrl", "cmd" }, "b", function() + local win = hs.window.focusedWindow() + local screen = win:screen() + win:moveToScreen(screen:previous(), true, true, 0) end) hs.hotkey.bind({ "alt", "ctrl", "cmd" }, "m", function()