fix: remove ipc import on non-unix systems

This commit is contained in:
Thomas Frans
2023-05-27 19:17:06 +02:00
committed by Henrik Friedrichsen
parent c36d3cf272
commit 0c97bd36c3
2 changed files with 10 additions and 8 deletions

View File

@@ -13,21 +13,23 @@ use signal_hook::{consts::SIGHUP, consts::SIGTERM, iterator::Signals};
use crate::command::{Command, JumpMode}; use crate::command::{Command, JumpMode};
use crate::commands::CommandManager; use crate::commands::CommandManager;
use crate::config::{cache_path, Config}; use crate::config::Config;
use crate::events::{Event, EventManager}; use crate::events::{Event, EventManager};
use crate::ext_traits::CursiveExt; use crate::ext_traits::CursiveExt;
use crate::ipc::IpcSocket;
use crate::library::Library; use crate::library::Library;
use crate::queue::Queue; use crate::queue::Queue;
use crate::spotify::{PlayerEvent, Spotify}; use crate::spotify::{PlayerEvent, Spotify};
use crate::ui::contextmenu::ContextMenu; use crate::ui::contextmenu::ContextMenu;
use crate::ui::create_cursive; use crate::ui::create_cursive;
use crate::{authentication, ui}; use crate::{authentication, ui};
use crate::{command, ipc, queue, spotify}; use crate::{command, queue, spotify};
#[cfg(feature = "mpris")] #[cfg(feature = "mpris")]
use crate::mpris::{self, MprisManager}; use crate::mpris::{self, MprisManager};
#[cfg(unix)]
use crate::ipc::{self, IpcSocket};
/// Set up the global logger to log to `filename`. /// Set up the global logger to log to `filename`.
pub fn setup_logging(filename: &Path) -> Result<(), fern::InitError> { pub fn setup_logging(filename: &Path) -> Result<(), fern::InitError> {
fern::Dispatch::new() fern::Dispatch::new()
@@ -139,7 +141,7 @@ impl Application {
#[cfg(unix)] #[cfg(unix)]
let ipc = ipc::IpcSocket::new( let ipc = ipc::IpcSocket::new(
ASYNC_RUNTIME.handle(), ASYNC_RUNTIME.handle(),
cache_path("ncspot.sock"), crate::config::cache_path("ncspot.sock"),
event_manager.clone(), event_manager.clone(),
) )
.map_err(|e| e.to_string())?; .map_err(|e| e.to_string())?;

View File

@@ -3,7 +3,7 @@ use std::sync::{Arc, RwLock};
use log::{debug, info}; use log::{debug, info};
#[cfg(feature = "notify")] #[cfg(feature = "notify")]
use notify_rust::{Hint, Notification, Urgency}; use notify_rust::Notification;
use rand::prelude::*; use rand::prelude::*;
use strum_macros::Display; use strum_macros::Display;
@@ -511,9 +511,9 @@ pub fn send_notification(summary_txt: &str, body_txt: &str, cover_url: Option<St
// XDG desktop entry hints // XDG desktop entry hints
#[cfg(all(unix, not(target_os = "macos")))] #[cfg(all(unix, not(target_os = "macos")))]
n.urgency(Urgency::Low) n.urgency(notify_rust::Urgency::Low)
.hint(Hint::Transient(true)) .hint(notify_rust::Hint::Transient(true))
.hint(Hint::DesktopEntry("ncspot".into())); .hint(notify_rust::Hint::DesktopEntry("ncspot".into()));
match n.show() { match n.show() {
Ok(handle) => { Ok(handle) => {