Adds notify-send bug warning when topgrade is run

This commit is contained in:
Thomas Schönauer
2023-01-27 22:30:36 +01:00
parent 4f38254321
commit ae888d3515
3 changed files with 15 additions and 0 deletions

View File

@@ -44,6 +44,9 @@
# Skip sending a notification at the end of a run
#skip_notify = true
# Skip the preamble displayed when topgrade is run
#display_preamble = false
[git]
#max_concurrency = 5
# Additional git repositories to pull

View File

@@ -294,6 +294,7 @@ pub struct ConfigFile {
tmux_arguments: Option<String>,
set_title: Option<bool>,
display_time: Option<bool>,
display_preambe: Option<bool>,
assume_yes: Option<bool>,
yay_arguments: Option<String>,
aura_aur_arguments: Option<String>,
@@ -1050,6 +1051,10 @@ impl Config {
self.config_file.display_time.unwrap_or(true)
}
pub fn display_preamble(&self) -> bool {
self.config_file.display_preambe.unwrap_or(true)
}
pub fn should_run_custom_command(&self, name: &str) -> bool {
if self.opt.custom_commands.is_empty() {
return true;

View File

@@ -86,6 +86,13 @@ fn run() -> Result<()> {
debug!("Binary path: {:?}", std::env::current_exe());
debug!("Self Update: {:?}", cfg!(feature = "self-update"));
if config.display_preamble() {
print_warning(format!("Due to a design issue with notify-send it could be that topgrade hangs when it's finished.
If this is the case on your system add the --skip-notify flag to the topgrade command or set skip_notify = true in the config file.
If you don't want this message to appear any longer set display_preamble = false in the config file.
For more information about this issue see https://askubuntu.com/questions/110969/notify-send-ignores-timeout and https://github.com/topgrade-rs/topgrade/issues/288."));
}
if config.run_in_tmux() && env::var("TOPGRADE_INSIDE_TMUX").is_err() {
#[cfg(unix)]
{