From fac3ec769739c6e749b3e5f7925f146f503afbad Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Sat, 10 Jun 2023 18:50:28 +0200 Subject: [PATCH] linux tray as mac tray --- Cargo.toml | 4 +++- ...c-tray-dark-x2.png => outlined-tray-dark-x2.png} | Bin ...tray-light-x2.png => outlined-tray-light-x2.png} | Bin src/tray.rs | 9 +++++---- 4 files changed, 8 insertions(+), 5 deletions(-) rename res/{mac-tray-dark-x2.png => outlined-tray-dark-x2.png} (100%) rename res/{mac-tray-light-x2.png => outlined-tray-light-x2.png} (100%) diff --git a/Cargo.toml b/Cargo.toml index cc72bf48f..4c7161cbb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ flutter = ["flutter_rust_bridge"] default = ["use_dasp"] hwcodec = ["scrap/hwcodec"] mediacodec = ["scrap/mediacodec"] -linux_headless = ["pam" ] +linux_headless = ["pam"] virtual_display_driver = ["virtual_display"] plugin_framework = [] linux-pkg-config = ["magnum-opus/linux-pkg-config", "scrap/linux-pkg-config"] @@ -127,6 +127,8 @@ dbus = "0.9" dbus-crossroads = "0.5" pam = { git="https://github.com/fufesou/pam", optional = true } users = { version = "0.11" } +dark-light = "1.0" + [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.13" diff --git a/res/mac-tray-dark-x2.png b/res/outlined-tray-dark-x2.png similarity index 100% rename from res/mac-tray-dark-x2.png rename to res/outlined-tray-dark-x2.png diff --git a/res/mac-tray-light-x2.png b/res/outlined-tray-light-x2.png similarity index 100% rename from res/mac-tray-light-x2.png rename to res/outlined-tray-light-x2.png diff --git a/src/tray.rs b/src/tray.rs index 092f1edd5..0486615f6 100644 --- a/src/tray.rs +++ b/src/tray.rs @@ -12,17 +12,17 @@ pub fn make_tray() -> hbb_common::ResultType<()> { TrayEvent, TrayIconBuilder, }; let icon; - #[cfg(target_os = "macos")] + #[cfg(any(target_os = "macos", target_os = "linux"))] { let mode = dark_light::detect(); - const LIGHT: &[u8] = include_bytes!("../res/mac-tray-light-x2.png"); - const DARK: &[u8] = include_bytes!("../res/mac-tray-dark-x2.png"); + const LIGHT: &[u8] = include_bytes!("../res/outlined-tray-light-x2.png"); + const DARK: &[u8] = include_bytes!("../res/outlined-tray-dark-x2.png"); icon = match mode { dark_light::Mode::Dark => LIGHT, _ => DARK, }; } - #[cfg(not(target_os = "macos"))] + #[cfg(target_os = "windows")] { icon = include_bytes!("../res/tray-icon.ico"); } @@ -74,6 +74,7 @@ pub fn make_tray() -> hbb_common::ResultType<()> { .spawn() .ok(); } + // xdg-open? #[cfg(target_os = "linux")] if !std::process::Command::new("xdg-open") .arg("rustdesk://")