diff options
Diffstat (limited to 'src/debug/HyprCtl.cpp')
| -rw-r--r-- | src/debug/HyprCtl.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 10302b08..332e3969 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -1455,17 +1455,29 @@ std::string dispatchNotify(eHyprCtlOutputFormat format, std::string request) { time = std::stoi(TIME); } catch (std::exception& e) { return "invalid arg 2"; } - CColor color = configStringToInt(vars[3]); + CColor color = configStringToInt(vars[3]); - std::string message = ""; + size_t msgidx = 4; + float fontsize = 13.f; + if (vars[msgidx].length() > 9 && vars[msgidx].compare(0, 10, "fontsize:")) { + const auto FONTSIZE = vars[msgidx].substr(9); - for (size_t i = 4; i < vars.size(); ++i) { - message += vars[i] + " "; + if (!isNumber(FONTSIZE, true)) + return "invalid fontsize kwarg"; + + try { + fontsize = std::stoi(FONTSIZE); + } catch (std::exception& e) { return "invalid fontsize karg"; } + + ++msgidx; } - message.pop_back(); + if (vars.size() <= msgidx) + return "not enough args"; + + const auto MESSAGE = vars.join(" ", msgidx); - g_pHyprNotificationOverlay->addNotification(message, color, time, (eIcons)icon); + g_pHyprNotificationOverlay->addNotification(MESSAGE, color, time, (eIcons)icon, fontsize); return "ok"; } |
