Fix plugin argument-less hyprctl calls (#1723)

Handle hyprctl command whitespace trimming

might break
This commit is contained in:
Stanisław Zagórowski 2023-03-07 11:42:33 +01:00 committed by GitHub
parent 0aeb61a95a
commit b11e2eaa3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,8 +39,10 @@ APICALL bool HyprlandAPI::unregisterCallback(HANDLE handle, HOOK_CALLBACK_FN* fn
}
APICALL std::string HyprlandAPI::invokeHyprctlCommand(const std::string& call, const std::string& args, const std::string& format) {
std::string COMMAND = format + "/" + call + " " + args;
return HyprCtl::makeDynamicCall(COMMAND);
if (args.empty())
return HyprCtl::makeDynamicCall(format + "/" + call);
else
return HyprCtl::makeDynamicCall(format + "/" + call + " " + args);
}
APICALL bool HyprlandAPI::addLayout(HANDLE handle, const std::string& name, IHyprLayout* layout) {
@ -190,4 +192,4 @@ APICALL bool HyprlandAPI::removeDispatcher(HANDLE handle, const std::string& nam
std::erase_if(PLUGIN->registeredDispatchers, [&](const auto& other) { return other == name; });
return true;
}
}