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 DEFAULT_LOCAL_SETTINGS: RwLock<HashMap<String, String>> = Default::default();
|
||||||
pub static ref OVERWRITE_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 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! {
|
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_USERNAME_ON_CARD: &str = "hide-username-on-card";
|
||||||
pub const OPTION_HIDE_HELP_CARDS: &str = "hide-help-cards";
|
pub const OPTION_HIDE_HELP_CARDS: &str = "hide-help-cards";
|
||||||
pub const OPTION_DEFAULT_CONNECT_PASSWORD: &str = "default-connect-password";
|
pub const OPTION_DEFAULT_CONNECT_PASSWORD: &str = "default-connect-password";
|
||||||
|
pub const OPTION_HIDE_TRAY: &str = "hide-tray";
|
||||||
|
|
||||||
// flutter local options
|
// flutter local options
|
||||||
pub const OPTION_FLUTTER_REMOTE_MENUBAR_STATE: &str = "remoteMenubarState";
|
pub const OPTION_FLUTTER_REMOTE_MENUBAR_STATE: &str = "remoteMenubarState";
|
||||||
@ -2256,6 +2257,7 @@ pub mod keys {
|
|||||||
OPTION_HIDE_USERNAME_ON_CARD,
|
OPTION_HIDE_USERNAME_ON_CARD,
|
||||||
OPTION_HIDE_HELP_CARDS,
|
OPTION_HIDE_HELP_CARDS,
|
||||||
OPTION_DEFAULT_CONNECT_PASSWORD,
|
OPTION_DEFAULT_CONNECT_PASSWORD,
|
||||||
|
OPTION_HIDE_TRAY,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ use crate::{
|
|||||||
check_port,
|
check_port,
|
||||||
common::input::{MOUSE_BUTTON_LEFT, MOUSE_BUTTON_RIGHT, MOUSE_TYPE_DOWN, MOUSE_TYPE_UP},
|
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,
|
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},
|
ui_session_interface::{InvokeUiSession, Session},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2137,7 +2137,7 @@ impl LoginConfigHandler {
|
|||||||
} else {
|
} else {
|
||||||
(my_id, self.id.clone())
|
(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() {
|
if display_name.is_empty() {
|
||||||
display_name =
|
display_name =
|
||||||
serde_json::from_str::<serde_json::Value>(&LocalConfig::get_option("user_info"))
|
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() {
|
if password.is_empty() {
|
||||||
let p =
|
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() {
|
if !p.is_empty() {
|
||||||
let mut hasher = Sha256::new();
|
let mut hasher = Sha256::new();
|
||||||
hasher.update(p.clone());
|
hasher.update(p.clone());
|
||||||
|
@ -1359,7 +1359,7 @@ fn read_custom_client_advanced_settings(
|
|||||||
} else {
|
} else {
|
||||||
config::DEFAULT_SETTINGS.write().unwrap()
|
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() {
|
if let Some(settings) = settings.as_object() {
|
||||||
for (k, v) in settings {
|
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> {
|
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() {
|
pub fn main_check_hwcodec() {
|
||||||
|
@ -5,7 +5,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "ios")))]
|
#[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::{
|
use hbb_common::{
|
||||||
config::{keys, Config, LocalConfig},
|
config::{keys, Config, LocalConfig},
|
||||||
tokio::{self, sync::broadcast, time::Instant},
|
tokio::{self, sync::broadcast, time::Instant},
|
||||||
@ -91,11 +91,11 @@ async fn start_hbbs_sync_async() {
|
|||||||
if !ab_tag.is_empty() {
|
if !ab_tag.is_empty() {
|
||||||
v[keys::OPTION_PRESET_ADDRESS_BOOK_TAG] = json!(ab_tag);
|
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() {
|
if !username.is_empty() {
|
||||||
v[keys::OPTION_PRESET_USERNAME] = json!(username);
|
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() {
|
if !strategy_name.is_empty() {
|
||||||
v[keys::OPTION_PRESET_STRATEGY_NAME] = json!(strategy_name);
|
v[keys::OPTION_PRESET_STRATEGY_NAME] = json!(strategy_name);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ use hbb_common::{
|
|||||||
use crate::{
|
use crate::{
|
||||||
check_port,
|
check_port,
|
||||||
server::{check_zombie, new as new_server, ServerPtr},
|
server::{check_zombie, new as new_server, ServerPtr},
|
||||||
ui_interface::get_buildin_option,
|
ui_interface::get_builtin_option,
|
||||||
};
|
};
|
||||||
|
|
||||||
type Message = RendezvousMessage;
|
type Message = RendezvousMessage;
|
||||||
@ -391,7 +391,7 @@ impl RendezvousMediator {
|
|||||||
};
|
};
|
||||||
if (cfg!(debug_assertions) && option_env!("TEST_TCP").is_some())
|
if (cfg!(debug_assertions) && option_env!("TEST_TCP").is_some())
|
||||||
|| is_http_proxy
|
|| 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
|
Self::start_tcp(server, host).await
|
||||||
} else {
|
} else {
|
||||||
|
10
src/tray.rs
10
src/tray.rs
@ -9,6 +9,16 @@ use std::sync::{Arc, Mutex};
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
pub fn start_tray() {
|
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());
|
allow_err!(make_tray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,8 +206,8 @@ pub fn get_hard_option(key: String) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_buildin_option(key: &str) -> String {
|
pub fn get_builtin_option(key: &str) -> String {
|
||||||
config::BUILDIN_SETTINGS
|
config::BUILTIN_SETTINGS
|
||||||
.read()
|
.read()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.get(key)
|
.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);
|
current_request.lock().unwrap().insert(url, res);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_async_http_status(url: String) -> Option<String> {
|
pub fn get_async_http_status(url: String) -> Option<String> {
|
||||||
match ASYNC_HTTP_STATUS.lock().unwrap().get(&url) {
|
match ASYNC_HTTP_STATUS.lock().unwrap().get(&url) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user