summaryrefslogtreecommitdiff
path: root/src/debug/HyprCtl.cpp
diff options
context:
space:
mode:
authorItsDrike <itsdrike@protonmail.com>2024-03-02 19:12:31 +0100
committerGitHub <noreply@github.com>2024-03-02 18:12:31 +0000
commitbe89d6faa988f6bd33a66f02746872c649a16180 (patch)
tree1e2bfbf8d184a7209a5b973c42a869931572f8ef /src/debug/HyprCtl.cpp
parent8811f4b69ade469285635c539f20194d717c8e17 (diff)
notifs: Implement notification dimissing (#4790)
Diffstat (limited to 'src/debug/HyprCtl.cpp')
-rw-r--r--src/debug/HyprCtl.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index b3fb0af3..962496f7 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -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});