Added hyprctl reload

This commit is contained in:
vaxerski 2022-05-08 15:28:45 +02:00
parent aa5b0d2cda
commit 39dcfa61c3
4 changed files with 14 additions and 2 deletions

View file

@ -25,6 +25,7 @@ usage: hyprctl [command] [(opt)args]
dispatch dispatch
keyword keyword
version version
reload
)#"; )#";
void request(std::string arg) { void request(std::string arg) {
@ -142,6 +143,7 @@ int main(int argc, char** argv) {
else if (!strcmp(argv[1], "activewindow")) request("activewindow"); else if (!strcmp(argv[1], "activewindow")) request("activewindow");
else if (!strcmp(argv[1], "layers")) request("layers"); else if (!strcmp(argv[1], "layers")) request("layers");
else if (!strcmp(argv[1], "version")) request("version"); else if (!strcmp(argv[1], "version")) request("version");
else if (!strcmp(argv[1], "reload")) request("reload");
else if (!strcmp(argv[1], "dispatch")) dispatchRequest(argc, argv); else if (!strcmp(argv[1], "dispatch")) dispatchRequest(argc, argv);
else if (!strcmp(argv[1], "keyword")) keywordRequest(argc, argv); else if (!strcmp(argv[1], "keyword")) keywordRequest(argc, argv);
else if (!strcmp(argv[1], "--batch")) batchRequest(argc, argv); else if (!strcmp(argv[1], "--batch")) batchRequest(argc, argv);

View file

@ -555,8 +555,9 @@ void CConfigManager::tick() {
} }
// check if we need to reload cfg // check if we need to reload cfg
if (fileStat.st_mtime != lastModifyTime) { if (fileStat.st_mtime != lastModifyTime || m_bForceReload) {
lastModifyTime = fileStat.st_mtime; lastModifyTime = fileStat.st_mtime;
m_bForceReload = false;
loadConfigLoadVars(); loadConfigLoadVars();
} }

View file

@ -71,6 +71,7 @@ public:
void performMonitorReload(); void performMonitorReload();
bool m_bWantsMonitorReload = false; bool m_bWantsMonitorReload = false;
bool m_bForceReload = false;
std::string parseKeyword(const std::string&, const std::string&, bool dynamic = false); std::string parseKeyword(const std::string&, const std::string&, bool dynamic = false);

View file

@ -130,6 +130,12 @@ std::string dispatchKeyword(std::string in) {
return retval; return retval;
} }
std::string reloadRequest() {
g_pConfigManager->m_bForceReload = true;
return "ok";
}
std::string getReply(std::string); std::string getReply(std::string);
std::string dispatchBatch(std::string request) { std::string dispatchBatch(std::string request) {
@ -177,6 +183,8 @@ std::string getReply(std::string request) {
return layersRequest(); return layersRequest();
else if (request == "version") else if (request == "version")
return versionRequest(); return versionRequest();
else if (request == "reload")
return reloadRequest();
else if (request.find("dispatch") == 0) else if (request.find("dispatch") == 0)
return dispatchRequest(request); return dispatchRequest(request);
else if (request.find("keyword") == 0) else if (request.find("keyword") == 0)