Commit 780b42d0 authored by kingtous's avatar kingtous

feat: adapt macos dark mode

parent 694578d2
This diff is collapsed.
......@@ -95,6 +95,7 @@ core-foundation = "0.9"
core-graphics = "0.22"
include_dir = "0.7.2"
tray-item = "0.7" # looks better than trayicon
dark-light = "0.2"
[target.'cfg(target_os = "linux")'.dependencies]
psimple = { package = "libpulse-simple-binding", version = "2.25" }
......@@ -138,7 +139,7 @@ identifier = "com.carriez.rustdesk"
icon = ["32x32.png", "128x128.png", "128x128@2x.png"]
deb_depends = ["libgtk-3-0", "libxcb-randr0", "libxdo3", "libxfixes3", "libxcb-shape0", "libxcb-xfixes0", "libasound2", "libsystemd0", "pulseaudio", "python3-pip", "curl"]
osx_minimum_system_version = "10.14"
resources = ["mac-tray.png"]
resources = ["mac-tray-light.png","mac-tray-dark.png"]
#https://github.com/johnthagen/min-sized-rust
[profile.release]
......
This diff is collapsed.
......@@ -13,6 +13,7 @@ use objc::{
};
use sciter::{make_args, Host};
use std::{ffi::c_void, rc::Rc};
use dark_light;
static APP_HANDLER_IVAR: &str = "GoDeskAppHandler";
......@@ -233,7 +234,17 @@ pub fn make_tray() {
set_delegate(None);
}
use tray_item::TrayItem;
if let Ok(mut tray) = TrayItem::new(&crate::get_app_name(), "mac-tray.png") {
let mode = dark_light::detect();
let mut icon_path = "";
match mode {
dark_light::Mode::Dark => {
icon_path = "mac-tray-light.png";
},
dark_light::Mode::Light => {
icon_path = "mac-tray-dark.png";
},
}
if let Ok(mut tray) = TrayItem::new(&crate::get_app_name(), icon_path) {
tray.add_label(&format!(
"{} {}",
crate::get_app_name(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment