Skip to content
Snippets Groups Projects
Unverified Commit 051be927 authored by GyDi's avatar GyDi
Browse files

fix: avoid setting login item repeatedly, close #326

parent 8bad2c21
No related branches found
No related tags found
No related merge requests found
...@@ -182,13 +182,22 @@ impl Sysopt { ...@@ -182,13 +182,22 @@ impl Sysopt {
return Ok(()); return Ok(());
} }
// macos每次启动都更新登录项,避免重复设置登录项
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
let _ = auto.disable(); {
if enable && !auto.is_enabled().unwrap_or(false) {
// 避免重复设置登录项
let _ = auto.disable();
auto.enable()?;
} else if !enable {
let _ = auto.disable();
}
}
#[cfg(not(target_os = "macos"))]
if enable { if enable {
auto.enable()?; auto.enable()?;
} }
*self.auto_launch.lock() = Some(auto); *self.auto_launch.lock() = Some(auto);
Ok(()) Ok(())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment