Added: Captured Windows Inside Profile State File
This commit is contained in:
@@ -235,9 +235,39 @@ function selector.showLayoutActions(layoutName)
|
||||
text = "🗑️ Delete Layout Profile",
|
||||
subText = "Permanently remove the profile config file from disk",
|
||||
action = "delete"
|
||||
},
|
||||
{
|
||||
text = "───────────────────────────────────────────────────────",
|
||||
subText = "📦 Captured Windows Inside Profile State File:",
|
||||
action = "info"
|
||||
}
|
||||
}
|
||||
|
||||
-- Dynamically read layout profile file and append saved windows
|
||||
local data = hs.json.read(path)
|
||||
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(actionChoices, {
|
||||
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(actionChoices, {
|
||||
text = "⚠️ No Saved Window Metrics Found",
|
||||
subText = "This layout profile does not contain any captured windows.",
|
||||
action = "info"
|
||||
})
|
||||
end
|
||||
|
||||
if selector.actionChooser then selector.actionChooser:hide() end
|
||||
|
||||
selector.actionChooser = hs.chooser.new(function(choice)
|
||||
|
||||
Reference in New Issue
Block a user