Display the preamble in Linux only if notify-send is installed (#401)

This commit is contained in:
Roey Darwish Dror
2023-04-05 15:34:47 +03:00
committed by GitHub
parent 565aa405be
commit ddb1a021bb
2 changed files with 6 additions and 1 deletions

View File

@@ -88,7 +88,7 @@ fn run() -> Result<()> {
#[cfg(target_os = "linux")]
{
if config.display_preamble() && !config.skip_notify() {
if config.display_preamble() && terminal::supports_notify_send() && !config.skip_notify() {
print_warning("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.

View File

@@ -345,3 +345,8 @@ pub fn notify_desktop<P: AsRef<str>>(message: P, timeout: Option<Duration>) {
pub fn display_time(display_time: bool) {
TERMINAL.lock().unwrap().display_time(display_time);
}
#[cfg(target_os = "linux")]
pub fn supports_notify_send() -> bool {
TERMINAL.lock().unwrap().notify_send.is_some()
}