notifications: run update_xbiff even if notifications disabled

lazy_fetch
Manos Pitsidianakis 2021-01-13 22:34:19 +02:00
parent bcca9abe66
commit d16866e0f0
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 20 additions and 22 deletions

View File

@ -188,29 +188,27 @@ impl Component for NotificationCommand {
fn draw(&mut self, _grid: &mut CellBuffer, _area: Area, _context: &mut Context) {} fn draw(&mut self, _grid: &mut CellBuffer, _area: Area, _context: &mut Context) {}
fn process_event(&mut self, event: &mut UIEvent, context: &mut Context) -> bool { fn process_event(&mut self, event: &mut UIEvent, context: &mut Context) -> bool {
if !context.settings.notifications.enable {
return false;
}
if let UIEvent::Notification(ref title, ref body, ref kind) = event { if let UIEvent::Notification(ref title, ref body, ref kind) = event {
if let Some(ref bin) = context.settings.notifications.script { if context.settings.notifications.enable {
match Command::new(bin) if let Some(ref bin) = context.settings.notifications.script {
.arg(&kind.map(|k| k.to_string()).unwrap_or_default()) match Command::new(bin)
.arg(title.as_ref().map(String::as_str).unwrap_or("meli")) .arg(&kind.map(|k| k.to_string()).unwrap_or_default())
.arg(body) .arg(title.as_ref().map(String::as_str).unwrap_or("meli"))
.stdin(Stdio::piped()) .arg(body)
.stdout(Stdio::piped()) .stdin(Stdio::piped())
.spawn() .stdout(Stdio::piped())
{ .spawn()
Ok(child) => { {
context.children.push(child); Ok(child) => {
} context.children.push(child);
Err(err) => { }
log( Err(err) => {
format!("Could not run notification script: {}.", err.to_string()), log(
ERROR, format!("Could not run notification script: {}.", err.to_string()),
); ERROR,
debug!("Could not run notification script: {:?}", err); );
debug!("Could not run notification script: {:?}", err);
}
} }
} }
} }