Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 734b291dd6 | |||
| a710b6c5de |
+12
-6
@@ -211,8 +211,8 @@ function obj.rescueWindowsToLaptop()
|
|||||||
if f.w > maxFrame.w then f.w = maxFrame.w - 100 end
|
if f.w > maxFrame.w then f.w = maxFrame.w - 100 end
|
||||||
if f.h > maxFrame.h then f.h = maxFrame.h - 100 end
|
if f.h > maxFrame.h then f.h = maxFrame.h - 100 end
|
||||||
|
|
||||||
f.x = maxFrame.x + 50 + staggerOffset
|
f.x = maxFrame.x + staggerOffset
|
||||||
f.y = maxFrame.y + 50 + staggerOffset
|
f.y = maxFrame.y + staggerOffset
|
||||||
|
|
||||||
win:setFrame(f, 0)
|
win:setFrame(f, 0)
|
||||||
staggerOffset = staggerOffset + 30
|
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
|
elseif event == hs.caffeinate.watcher.systemDidWake or event == hs.caffeinate.watcher.screensDidWake or event == hs.caffeinate.watcher.screensDidUnlock then
|
||||||
log("POWER: Wake event.")
|
log("POWER: Wake event.")
|
||||||
obj.saveCountdown = obj.saveInterval
|
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
|
-- Safely start timers up only after wakeup initialization
|
||||||
if obj.autoSaveTimer then obj.autoSaveTimer:start() end
|
if obj.autoSaveTimer then obj.autoSaveTimer:start() end
|
||||||
@@ -294,9 +296,13 @@ obj.powerWatcher = hs.caffeinate.watcher.new(function(event)
|
|||||||
obj.wakeTimer = nil
|
obj.wakeTimer = nil
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
log("WAKE SKIP: Single screen detected. Syncing count only.")
|
-- Only run rescue if the state actually dropped from multi-monitor down to single monitor during sleep
|
||||||
obj.isTransitioning = false
|
if obj.lastScreenCount > 1 then
|
||||||
obj.isRestoring = false
|
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
|
obj.lastScreenCount = currentScreens
|
||||||
updateMenu()
|
updateMenu()
|
||||||
end
|
end
|
||||||
|
|||||||
+2
-2
@@ -5,9 +5,9 @@
|
|||||||
"dimAlpha": 0.3
|
"dimAlpha": 0.3
|
||||||
},
|
},
|
||||||
"Home": {
|
"Home": {
|
||||||
"keepOpen": ["Discord", "Steam", "Komga", "Kavita", "Plex"],
|
"keepOpen": ["Code", "Spark", "Spotify"],
|
||||||
"close": ["Slack", "Microsoft Teams"],
|
"close": ["Slack", "Microsoft Teams"],
|
||||||
"dimAlpha": 0.1
|
"dimAlpha": 0.7
|
||||||
},
|
},
|
||||||
"Study": {
|
"Study": {
|
||||||
"keepOpen": ["AFFiNE", "Obsidian", "Anki", "Preview", "Safari"],
|
"keepOpen": ["AFFiNE", "Obsidian", "Anki", "Preview", "Safari"],
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"screenCount" : 3,
|
||||||
"windows" : [
|
"windows" : [
|
||||||
{
|
{
|
||||||
"x" : 0,
|
"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,
|
"y" : 30,
|
||||||
"appName" : "Google Chrome",
|
"appName" : "Google Chrome",
|
||||||
"h" : 957,
|
"h" : 957,
|
||||||
@@ -11,7 +12,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"x" : 2883,
|
"x" : 2883,
|
||||||
"winTitle" : "raycast-scripts — -zsh — 120×30",
|
"winTitle" : "francop — -zsh — 120×30",
|
||||||
"y" : 25,
|
"y" : 25,
|
||||||
"appName" : "Terminal",
|
"appName" : "Terminal",
|
||||||
"h" : 499,
|
"h" : 499,
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"x" : 2879,
|
"x" : 2879,
|
||||||
"winTitle" : "francop — -zsh — 120×30",
|
"winTitle" : "raycast-scripts — -zsh — 120×30",
|
||||||
"y" : 528,
|
"y" : 528,
|
||||||
"appName" : "Terminal",
|
"appName" : "Terminal",
|
||||||
"h" : 499,
|
"h" : 499,
|
||||||
@@ -28,22 +29,13 @@
|
|||||||
"bundleID" : "com.apple.Terminal"
|
"bundleID" : "com.apple.Terminal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"x" : 2670,
|
"x" : -862,
|
||||||
"winTitle" : "lab-status.py — raycast-scripts — Untracked",
|
"winTitle" : "raycast-scripts — francop@nextcloud: \/mnt\/docs\/Consume — -zsh — 120×30",
|
||||||
"y" : 366,
|
"y" : 65,
|
||||||
"appName" : "Code",
|
"appName" : "Terminal",
|
||||||
"h" : 714,
|
"h" : 499,
|
||||||
"w" : 1170,
|
"w" : 860,
|
||||||
"bundleID" : "com.microsoft.VSCode"
|
"bundleID" : "com.apple.Terminal"
|
||||||
},
|
|
||||||
{
|
|
||||||
"x" : 0,
|
|
||||||
"winTitle" : "mouseJiggle.lua — .hammerspoon — Modified",
|
|
||||||
"y" : 30,
|
|
||||||
"appName" : "Code",
|
|
||||||
"h" : 956,
|
|
||||||
"w" : 1920,
|
|
||||||
"bundleID" : "com.microsoft.VSCode"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"x" : 1920,
|
"x" : 1920,
|
||||||
@@ -55,16 +47,24 @@
|
|||||||
"bundleID" : "pro.affine.app"
|
"bundleID" : "pro.affine.app"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"x" : 392,
|
"x" : 0,
|
||||||
"winTitle" : "Bluetooth",
|
"winTitle" : "LayoutSelector.lua — .hammerspoon",
|
||||||
"y" : 168,
|
"y" : 30,
|
||||||
|
"appName" : "Code",
|
||||||
|
"h" : 957,
|
||||||
|
"w" : 1920,
|
||||||
|
"bundleID" : "com.microsoft.VSCode"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x" : 453,
|
||||||
|
"winTitle" : "Software Update",
|
||||||
|
"y" : 177,
|
||||||
"appName" : "System Settings",
|
"appName" : "System Settings",
|
||||||
"h" : 671,
|
"h" : 671,
|
||||||
"w" : 723,
|
"w" : 723,
|
||||||
"bundleID" : "com.apple.systempreferences"
|
"bundleID" : "com.apple.systempreferences"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"screenCount" : 3,
|
"saveTime" : "2026-05-17 17:58:50",
|
||||||
"saveTime" : "2026-05-16 04:21:57",
|
|
||||||
"mode" : "Docked"
|
"mode" : "Docked"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user