Allow customization of notification timeout

This commit is contained in:
Lyndon Sanche 2022-01-25 18:29:30 -07:00
parent bf55a9478a
commit 92bca205e7
No known key found for this signature in database
GPG Key ID: 6F8E82F60C799B18
2 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,7 @@ pub struct CmdDurationConfig<'a> {
pub disabled: bool,
pub show_notifications: bool,
pub min_time_to_notify: i64,
pub notification_timeout: u64,
}
impl<'a> Default for CmdDurationConfig<'a> {
@ -24,6 +25,7 @@ impl<'a> Default for CmdDurationConfig<'a> {
disabled: false,
show_notifications: false,
min_time_to_notify: 45_000,
notification_timeout: 750,
}
}
}

View File

@ -84,7 +84,7 @@ fn undistract_me<'a, 'b>(
.summary("Command finished")
.body(&body)
.icon("utilities-terminal")
.timeout(Timeout::Milliseconds(750));
.timeout(Timeout::Milliseconds(config.notification_timeout as u32));
if let Err(err) = notification.show() {
log::trace!("Cannot show notification: {}", err);