Adapted to Hyprland 0.53

This commit is contained in:
2026-01-05 12:45:08 +01:00
parent f7b5c44b82
commit daed7b2b59

View File

@@ -2,13 +2,13 @@
#include "../include/WindowRule.h" #include "../include/WindowRule.h"
std::string WindowRule::toString() { std::string WindowRule::toString() {
std::string mode = this->tile ? "tile" : "float"; std::string mode = this->tile ? "tile on" : "float on";
return "windowrule = " + mode + ", match:workspace " + std::to_string(this->workspaceID);
return "windowrule = " + mode + ", onworkspace:" + std::to_string(this->workspaceID); }
};
WindowRule WindowRule::parse(std::string ruleStr) { WindowRule WindowRule::parse(std::string ruleStr) {
WindowRule rule; WindowRule rule;
// Remove spaces for easier parsing // Remove spaces for easier parsing
ruleStr.erase(std::remove(ruleStr.begin(), ruleStr.end(), ' '), ruleStr.end()); ruleStr.erase(std::remove(ruleStr.begin(), ruleStr.end(), ' '), ruleStr.end());
@@ -17,15 +17,15 @@ WindowRule WindowRule::parse(std::string ruleStr) {
if (modePos != std::string::npos) { if (modePos != std::string::npos) {
auto commaPos = ruleStr.find(',', modePos); auto commaPos = ruleStr.find(',', modePos);
std::string mode = ruleStr.substr(modePos + 11, commaPos - (modePos + 11)); std::string mode = ruleStr.substr(modePos + 11, commaPos - (modePos + 11));
rule.tile = (mode == "tile"); rule.tile = (mode == "tileon");
} }
// Find workspace // Find workspace
auto wsPos = ruleStr.find("onworkspace:"); auto wsPos = ruleStr.find("match:workspace");
if (wsPos != std::string::npos) { if (wsPos != std::string::npos) {
std::string wsStr = ruleStr.substr(wsPos + 12); std::string wsStr = ruleStr.substr(wsPos + 15);
rule.workspaceID = std::stoi(wsStr); rule.workspaceID = std::stoi(wsStr);
} }
return rule; return rule;
} }