mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-18 09:23:55 +02:00
[yabridgectl] Check notify-send install status
Since it's used for yabridge's desktop notifications.
This commit is contained in:
@@ -29,6 +29,7 @@ use std::os::unix::process::CommandExt;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, Stdio};
|
||||
use textwrap::Wrapper;
|
||||
use which::which;
|
||||
|
||||
use crate::config::{self, Config, KnownConfig, YABRIDGE_HOST_32_EXE_NAME, YABRIDGE_HOST_EXE_NAME};
|
||||
use crate::files::{LibArchitecture, NativeFile};
|
||||
@@ -463,6 +464,25 @@ pub fn verify_wine_setup(config: &mut Config) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Check whether `notify-send` is installed, as this is used to relay important information when
|
||||
/// something's very wrong.
|
||||
pub fn verify_external_dependencies() -> Result<()> {
|
||||
if which("notify-send").is_err() {
|
||||
eprintln!(
|
||||
"\n{}",
|
||||
wrap(&format!(
|
||||
"Warning: Could not find '{}'. This will not prevent yabridge from working, but \
|
||||
you will also not receive any notifcations when something is wrong. It is \
|
||||
usually part of the libnotify package, but your distro might have moved it into a \
|
||||
separate libnotify-tools package.",
|
||||
"notify-send".bright_white(),
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Wrap a long paragraph of text to terminal width, or 80 characters if the width of the terminal
|
||||
/// can't be determined. Everything after the first line gets indented with four spaces.
|
||||
pub fn wrap(text: &str) -> String {
|
||||
|
||||
Reference in New Issue
Block a user