flutter version allow hide cm

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-11-23 09:41:05 +08:00
parent c26e86288d
commit 8b4d50f3fb
37 changed files with 198 additions and 44 deletions

View File

@@ -1571,17 +1571,18 @@ async fn start_ipc(
if let Ok(s) = crate::ipc::connect(1000, "_cm").await {
stream = Some(s);
} else {
let extra_args = if password::hide_cm() { "--hide" } else { "" };
let run_done;
if crate::platform::is_root() {
let mut res = Ok(None);
for _ in 0..10 {
#[cfg(not(target_os = "linux"))]
{
res = crate::platform::run_as_user("--cm");
res = crate::platform::run_as_user(&format!("--cm {}", extra_args));
}
#[cfg(target_os = "linux")]
{
res = crate::platform::run_as_user("--cm", None);
res = crate::platform::run_as_user(&format!("--cm {}", extra_args), None);
}
if res.is_ok() {
break;
@@ -1596,10 +1597,14 @@ async fn start_ipc(
run_done = false;
}
if !run_done {
let mut args = vec!["--cm"];
if !extra_args.is_empty() {
args.push(&extra_args);
}
super::CHILD_PROCESS
.lock()
.unwrap()
.push(crate::run_me(vec!["--cm"])?);
.push(crate::run_me(args)?);
}
for _ in 0..10 {
sleep(0.3).await;

View File

@@ -192,7 +192,7 @@ fn create_capturer(
privacy_mode_id: i32,
display: Display,
use_yuv: bool,
current: usize,
_current: usize,
_portable_service_running: bool,
) -> ResultType<Box<dyn TraitCapturer>> {
#[cfg(not(windows))]
@@ -256,7 +256,7 @@ fn create_capturer(
log::debug!("Create capturer dxgi|gdi");
#[cfg(windows)]
return crate::portable_service::client::create_capturer(
current,
_current,
display,
use_yuv,
_portable_service_running,