From 580e40eb99708480e7a19310708920009688d36b Mon Sep 17 00:00:00 2001 From: Sonter Date: Fri, 30 Aug 2024 14:46:00 +0300 Subject: [PATCH] Add an option to ignore left click on a notification --- man/swaync.5.scd | 5 +++++ src/configModel/configModel.vala | 5 +++++ src/configSchema.json | 5 +++++ src/notification/notification.vala | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/man/swaync.5.scd b/man/swaync.5.scd index effcbc67..057f153e 100644 --- a/man/swaync.5.scd +++ b/man/swaync.5.scd @@ -80,6 +80,11 @@ config file to be able to detect config errors default: true ++ description: If each notification should display a 'COPY \"1234\"' action +*notification-ignore-left-click* ++ + type: bool ++ + default: false ++ + description: If notification should be closed on left click. This does not affect sliding behavior + *timeout* ++ type: integer ++ default: 10 ++ diff --git a/src/configModel/configModel.vala b/src/configModel/configModel.vala index 56f6547a..cc02177d 100644 --- a/src/configModel/configModel.vala +++ b/src/configModel/configModel.vala @@ -545,6 +545,11 @@ namespace SwayNotificationCenter { */ public bool notification_2fa_action { get; set; default = true; } + /** + * If notification should be closed on left click. This does not affect sliding behavior + */ + public bool notification_ignore_left_click { get; set; default = false; } + /** * If notifications should display a text field to reply if the * sender requests it. diff --git a/src/configSchema.json b/src/configSchema.json index 64210075..d5409227 100644 --- a/src/configSchema.json +++ b/src/configSchema.json @@ -85,6 +85,11 @@ "description": "If each notification should display a 'COPY \"1234\"' action", "default": true }, + "notification-ignore-left-click": { + "type": "boolean", + "description": "If notification should be closed on left click. This does not affect sliding behavior", + "default": false + }, "notification-inline-replies": { "type": "boolean", "description": "If notifications should display a text field to reply if the sender requests it. NOTE: Replying in popup notifications is only available if the compositor supports GTK Layer-Shell ON_DEMAND keyboard interactivity.", diff --git a/src/notification/notification.vala b/src/notification/notification.vala index bb3bffce..c5a6a321 100644 --- a/src/notification/notification.vala +++ b/src/notification/notification.vala @@ -167,7 +167,7 @@ namespace SwayNotificationCenter { // Emit released if (!default_action_down) return; default_action_down = false; - if (default_action_in) { + if (default_action_in && !ConfigModel.instance.notification_ignore_left_click) { click_default_action (); }