[yabridgectl] Check notify-send install status

Since it's used for yabridge's desktop notifications.
This commit is contained in:
Robbert van der Helm
2022-05-24 13:40:58 +02:00
parent 480755f8f0
commit 78858b98f7
3 changed files with 31 additions and 1 deletions
+6
View File
@@ -36,6 +36,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
update. If you use a distro packaged version of yabridge, then that means update. If you use a distro packaged version of yabridge, then that means
yabridge can now be updated safely without requiring any action from your yabridge can now be updated safely without requiring any action from your
side. side.
- Added support for the `effBeginLoadBank` and `effBeginLoadProgram` VST2
opcodes for loading state as a program or a program bank.
### Changed ### Changed
@@ -103,6 +105,10 @@ Versioning](https://semver.org/spec/v2.0.0.html).
idea. I've come across at least one binary this new parser can't handle idea. I've come across at least one binary this new parser can't handle
(https://github.com/m4b/goblin/issues/307), so it will still fall back to (https://github.com/m4b/goblin/issues/307), so it will still fall back to
winedump in some cases. winedump in some cases.
- After `yabridgectl sync` has finished setting up plugins, yabridgectl will now
also check whether `notify-send` is installed as part of its post-install
verification process. If `notify-send` is missing then yabridge won't be able
to send any notifications when things are going terribly wrong.
- `yabridgectl status` now shows the locations where bridged VST2 and VST3 - `yabridgectl status` now shows the locations where bridged VST2 and VST3
plugins will be set up. plugins will be set up.
- `yabridgectl sync --prune` now also considers broken symlinks. - `yabridgectl sync --prune` now also considers broken symlinks.
+5 -1
View File
@@ -28,7 +28,7 @@ use crate::config::{
}; };
use crate::files::{self, NativeFile, Plugin, Vst2Plugin}; use crate::files::{self, NativeFile, Plugin, Vst2Plugin};
use crate::util::{self, get_file_type}; use crate::util::{self, get_file_type};
use crate::util::{verify_path_setup, verify_wine_setup}; use crate::util::{verify_external_dependencies, verify_path_setup, verify_wine_setup};
use crate::vst3_moduleinfo::ModuleInfo; use crate::vst3_moduleinfo::ModuleInfo;
pub mod blacklist; pub mod blacklist;
@@ -682,6 +682,10 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> {
// This check is only performed once per combination of Wine and yabridge versions // This check is only performed once per combination of Wine and yabridge versions
verify_wine_setup(config)?; verify_wine_setup(config)?;
// Yabridge uses notify-send to relay important information when something's very wrong, so
// we'll check whether this is installed
verify_external_dependencies()?;
Ok(()) Ok(())
} }
+20
View File
@@ -29,6 +29,7 @@ use std::os::unix::process::CommandExt;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
use textwrap::Wrapper; use textwrap::Wrapper;
use which::which;
use crate::config::{self, Config, KnownConfig, YABRIDGE_HOST_32_EXE_NAME, YABRIDGE_HOST_EXE_NAME}; use crate::config::{self, Config, KnownConfig, YABRIDGE_HOST_32_EXE_NAME, YABRIDGE_HOST_EXE_NAME};
use crate::files::{LibArchitecture, NativeFile}; use crate::files::{LibArchitecture, NativeFile};
@@ -463,6 +464,25 @@ pub fn verify_wine_setup(config: &mut Config) -> Result<()> {
Ok(()) 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 /// 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. /// can't be determined. Everything after the first line gets indented with four spaces.
pub fn wrap(text: &str) -> String { pub fn wrap(text: &str) -> String {