Added ability to toggle parsing of notification 2fa codes (#260)

This commit is contained in:
Erik Reider 2023-05-14 13:03:42 +02:00 committed by GitHub
parent a8b04b9cf0
commit 28ed6342cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,7 @@
"control-center-margin-bottom": 0,
"control-center-margin-right": 0,
"control-center-margin-left": 0,
"notification-2fa-action": true,
"notification-icon-size": 64,
"notification-body-image-height": 100,
"notification-body-image-width": 200,

View File

@ -541,6 +541,11 @@ namespace SwayNotificationCenter {
}
}
/**
* If each notification should display a 'COPY \"1234\"' action
*/
public bool notification_2fa_action { get; set; default = true; }
/**
* Notification icon size, in pixels.
*/

View File

@ -64,6 +64,11 @@
"description": "The margin (in pixels) at the left of the notification center. 0 to disable",
"default": 0
},
"notification-2fa-action": {
"type": "boolean",
"description": "If each notification should display a 'COPY \"1234\"' action",
"default": true
},
"notification-icon-size": {
"type": "integer",
"description": "The notification icon size (in pixels)",

View File

@ -293,6 +293,7 @@ namespace SwayNotificationCenter {
/** Returns the first code found, else null */
private string ? parse_body_codes () {
if (!ConfigModel.instance.notification_2fa_action) return null;
string body = this.body.get_text ().strip ();
if (body.length == 0) return null;