try out hide_docker

This commit is contained in:
rustdesk 2023-01-09 13:59:33 +08:00
parent 3f53146c7e
commit 9648c57f67
2 changed files with 10 additions and 0 deletions

View File

@ -193,6 +193,7 @@ pub fn core_main() -> Option<Vec<String>> {
#[cfg(target_os = "macos")]
{
std::thread::spawn(move || crate::start_server(true));
crate::platform::macos::hide_dock();
crate::tray::make_tray();
return None;
}
@ -242,6 +243,8 @@ pub fn core_main() -> Option<Vec<String>> {
#[cfg(feature = "flutter")]
crate::flutter::connection_manager::start_listen_ipc_thread();
crate::ui_interface::start_option_status_sync();
#[cfg(target_os = "macos")]
crate::platform::macos::hide_dock();
}
}
//_async_logger_holder.map(|x| x.flush());

View File

@ -4,6 +4,7 @@
use super::{CursorData, ResultType};
use cocoa::{
appkit::{NSApp, NSApplication, NSApplicationActivationPolicy::*},
base::{id, nil, BOOL, NO, YES},
foundation::{NSDictionary, NSPoint, NSSize, NSString},
};
@ -550,3 +551,9 @@ pub fn get_double_click_time() -> u32 {
// to-do: https://github.com/servo/core-foundation-rs/blob/786895643140fa0ee4f913d7b4aeb0c4626b2085/cocoa/src/appkit.rs#L2823
500 as _
}
pub fn hide_dock() {
unsafe {
NSApp().setActivationPolicy_(NSApplicationActivationPolicyAccessory);
}
}