change bind flag parsing

This commit is contained in:
vaxerski 2022-07-20 22:33:43 +02:00
parent 641aaff998
commit fc33cae70c
2 changed files with 16 additions and 5 deletions

View File

@ -506,9 +506,21 @@ void CConfigManager::handleAnimation(const std::string& command, const std::stri
configSetValueSafe("animations:" + ANIMNAME + "_style", curitem); configSetValueSafe("animations:" + ANIMNAME + "_style", curitem);
} }
void CConfigManager::handleBind(const std::string& command, const std::string& value, bool locked) { void CConfigManager::handleBind(const std::string& command, const std::string& value) {
// example: // example:
// bind=SUPER,G,exec,dmenu_run <args> // bind[fl]=SUPER,G,exec,dmenu_run <args>
// flags
bool locked = false;
const auto ARGS = command.substr(4);
for (auto& arg : ARGS) {
if (arg == 'l') {
locked = true;
} else {
parseError = "bind: invalid flag";
return;
}
}
auto valueCopy = value; auto valueCopy = value;
@ -710,8 +722,7 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
} }
} }
else if (COMMAND == "monitor") handleMonitor(COMMAND, VALUE); else if (COMMAND == "monitor") handleMonitor(COMMAND, VALUE);
else if (COMMAND == "bind") handleBind(COMMAND, VALUE); else if (COMMAND.find("bind") == 0) handleBind(COMMAND, VALUE);
else if (COMMAND == "bindl") handleBind(COMMAND, VALUE, true);
else if (COMMAND == "unbind") handleUnbind(COMMAND, VALUE); else if (COMMAND == "unbind") handleUnbind(COMMAND, VALUE);
else if (COMMAND == "workspace") handleDefaultWorkspace(COMMAND, VALUE); else if (COMMAND == "workspace") handleDefaultWorkspace(COMMAND, VALUE);
else if (COMMAND == "windowrule") handleWindowRule(COMMAND, VALUE); else if (COMMAND == "windowrule") handleWindowRule(COMMAND, VALUE);

View File

@ -121,7 +121,7 @@ private:
void handleDeviceConfig(const std::string&, const std::string&); void handleDeviceConfig(const std::string&, const std::string&);
void handleRawExec(const std::string&, const std::string&); void handleRawExec(const std::string&, const std::string&);
void handleMonitor(const std::string&, const std::string&); void handleMonitor(const std::string&, const std::string&);
void handleBind(const std::string&, const std::string&, bool locked = false); void handleBind(const std::string&, const std::string&);
void handleUnbind(const std::string&, const std::string&); void handleUnbind(const std::string&, const std::string&);
void handleWindowRule(const std::string&, const std::string&); void handleWindowRule(const std::string&, const std::string&);
void handleDefaultWorkspace(const std::string&, const std::string&); void handleDefaultWorkspace(const std::string&, const std::string&);