default workspace option

This commit is contained in:
vaxerski
2022-03-20 16:01:47 +01:00
parent 50370e4216
commit 2e18fa268a
4 changed files with 25 additions and 3 deletions

View File

@@ -156,6 +156,19 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v
g_pKeybindManager->addKeybind(SKeybind{KEY, MOD, HANDLER, COMMAND});
}
void CConfigManager::handleDefaultWorkspace(const std::string& command, const std::string& value) {
const auto DISPLAY = value.substr(0, value.find_first_of(','));
const auto WORKSPACEID = stoi(value.substr(value.find_first_of(',') + 1));
for (auto& mr : m_dMonitorRules) {
if (mr.name == DISPLAY) {
mr.defaultWorkspaceID = WORKSPACEID;
break;
}
}
}
void CConfigManager::parseLine(std::string& line) {
// first check if its not a comment
const auto COMMENTSTART = line.find_first_of('#');
@@ -207,9 +220,11 @@ void CConfigManager::parseLine(std::string& line) {
} else if (COMMAND == "bind") {
handleBind(COMMAND, VALUE);
return;
} else if (COMMAND == "workspace") {
handleDefaultWorkspace(COMMAND, VALUE);
return;
}
configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE);
}