notify: Add custom fontsize support for notifications (#4981)
* Add custom fontsize support for notifications * Remove debug stuff * Use original default font size * Handle fontsize as keyword arg * Use CVarList::join instead of for loop * Use size_t for msgidx
This commit is contained in:
parent
8e2a62e53b
commit
067df84388
3 changed files with 37 additions and 26 deletions
|
|
@ -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";
|
||||
|
||||
g_pHyprNotificationOverlay->addNotification(message, color, time, (eIcons)icon);
|
||||
const auto MESSAGE = vars.join(" ", msgidx);
|
||||
|
||||
g_pHyprNotificationOverlay->addNotification(MESSAGE, color, time, (eIcons)icon, fontsize);
|
||||
|
||||
return "ok";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue