Compare commits

...

2 Commits

Author SHA1 Message Date
francop 734b291dd6 Update to Layout 2026-05-19 11:55:40 -04:00
francop a710b6c5de Added Detection if last screen count was 1, no window rescue needed.
Added: On rescuce, start at 0,0
2026-05-19 11:55:20 -04:00
3 changed files with 38 additions and 32 deletions
+12 -6
View File
@@ -211,8 +211,8 @@ 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
f.x = maxFrame.x + 50 + staggerOffset
f.y = maxFrame.y + 50 + staggerOffset
f.x = maxFrame.x + staggerOffset
f.y = maxFrame.y + staggerOffset
win:setFrame(f, 0)
staggerOffset = staggerOffset + 30
@@ -276,7 +276,9 @@ obj.powerWatcher = hs.caffeinate.watcher.new(function(event)
elseif event == hs.caffeinate.watcher.systemDidWake or event == hs.caffeinate.watcher.screensDidWake or event == hs.caffeinate.watcher.screensDidUnlock then
log("POWER: Wake event.")
obj.saveCountdown = obj.saveInterval
obj.isMenuUpdating = false -- Explicitly clean guard flag upon waking up
obj.isMenuUpdating = false
obj.isTransitioning = false
obj.isRestoring = false
-- Safely start timers up only after wakeup initialization
if obj.autoSaveTimer then obj.autoSaveTimer:start() end
@@ -294,9 +296,13 @@ obj.powerWatcher = hs.caffeinate.watcher.new(function(event)
obj.wakeTimer = nil
end)
else
log("WAKE SKIP: Single screen detected. Syncing count only.")
obj.isTransitioning = false
obj.isRestoring = false
-- Only run rescue if the state actually dropped from multi-monitor down to single monitor during sleep
if obj.lastScreenCount > 1 then
log("WAKE ACTIVATE: Screen count dropped from " .. obj.lastScreenCount .. " to 1 during sleep. Running rescue.")
obj.rescueWindowsToLaptop()
else
log("WAKE SKIP: Woke up on single screen, matched previous state. No rescue needed.")
end
obj.lastScreenCount = currentScreens
updateMenu()
end
+2 -2
View File
@@ -5,9 +5,9 @@
"dimAlpha": 0.3
},
"Home": {
"keepOpen": ["Discord", "Steam", "Komga", "Kavita", "Plex"],
"keepOpen": ["Code", "Spark", "Spotify"],
"close": ["Slack", "Microsoft Teams"],
"dimAlpha": 0.1
"dimAlpha": 0.7
},
"Study": {
"keepOpen": ["AFFiNE", "Obsidian", "Anki", "Preview", "Safari"],
+24 -24
View File
@@ -1,8 +1,9 @@
{
"screenCount" : 3,
"windows" : [
{
"x" : 0,
"winTitle" : "francop - Gitea: Git with a cup of tea - Google Chrome",
"winTitle" : "ASUS Wireless Router GT-AX11000 - VPN Status - Google Chrome",
"y" : 30,
"appName" : "Google Chrome",
"h" : 957,
@@ -11,7 +12,7 @@
},
{
"x" : 2883,
"winTitle" : "raycast-scripts — -zsh — 120×30",
"winTitle" : "francop — -zsh — 120×30",
"y" : 25,
"appName" : "Terminal",
"h" : 499,
@@ -20,7 +21,7 @@
},
{
"x" : 2879,
"winTitle" : "francop — -zsh — 120×30",
"winTitle" : "raycast-scripts — -zsh — 120×30",
"y" : 528,
"appName" : "Terminal",
"h" : 499,
@@ -28,22 +29,13 @@
"bundleID" : "com.apple.Terminal"
},
{
"x" : 2670,
"winTitle" : "lab-status.py — raycast-scripts — Untracked",
"y" : 366,
"appName" : "Code",
"h" : 714,
"w" : 1170,
"bundleID" : "com.microsoft.VSCode"
},
{
"x" : 0,
"winTitle" : "mouseJiggle.lua — .hammerspoon — Modified",
"y" : 30,
"appName" : "Code",
"h" : 956,
"w" : 1920,
"bundleID" : "com.microsoft.VSCode"
"x" : -862,
"winTitle" : "raycast-scripts — francop@nextcloud: \/mnt\/docs\/Consume — -zsh — 120×30",
"y" : 65,
"appName" : "Terminal",
"h" : 499,
"w" : 860,
"bundleID" : "com.apple.Terminal"
},
{
"x" : 1920,
@@ -55,16 +47,24 @@
"bundleID" : "pro.affine.app"
},
{
"x" : 392,
"winTitle" : "Bluetooth",
"y" : 168,
"x" : 0,
"winTitle" : "LayoutSelector.lua — .hammerspoon",
"y" : 30,
"appName" : "Code",
"h" : 957,
"w" : 1920,
"bundleID" : "com.microsoft.VSCode"
},
{
"x" : 453,
"winTitle" : "Software Update",
"y" : 177,
"appName" : "System Settings",
"h" : 671,
"w" : 723,
"bundleID" : "com.apple.systempreferences"
}
],
"screenCount" : 3,
"saveTime" : "2026-05-16 04:21:57",
"saveTime" : "2026-05-17 17:58:50",
"mode" : "Docked"
}