mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-15 12:03:48 -07:00
notifs: Implement notification dimissing (#4790)
This commit is contained in:
@@ -1430,6 +1430,26 @@ std::string dispatchNotify(eHyprCtlOutputFormat format, std::string request) {
|
||||
return "ok";
|
||||
}
|
||||
|
||||
std::string dispatchDismissNotify(eHyprCtlOutputFormat format, std::string request) {
|
||||
CVarList vars(request, 0, ' ');
|
||||
|
||||
int amount = -1;
|
||||
|
||||
if (vars.size() > 1) {
|
||||
const auto AMOUNT = vars[1];
|
||||
if (!isNumber(AMOUNT))
|
||||
return "invalid arg 1";
|
||||
|
||||
try {
|
||||
amount = std::stoi(AMOUNT);
|
||||
} catch (std::exception& e) { return "invalid arg 1"; }
|
||||
}
|
||||
|
||||
g_pHyprNotificationOverlay->dismissNotifications(amount);
|
||||
|
||||
return "ok";
|
||||
}
|
||||
|
||||
CHyprCtl::CHyprCtl() {
|
||||
registerCommand(SHyprCtlCommand{"workspaces", true, workspacesRequest});
|
||||
registerCommand(SHyprCtlCommand{"workspacerules", true, workspaceRulesRequest});
|
||||
@@ -1453,6 +1473,7 @@ CHyprCtl::CHyprCtl() {
|
||||
registerCommand(SHyprCtlCommand{"reload", false, reloadRequest});
|
||||
registerCommand(SHyprCtlCommand{"plugin", false, dispatchPlugin});
|
||||
registerCommand(SHyprCtlCommand{"notify", false, dispatchNotify});
|
||||
registerCommand(SHyprCtlCommand{"dismissnotify", false, dispatchDismissNotify});
|
||||
registerCommand(SHyprCtlCommand{"setprop", false, dispatchSetProp});
|
||||
registerCommand(SHyprCtlCommand{"seterror", false, dispatchSeterror});
|
||||
registerCommand(SHyprCtlCommand{"switchxkblayout", false, switchXKBLayoutRequest});
|
||||
|
Reference in New Issue
Block a user