Integration with Raycast
This commit is contained in:
+46
-2
@@ -209,7 +209,6 @@ function obj.rescueWindowsToLaptop()
|
||||
if f.w > maxFrame.w then f.w = maxFrame.w - 100 end
|
||||
if f.h > maxFrame.h then f.h = maxFrame.h - 100 end
|
||||
|
||||
-- NEW LOGIC: Start at top-left corner (50px offset) instead of center
|
||||
f.x = maxFrame.x + 50 + staggerOffset
|
||||
f.y = maxFrame.y + 50 + staggerOffset
|
||||
|
||||
@@ -302,7 +301,6 @@ obj.screenWatcher = hs.screen.watcher.new(function()
|
||||
|
||||
local currentScreens = #hs.screen.allScreens()
|
||||
|
||||
-- NEW GUARD: If count hasn't changed, ignore ghost/handshake events
|
||||
if currentScreens == obj.lastScreenCount then
|
||||
log("DOCK EVENT: Ignored (Screen count unchanged).")
|
||||
return
|
||||
@@ -338,4 +336,50 @@ obj.clockTimer = hs.timer.doEvery(1, function()
|
||||
end)
|
||||
|
||||
updateMenu()
|
||||
|
||||
-- ==========================================
|
||||
-- RAYCAST INTERACTIVE CHOOSER MENU
|
||||
-- ==========================================
|
||||
function obj.showMenu()
|
||||
local choices = {
|
||||
{
|
||||
text = "📸 Save State Layout",
|
||||
subText = "Snapshot active positions to saved_layout.json (Resets auto-timer)",
|
||||
action = "save"
|
||||
},
|
||||
{
|
||||
text = "🔄 Restore State Layout",
|
||||
subText = "Force apps and window sizes back to your saved profile state",
|
||||
action = "restore"
|
||||
},
|
||||
{
|
||||
text = "🚀 Rescue Windows",
|
||||
subText = "Cascade active window threads onto primary laptop screen space",
|
||||
action = "rescue"
|
||||
}
|
||||
}
|
||||
|
||||
if obj.instanceChooser then obj.instanceChooser:hide() end
|
||||
|
||||
obj.instanceChooser = hs.chooser.new(function(choice)
|
||||
if choice then
|
||||
if choice.action == "save" then
|
||||
obj.saveLayout(false)
|
||||
saveCountdown = obj.saveInterval
|
||||
elseif choice.action == "restore" then
|
||||
obj.restoreLayout()
|
||||
elseif choice.action == "rescue" then
|
||||
obj.rescueWindowsToLaptop()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
obj.instanceChooser:placeholderText("Workspace Manager Actions...")
|
||||
obj.instanceChooser:choices(choices)
|
||||
obj.instanceChooser:show()
|
||||
end
|
||||
|
||||
-- Export module instance globally for direct IPC command routing
|
||||
WindowManager = obj
|
||||
|
||||
return obj
|
||||
Reference in New Issue
Block a user