mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-23 19:49:05 +08:00
hide-tray option
This commit is contained in:
parent
96edca8f74
commit
2f432e941d
@ -69,7 +69,7 @@ lazy_static::lazy_static! {
|
||||
pub static ref DEFAULT_LOCAL_SETTINGS: RwLock<HashMap<String, String>> = Default::default();
|
||||
pub static ref OVERWRITE_LOCAL_SETTINGS: RwLock<HashMap<String, String>> = Default::default();
|
||||
pub static ref HARD_SETTINGS: RwLock<HashMap<String, String>> = Default::default();
|
||||
pub static ref BUILDIN_SETTINGS: RwLock<HashMap<String, String>> = Default::default();
|
||||
pub static ref BUILTIN_SETTINGS: RwLock<HashMap<String, String>> = Default::default();
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
@ -2114,6 +2114,7 @@ pub mod keys {
|
||||
pub const OPTION_HIDE_USERNAME_ON_CARD: &str = "hide-username-on-card";
|
||||
pub const OPTION_HIDE_HELP_CARDS: &str = "hide-help-cards";
|
||||
pub const OPTION_DEFAULT_CONNECT_PASSWORD: &str = "default-connect-password";
|
||||
pub const OPTION_HIDE_TRAY: &str = "hide-tray";
|
||||
|
||||
// flutter local options
|
||||
pub const OPTION_FLUTTER_REMOTE_MENUBAR_STATE: &str = "remoteMenubarState";
|
||||
@ -2256,6 +2257,7 @@ pub mod keys {
|
||||
OPTION_HIDE_USERNAME_ON_CARD,
|
||||
OPTION_HIDE_HELP_CARDS,
|
||||
OPTION_DEFAULT_CONNECT_PASSWORD,
|
||||
OPTION_HIDE_TRAY,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ use crate::{
|
||||
check_port,
|
||||
common::input::{MOUSE_BUTTON_LEFT, MOUSE_BUTTON_RIGHT, MOUSE_TYPE_DOWN, MOUSE_TYPE_UP},
|
||||
create_symmetric_key_msg, decode_id_pk, get_rs_pk, is_keyboard_mode_supported, secure_tcp,
|
||||
ui_interface::{get_buildin_option, use_texture_render},
|
||||
ui_interface::{get_builtin_option, use_texture_render},
|
||||
ui_session_interface::{InvokeUiSession, Session},
|
||||
};
|
||||
|
||||
@ -2137,7 +2137,7 @@ impl LoginConfigHandler {
|
||||
} else {
|
||||
(my_id, self.id.clone())
|
||||
};
|
||||
let mut display_name = get_buildin_option(config::keys::OPTION_DISPLAY_NAME);
|
||||
let mut display_name = get_builtin_option(config::keys::OPTION_DISPLAY_NAME);
|
||||
if display_name.is_empty() {
|
||||
display_name =
|
||||
serde_json::from_str::<serde_json::Value>(&LocalConfig::get_option("user_info"))
|
||||
@ -2920,7 +2920,7 @@ pub async fn handle_hash(
|
||||
|
||||
if password.is_empty() {
|
||||
let p =
|
||||
crate::ui_interface::get_buildin_option(config::keys::OPTION_DEFAULT_CONNECT_PASSWORD);
|
||||
crate::ui_interface::get_builtin_option(config::keys::OPTION_DEFAULT_CONNECT_PASSWORD);
|
||||
if !p.is_empty() {
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update(p.clone());
|
||||
|
@ -1359,7 +1359,7 @@ fn read_custom_client_advanced_settings(
|
||||
} else {
|
||||
config::DEFAULT_SETTINGS.write().unwrap()
|
||||
};
|
||||
let mut buildin_settings = config::BUILDIN_SETTINGS.write().unwrap();
|
||||
let mut buildin_settings = config::BUILTIN_SETTINGS.write().unwrap();
|
||||
|
||||
if let Some(settings) = settings.as_object() {
|
||||
for (k, v) in settings {
|
||||
|
@ -2220,7 +2220,7 @@ pub fn main_get_hard_option(key: String) -> SyncReturn<String> {
|
||||
}
|
||||
|
||||
pub fn main_get_buildin_option(key: String) -> SyncReturn<String> {
|
||||
SyncReturn(get_buildin_option(&key))
|
||||
SyncReturn(get_builtin_option(&key))
|
||||
}
|
||||
|
||||
pub fn main_check_hwcodec() {
|
||||
|
@ -5,7 +5,7 @@ use std::{
|
||||
};
|
||||
|
||||
#[cfg(not(any(target_os = "ios")))]
|
||||
use crate::{ui_interface::get_buildin_option, Connection};
|
||||
use crate::{ui_interface::get_builtin_option, Connection};
|
||||
use hbb_common::{
|
||||
config::{keys, Config, LocalConfig},
|
||||
tokio::{self, sync::broadcast, time::Instant},
|
||||
@ -91,11 +91,11 @@ async fn start_hbbs_sync_async() {
|
||||
if !ab_tag.is_empty() {
|
||||
v[keys::OPTION_PRESET_ADDRESS_BOOK_TAG] = json!(ab_tag);
|
||||
}
|
||||
let username = get_buildin_option(keys::OPTION_PRESET_USERNAME);
|
||||
let username = get_builtin_option(keys::OPTION_PRESET_USERNAME);
|
||||
if !username.is_empty() {
|
||||
v[keys::OPTION_PRESET_USERNAME] = json!(username);
|
||||
}
|
||||
let strategy_name = get_buildin_option(keys::OPTION_PRESET_STRATEGY_NAME);
|
||||
let strategy_name = get_builtin_option(keys::OPTION_PRESET_STRATEGY_NAME);
|
||||
if !strategy_name.is_empty() {
|
||||
v[keys::OPTION_PRESET_STRATEGY_NAME] = json!(strategy_name);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ use hbb_common::{
|
||||
use crate::{
|
||||
check_port,
|
||||
server::{check_zombie, new as new_server, ServerPtr},
|
||||
ui_interface::get_buildin_option,
|
||||
ui_interface::get_builtin_option,
|
||||
};
|
||||
|
||||
type Message = RendezvousMessage;
|
||||
@ -391,7 +391,7 @@ impl RendezvousMediator {
|
||||
};
|
||||
if (cfg!(debug_assertions) && option_env!("TEST_TCP").is_some())
|
||||
|| is_http_proxy
|
||||
|| get_buildin_option(config::keys::OPTION_DISABLE_UDP) == "Y"
|
||||
|| get_builtin_option(config::keys::OPTION_DISABLE_UDP) == "Y"
|
||||
{
|
||||
Self::start_tcp(server, host).await
|
||||
} else {
|
||||
|
10
src/tray.rs
10
src/tray.rs
@ -9,6 +9,16 @@ use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
|
||||
pub fn start_tray() {
|
||||
if crate::ui_interface::get_builtin_option(hbb_common::config::keys::OPTION_HIDE_TRAY) == "Y" {
|
||||
if cfg!(target_os = "macos") {
|
||||
crate::platform::macos::hide_dock();
|
||||
loop {
|
||||
std::thread::sleep(std::time::Duration::from_secs(1));
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
allow_err!(make_tray());
|
||||
}
|
||||
|
||||
|
@ -206,8 +206,8 @@ pub fn get_hard_option(key: String) -> String {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_buildin_option(key: &str) -> String {
|
||||
config::BUILDIN_SETTINGS
|
||||
pub fn get_builtin_option(key: &str) -> String {
|
||||
config::BUILTIN_SETTINGS
|
||||
.read()
|
||||
.unwrap()
|
||||
.get(key)
|
||||
@ -781,6 +781,7 @@ pub fn http_request(url: String, method: String, body: Option<String>, header: S
|
||||
current_request.lock().unwrap().insert(url, res);
|
||||
});
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_async_http_status(url: String) -> Option<String> {
|
||||
match ASYNC_HTTP_STATUS.lock().unwrap().get(&url) {
|
||||
|
Loading…
Reference in New Issue
Block a user