Add bordercolor windowrule (#992)

* Add bordercolor windowrule

* remove spaces form bordercolor rule + typo

Co-authored-by: Jef Steelant <jef.steelant_ext@softathome.com>
This commit is contained in:
Jef
2022-11-13 20:33:13 +01:00
committed by GitHub
parent 1a14841a75
commit 549fdf63f6
6 changed files with 65 additions and 43 deletions

View File

@@ -187,10 +187,10 @@ void Events::listener_mapWindow(void* owner, void* data) {
}
} else if (r.szRule.find("opacity") == 0) {
try {
std::string alphaPart = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
std::string alphaPart = removeBeginEndSpacesTabs(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
if (alphaPart.contains(' ')) {
// we have a comma, 2 values
// we have a space, 2 values
PWINDOW->m_sSpecialRenderData.alpha = std::stof(alphaPart.substr(0, alphaPart.find_first_of(' ')));
PWINDOW->m_sSpecialRenderData.alphaInactive = std::stof(alphaPart.substr(alphaPart.find_first_of(' ') + 1));
} else {
@@ -216,6 +216,20 @@ void Events::listener_mapWindow(void* owner, void* data) {
} else {
Debug::log(ERR, "Rule idleinhibit: unknown mode %s", IDLERULE.c_str());
}
} else if (r.szRule.find("bordercolor") == 0) {
try {
std::string colorPart = removeBeginEndSpacesTabs(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
if (colorPart.contains(' ')) {
// we have a space, 2 values
PWINDOW->m_sSpecialRenderData.activeBorderColor = configStringToInt(colorPart.substr(0, colorPart.find_first_of(' ')));
PWINDOW->m_sSpecialRenderData.inactiveBorderColor = configStringToInt(colorPart.substr(colorPart.find_first_of(' ') + 1));
} else {
PWINDOW->m_sSpecialRenderData.activeBorderColor = configStringToInt(colorPart);
}
} catch(std::exception& e) {
Debug::log(ERR, "BorderColor rule \"%s\" failed with: %s", r.szRule.c_str(), e.what());
}
}
}
@@ -259,7 +273,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
if (!PWORKSPACE) {
std::string workspaceName = "";
int workspaceID = 0;
if (requestedWorkspace.find("name:") == 0) {
workspaceName = requestedWorkspace.substr(5);
workspaceID = g_pCompositor->getNextAvailableNamedWorkspace();