Fix hammerspoon window move

This commit is contained in:
Lukas Cech 2025-02-03 10:06:26 +01:00
parent b6540bbc82
commit 30a76ebc8c

View File

@ -18,29 +18,50 @@ windowMove = function()
hs.grid.set(win, cell, screen)
end
-- Windows seem to be indexed by primary screen first
hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad1", function()
local getScreenById = function(id)
for _, screen in ipairs(hs.screen.allScreens()) do
if screen:getUUID() == id then
return screen
end
end
-- 2025-01-30 09:50:56: 1 DELL S2721DGF 3 D3142823-261D-46EF-B9C2-5181C7FE2CA5
-- 2025-01-30 09:50:56: 2 AV Receiver 72 B5A65BB6-E73E-4C3D-977C-33C86798AA5A
-- 2025-01-30 09:50:56: 3 DELL S2722DGM 74 0F6BDB5B-840D-40BE-AAC9-B467A78E057A
for i, screen in ipairs(hs.screen.allScreens()) do
print(i, screen:name(), screen:id(), screen:getUUID())
return nil
end
hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad1", function()
-- DELL S2722DGM
local screen = getScreenById("0F6BDB5B-840D-40BE-AAC9-B467A78E057A")
if screen == nil then
return
end
local win = hs.window.focusedWindow()
win:moveToScreen(screen)
fullscreen(win)
win:moveToScreen(hs.screen.allScreens()[3])
end)
hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad2", function()
-- DELL S2721DGF
local screen = getScreenById("D3142823-261D-46EF-B9C2-5181C7FE2CA5")
if screen == nil then
return
end
local win = hs.window.focusedWindow()
win:moveToScreen(screen)
fullscreen(win)
win:moveToScreen(hs.screen.allScreens()[1])
end)
hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad3", function()
-- AV Receiver
local screen = getScreenById("B5A65BB6-E73E-4C3D-977C-33C86798AA5A")
if screen == nil then
return
end
local win = hs.window.focusedWindow()
win:moveToScreen(screen)
fullscreen(win)
win:moveToScreen(hs.screen.allScreens()[2])
end)
end