mirror of
https://git.meli.delivery/meli/meli
synced 2024-11-19 03:25:38 +00:00
ui: xbiff(1) support
This commit is contained in:
parent
bd8424c1f8
commit
86f21fbe52
@ -152,6 +152,22 @@ impl Component for NotificationFilter {
|
|||||||
debug!("{:?}", v);
|
debug!("{:?}", v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
match kind {
|
||||||
|
Some(NotificationType::NewMail) => {
|
||||||
|
if let Some(ref path) = context.runtime_settings.notifications.xbiff_file_path {
|
||||||
|
let mut file = std::fs::OpenOptions::new().append(true) /* writes will append to a file instead of overwriting previous contents */
|
||||||
|
.create(true) /* a new file will be created if the file does not yet already exist.*/
|
||||||
|
.open(path).unwrap();
|
||||||
|
if file.metadata().unwrap().len() > 128 {
|
||||||
|
file.set_len(0).unwrap();
|
||||||
|
} else {
|
||||||
|
std::io::Write::write_all(&mut file, b"z").unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,11 @@ pub struct NotificationsSettings {
|
|||||||
/// Default: None
|
/// Default: None
|
||||||
#[serde(default = "none")]
|
#[serde(default = "none")]
|
||||||
pub script: Option<String>,
|
pub script: Option<String>,
|
||||||
|
/// A file location which has its size changed when new mail arrives (max 128 bytes). Can be
|
||||||
|
/// used to trigger new mail notifications eg with `xbiff(1)`
|
||||||
|
/// Default: None
|
||||||
|
#[serde(default = "none")]
|
||||||
|
pub xbiff_file_path: Option<String>,
|
||||||
#[serde(deserialize_with = "toggleflag_de", default = "internal_value_false")]
|
#[serde(deserialize_with = "toggleflag_de", default = "internal_value_false")]
|
||||||
pub play_sound: super::ToggleFlag,
|
pub play_sound: super::ToggleFlag,
|
||||||
#[serde(default = "none")]
|
#[serde(default = "none")]
|
||||||
|
Loading…
Reference in New Issue
Block a user