mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-29 16:15:57 +01:00
parent
eb1d5f94d8
commit
da349a03b2
7 changed files with 33 additions and 7 deletions
|
@ -43,6 +43,7 @@ public:
|
||||||
EXPOSED_MEMBER(MonitorID, int, i);
|
EXPOSED_MEMBER(MonitorID, int, i);
|
||||||
EXPOSED_MEMBER(StatusCommand, std::string, sz); // TODO: make the bar better
|
EXPOSED_MEMBER(StatusCommand, std::string, sz); // TODO: make the bar better
|
||||||
EXPOSED_MEMBER(LastWindowName, std::string, sz);
|
EXPOSED_MEMBER(LastWindowName, std::string, sz);
|
||||||
|
EXPOSED_MEMBER(LastWindowClass, std::string, sz);
|
||||||
EXPOSED_MEMBER(IsCovered, bool, b);
|
EXPOSED_MEMBER(IsCovered, bool, b);
|
||||||
|
|
||||||
void draw();
|
void draw();
|
||||||
|
|
|
@ -108,12 +108,17 @@ std::string getCurrentWindowName() {
|
||||||
return g_pWindowManager->statusBar->getLastWindowName();
|
return g_pWindowManager->statusBar->getLastWindowName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getCurrentWindowClass() {
|
||||||
|
return g_pWindowManager->statusBar->getLastWindowClass();
|
||||||
|
}
|
||||||
|
|
||||||
std::string BarCommands::parsePercent(std::string token) {
|
std::string BarCommands::parsePercent(std::string token) {
|
||||||
// check what the token is and act accordingly.
|
// check what the token is and act accordingly.
|
||||||
|
|
||||||
if (token == "RAM") return getRamString();
|
if (token == "RAM") return getRamString();
|
||||||
else if (token == "CPU") return getCpuString();
|
else if (token == "CPU") return getCpuString();
|
||||||
else if (token == "WINNAME") return getCurrentWindowName();
|
else if (token == "WINNAME") return getCurrentWindowName();
|
||||||
|
else if (token == "WINCLASS") return getCurrentWindowClass();
|
||||||
|
|
||||||
Debug::log(ERR, "Unknown token while parsing module: %" + token + "%");
|
Debug::log(ERR, "Unknown token while parsing module: %" + token + "%");
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,10 @@ CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) {
|
||||||
Debug::log(LOG, "New window got name: " + WINNAME);
|
Debug::log(LOG, "New window got name: " + WINNAME);
|
||||||
window.setName(WINNAME);
|
window.setName(WINNAME);
|
||||||
|
|
||||||
|
const auto WINCLASSNAME = getClassName(windowID);
|
||||||
|
Debug::log(LOG, "New window got class: " + WINCLASSNAME.second);
|
||||||
|
window.setClassName(WINCLASSNAME.second);
|
||||||
|
|
||||||
// For all floating windows, get their default size
|
// For all floating windows, get their default size
|
||||||
const auto GEOMETRYCOOKIE = xcb_get_geometry(g_pWindowManager->DisplayConnection, windowID);
|
const auto GEOMETRYCOOKIE = xcb_get_geometry(g_pWindowManager->DisplayConnection, windowID);
|
||||||
const auto GEOMETRY = xcb_get_geometry_reply(g_pWindowManager->DisplayConnection, GEOMETRYCOOKIE, 0);
|
const auto GEOMETRY = xcb_get_geometry_reply(g_pWindowManager->DisplayConnection, GEOMETRYCOOKIE, 0);
|
||||||
|
@ -205,6 +209,10 @@ CWindow* Events::remapWindow(int windowID, bool wasfloating, int forcemonitor) {
|
||||||
Debug::log(LOG, "New window got name: " + WINNAME);
|
Debug::log(LOG, "New window got name: " + WINNAME);
|
||||||
window.setName(WINNAME);
|
window.setName(WINNAME);
|
||||||
|
|
||||||
|
const auto WINCLASSNAME = getClassName(windowID);
|
||||||
|
Debug::log(LOG, "New window got class: " + WINCLASSNAME.second);
|
||||||
|
window.setClassName(WINCLASSNAME.second);
|
||||||
|
|
||||||
// For all floating windows, get their default size
|
// For all floating windows, get their default size
|
||||||
const auto GEOMETRYCOOKIE = xcb_get_geometry(g_pWindowManager->DisplayConnection, windowID);
|
const auto GEOMETRYCOOKIE = xcb_get_geometry(g_pWindowManager->DisplayConnection, windowID);
|
||||||
const auto GEOMETRY = xcb_get_geometry_reply(g_pWindowManager->DisplayConnection, GEOMETRYCOOKIE, 0);
|
const auto GEOMETRY = xcb_get_geometry_reply(g_pWindowManager->DisplayConnection, GEOMETRYCOOKIE, 0);
|
||||||
|
|
|
@ -67,16 +67,12 @@ void IPCSendMessage(const std::string path, SIPCMessageMainToBar smessage) {
|
||||||
|
|
||||||
message += IPC_MESSAGE_SEPARATOR + "barfullscreenwindow" + IPC_MESSAGE_EQUALITY + (smessage.fullscreenOnBar ? "1" : "0");
|
message += IPC_MESSAGE_SEPARATOR + "barfullscreenwindow" + IPC_MESSAGE_EQUALITY + (smessage.fullscreenOnBar ? "1" : "0");
|
||||||
|
|
||||||
message += IPC_MESSAGE_SEPARATOR + "lastwindowname" + IPC_MESSAGE_EQUALITY;
|
message += IPC_MESSAGE_SEPARATOR + "lastwindowname" + IPC_MESSAGE_EQUALITY + smessage.lastWindowName;
|
||||||
|
|
||||||
if (const auto PLASTWINDOW = g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow); PLASTWINDOW) {
|
message += IPC_MESSAGE_SEPARATOR + "lastwindowclass" + IPC_MESSAGE_EQUALITY + smessage.lastWindowClass;
|
||||||
message += PLASTWINDOW->getName() + IPC_MESSAGE_SEPARATOR;
|
|
||||||
} else {
|
|
||||||
message += IPC_MESSAGE_SEPARATOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
// append the EOF
|
// append the EOF
|
||||||
message += IPC_END_OF_FILE;
|
message += IPC_MESSAGE_SEPARATOR + IPC_END_OF_FILE;
|
||||||
|
|
||||||
// Send
|
// Send
|
||||||
writeToIPCChannel(path, message);
|
writeToIPCChannel(path, message);
|
||||||
|
@ -137,6 +133,8 @@ void IPCRecieveMessageB(const std::string path) {
|
||||||
std::sort(g_pWindowManager->statusBar->openWorkspaces.begin(), g_pWindowManager->statusBar->openWorkspaces.end());
|
std::sort(g_pWindowManager->statusBar->openWorkspaces.begin(), g_pWindowManager->statusBar->openWorkspaces.end());
|
||||||
} else if (PROPNAME == "lastwindowname") {
|
} else if (PROPNAME == "lastwindowname") {
|
||||||
g_pWindowManager->statusBar->setLastWindowName(PROPVALUE);
|
g_pWindowManager->statusBar->setLastWindowName(PROPVALUE);
|
||||||
|
} else if (PROPNAME == "lastwindowclass") {
|
||||||
|
g_pWindowManager->statusBar->setLastWindowClass(PROPVALUE);
|
||||||
} else if (PROPNAME == "barfullscreenwindow") {
|
} else if (PROPNAME == "barfullscreenwindow") {
|
||||||
g_pWindowManager->statusBar->setIsCovered(PROPVALUE == "1" ? true : false);
|
g_pWindowManager->statusBar->setIsCovered(PROPVALUE == "1" ? true : false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ struct SIPCMessageMainToBar {
|
||||||
std::vector<int> openWorkspaces;
|
std::vector<int> openWorkspaces;
|
||||||
uint64_t activeWorkspace;
|
uint64_t activeWorkspace;
|
||||||
std::string lastWindowName;
|
std::string lastWindowName;
|
||||||
|
std::string lastWindowClass;
|
||||||
bool fullscreenOnBar;
|
bool fullscreenOnBar;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
// ------------------------------------- //
|
// ------------------------------------- //
|
||||||
|
|
||||||
EXPOSED_MEMBER(Name, std::string, sz);
|
EXPOSED_MEMBER(Name, std::string, sz);
|
||||||
|
EXPOSED_MEMBER(ClassName, std::string, sz);
|
||||||
|
|
||||||
// Tells the window manager to reload the window's params
|
// Tells the window manager to reload the window's params
|
||||||
EXPOSED_MEMBER(Dirty, bool, b);
|
EXPOSED_MEMBER(Dirty, bool, b);
|
||||||
|
|
|
@ -1191,7 +1191,9 @@ void CWindowManager::updateBarInfo() {
|
||||||
|
|
||||||
message.activeWorkspace = activeWorkspaces[getMonitorFromCursor()->ID];
|
message.activeWorkspace = activeWorkspaces[getMonitorFromCursor()->ID];
|
||||||
|
|
||||||
|
|
||||||
auto winname = getWindowFromDrawable(LastWindow) ? getWindowFromDrawable(LastWindow)->getName() : "";
|
auto winname = getWindowFromDrawable(LastWindow) ? getWindowFromDrawable(LastWindow)->getName() : "";
|
||||||
|
auto winclassname = getWindowFromDrawable(LastWindow) ? getWindowFromDrawable(LastWindow)->getClassName() : "";
|
||||||
|
|
||||||
for (auto& c : winname) {
|
for (auto& c : winname) {
|
||||||
// Remove illegal chars
|
// Remove illegal chars
|
||||||
|
@ -1201,8 +1203,18 @@ void CWindowManager::updateBarInfo() {
|
||||||
c = ' ';
|
c = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto& c : winclassname) {
|
||||||
|
// Remove illegal chars
|
||||||
|
if (c == '=')
|
||||||
|
c = ' ';
|
||||||
|
else if (c == '\t')
|
||||||
|
c = ' ';
|
||||||
|
}
|
||||||
|
|
||||||
message.lastWindowName = winname;
|
message.lastWindowName = winname;
|
||||||
|
|
||||||
|
message.lastWindowClass = winclassname;
|
||||||
|
|
||||||
message.fullscreenOnBar = getWorkspaceByID(activeWorkspaces[ConfigManager::getInt("bar:monitor") > monitors.size() ? 0 : ConfigManager::getInt("bar:monitor")])->getHasFullscreenWindow();
|
message.fullscreenOnBar = getWorkspaceByID(activeWorkspaces[ConfigManager::getInt("bar:monitor") > monitors.size() ? 0 : ConfigManager::getInt("bar:monitor")])->getHasFullscreenWindow();
|
||||||
|
|
||||||
for (auto& workspace : workspaces) {
|
for (auto& workspace : workspaces) {
|
||||||
|
|
Loading…
Reference in a new issue