diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-09-04 18:32:03 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-09-04 18:32:03 +0200 |
| commit | f6ecef0959163d10dd6597037192456977aa5bc2 (patch) | |
| tree | 4bd8d6afc660d552bdcf61c4f5eef0b836d80dfa /src/debug | |
| parent | ff26531e11b55854c5937dac2f2ba121c78e11b9 (diff) | |
add lastwindow info to hyprctl workspaces
Diffstat (limited to 'src/debug')
| -rw-r--r-- | src/debug/HyprCtl.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 2cf2781e..1df8e443 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -124,19 +124,25 @@ std::string workspacesRequest(HyprCtl::eHyprCtlOutputFormat format) { result += "["; for (auto& w : g_pCompositor->m_vWorkspaces) { + const auto PLASTW = w->getLastFocusedWindow(); + result += getFormat( R"#({ "id": %i, "name": "%s", "monitor": "%s", "windows": %i, - "hasfullscreen": %s + "hasfullscreen": %s, + "lastwindow": %x, + "lastwindowtitle": "%s" },)#", w->m_iID, escapeJSONStrings(w->m_szName).c_str(), escapeJSONStrings(g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName).c_str(), g_pCompositor->getWindowsOnWorkspace(w->m_iID), - ((int)w->m_bHasFullscreenWindow == 1 ? "true" : "false") + ((int)w->m_bHasFullscreenWindow == 1 ? "true" : "false"), + PLASTW, + PLASTW ? PLASTW->m_szTitle.c_str() : "" ); } @@ -146,8 +152,9 @@ R"#({ result += "]"; } else { for (auto& w : g_pCompositor->m_vWorkspaces) { - result += getFormat("workspace ID %i (%s) on monitor %s:\n\twindows: %i\n\thasfullscreen: %i\n\n", - w->m_iID, w->m_szName.c_str(), g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName.c_str(), g_pCompositor->getWindowsOnWorkspace(w->m_iID), (int)w->m_bHasFullscreenWindow); + const auto PLASTW = w->getLastFocusedWindow(); + result += getFormat("workspace ID %i (%s) on monitor %s:\n\twindows: %i\n\thasfullscreen: %i\n\tlastwindow: %x\n\tlastwindowtitle: %s\n\n", + w->m_iID, w->m_szName.c_str(), g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName.c_str(), g_pCompositor->getWindowsOnWorkspace(w->m_iID), (int)w->m_bHasFullscreenWindow, PLASTW, PLASTW ? PLASTW->m_szTitle.c_str() : ""); } } return result; |
