mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-08 09:45:58 +01:00
Feat: add initial class/title to hyprctl clients
This commit is contained in:
parent
0a099ca2ab
commit
a43b18ae26
3 changed files with 25 additions and 17 deletions
|
@ -195,6 +195,8 @@ class CWindow {
|
|||
bool m_bWasMaximized = false;
|
||||
uint64_t m_iMonitorID = -1;
|
||||
std::string m_szTitle = "";
|
||||
std::string m_szInitialTitle = "";
|
||||
std::string m_szInitialClass = "";
|
||||
int m_iWorkspaceID = -1;
|
||||
|
||||
bool m_bIsMapped = false;
|
||||
|
|
|
@ -126,6 +126,8 @@ static std::string getWindowData(CWindow* w, HyprCtl::eHyprCtlOutputFormat forma
|
|||
"monitor": %i,
|
||||
"class": "%s",
|
||||
"title": "%s",
|
||||
"initialClass": "%s",
|
||||
"initialTitle": "%s",
|
||||
"pid": %i,
|
||||
"xwayland": %s,
|
||||
"pinned": %s,
|
||||
|
@ -142,13 +144,14 @@ static std::string getWindowData(CWindow* w, HyprCtl::eHyprCtlOutputFormat forma
|
|||
std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID)))
|
||||
.c_str(),
|
||||
((int)w->m_bIsFloating == 1 ? "true" : "false"), w->m_iMonitorID, escapeJSONStrings(g_pXWaylandManager->getAppIDClass(w)).c_str(),
|
||||
escapeJSONStrings(g_pXWaylandManager->getTitle(w)).c_str(), w->getPID(), ((int)w->m_bIsX11 == 1 ? "true" : "false"), (w->m_bPinned ? "true" : "false"),
|
||||
(w->m_bIsFullscreen ? "true" : "false"),
|
||||
escapeJSONStrings(g_pXWaylandManager->getTitle(w)).c_str(), escapeJSONStrings(w->m_szInitialClass).c_str(), escapeJSONStrings(w->m_szInitialTitle).c_str(), w->getPID(),
|
||||
((int)w->m_bIsX11 == 1 ? "true" : "false"), (w->m_bPinned ? "true" : "false"), (w->m_bIsFullscreen ? "true" : "false"),
|
||||
(w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0),
|
||||
w->m_bFakeFullscreenState ? "true" : "false", getGroupedData(w, format).c_str(), (w->m_pSwallowed ? getFormat("\"0x%x\"", w->m_pSwallowed).c_str() : "null"));
|
||||
} else {
|
||||
return getFormat(
|
||||
"Window %x -> %s:\n\tmapped: %i\n\thidden: %i\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\tclass: %s\n\ttitle: %s\n\tpid: "
|
||||
"Window %x -> %s:\n\tmapped: %i\n\thidden: %i\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\tclass: %s\n\ttitle: "
|
||||
"%s\n\tinitialClass: %s\n\tinitialTitle: %s\n\tpid: "
|
||||
"%i\n\txwayland: %i\n\tpinned: "
|
||||
"%i\n\tfullscreen: %i\n\tfullscreenmode: %i\n\tfakefullscreen: %i\n\tgrouped: %s\n\tswallowing: %x\n\n",
|
||||
w, w->m_szTitle.c_str(), (int)w->m_bIsMapped, (int)w->isHidden(), (int)w->m_vRealPosition.goalv().x, (int)w->m_vRealPosition.goalv().y, (int)w->m_vRealSize.goalv().x,
|
||||
|
@ -156,8 +159,8 @@ static std::string getWindowData(CWindow* w, HyprCtl::eHyprCtlOutputFormat forma
|
|||
(w->m_iWorkspaceID == -1 ? "" :
|
||||
g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName.c_str() :
|
||||
std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID)).c_str()),
|
||||
(int)w->m_bIsFloating, w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w).c_str(), g_pXWaylandManager->getTitle(w).c_str(), w->getPID(), (int)w->m_bIsX11,
|
||||
(int)w->m_bPinned, (int)w->m_bIsFullscreen,
|
||||
(int)w->m_bIsFloating, w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w).c_str(), g_pXWaylandManager->getTitle(w).c_str(), w->m_szInitialClass.c_str(),
|
||||
w->m_szInitialTitle.c_str(), w->getPID(), (int)w->m_bIsX11, (int)w->m_bPinned, (int)w->m_bIsFullscreen,
|
||||
(w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0),
|
||||
(int)w->m_bFakeFullscreenState, getGroupedData(w, format).c_str(), w->m_pSwallowed);
|
||||
}
|
||||
|
|
|
@ -117,6 +117,9 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
bool shouldFocus = true;
|
||||
bool workspaceSpecial = false;
|
||||
|
||||
PWINDOW->m_szInitialTitle = g_pXWaylandManager->getTitle(PWINDOW);
|
||||
PWINDOW->m_szInitialClass = g_pXWaylandManager->getAppIDClass(PWINDOW);
|
||||
|
||||
for (auto& r : WINDOWRULES) {
|
||||
if (r.szRule.find("monitor") == 0) {
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue