Added: Captured Windows Inside Profile State File

This commit is contained in:
2026-05-16 20:53:06 -04:00
parent efadc1e218
commit c9d516c6fd
2 changed files with 61 additions and 0 deletions
+31
View File
@@ -358,6 +358,7 @@ function obj.showMenu()
local min = math.floor(obj.saveCountdown / 60)
local sec = obj.saveCountdown % 60
-- 1. Base Core Operational Rows
local choices = {
{
text = string.format("⏱️ Next Autosave: %d:%02d", min, sec),
@@ -378,9 +379,39 @@ function obj.showMenu()
text = "🚀 Rescue Windows",
subText = "Cascade active window threads onto primary laptop screen space",
action = "rescue"
},
{
text = "───────────────────────────────────────────────────────",
subText = "📦 Captured Windows Inside Profile State File:",
action = "info"
}
}
-- 2. Dynamically read layout file and append saved windows
local data = hs.json.read(obj.layoutFile)
if data and data.windows and #data.windows > 0 then
for _, win in ipairs(data.windows) do
-- Verify if the application is currently running on the system server
local isRunning = hs.application.get(win.bundleID) or hs.application.get(win.appName)
local statusIndicator = isRunning and "🟢" or "🔴"
local cleanTitle = (win.winTitle and win.winTitle ~= "") and win.winTitle or "Untitled Window"
if #cleanTitle > 60 then cleanTitle = string.sub(cleanTitle, 1, 57) .. "..." end
table.insert(choices, {
text = string.format("%s %s", statusIndicator, win.appName),
subText = string.format("↳ Title: \"%s\" | Bounds: %dx%d at (%d,%d)", cleanTitle, win.w, win.h, win.x, win.y),
action = "info"
})
end
else
table.insert(choices, {
text = "⚠️ No Saved Window Metrics Found",
subText = "Run a Save operation to record your desktop layout profile context.",
action = "info"
})
end
if obj.instanceChooser then obj.instanceChooser:hide() end
obj.instanceChooser = hs.chooser.new(function(choice)