cxtrinityy
2023-06-26 14:34:51 +08:00
hammerspoon, 写下 lua 就可以, 我双屏互切就这么写的, 你多屏可以自己多写几个对应的:
hs.hotkey.bind({"ctrl", "cmd"}, "x", function()
local cs = hs.mouse.getCurrentScreen()
local screens = hs.screen.allScreens()
if cs:id() ~= screens[1]:id() then
-- hs.alert.show("not in mac screen")
local cmod = screens[1]:currentMode();
hs.mouse.setRelativePosition({x = cmod["w"] / 2, y = cmod["h"] / 2},
screens[1])
else
-- hs.alert.show("in mac screen")
local cmod = screens[2]:currentMode();
hs.mouse.setRelativePosition({x = cmod["w"] / 2, y = cmod["h"] / 2},
screens[2])
end
end)