mirror of
https://github.com/bitwarden/browser
synced 2026-01-06 02:23:44 +00:00
[BEEEP/PM-8492] Add autostart for flatpak (#12016)
* Add autostart for flatpak via ashpd * Fix clippy errors * Cargo fmt * Fix clippy
This commit is contained in:
@@ -85,6 +85,7 @@ desktop_objc = { path = "../objc" }
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
oo7 = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
ashpd = { workspace = true }
|
||||
|
||||
zbus = { workspace = true, optional = true }
|
||||
zbus_polkit = { workspace = true, optional = true }
|
||||
|
||||
21
apps/desktop/desktop_native/core/src/autostart/linux.rs
Normal file
21
apps/desktop/desktop_native/core/src/autostart/linux.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use anyhow::Result;
|
||||
use ashpd::desktop::background::Background;
|
||||
|
||||
pub async fn set_autostart(autostart: bool, params: Vec<String>) -> Result<()> {
|
||||
let request = if params.is_empty() {
|
||||
Background::request().auto_start(autostart)
|
||||
} else {
|
||||
Background::request().command(params).auto_start(autostart)
|
||||
};
|
||||
|
||||
match request.send().await.and_then(|r| r.response()) {
|
||||
Ok(response) => {
|
||||
println!("[ASHPD] Autostart enabled: {:?}", response);
|
||||
Ok(())
|
||||
}
|
||||
Err(err) => {
|
||||
println!("[ASHPD] Error enabling autostart: {}", err);
|
||||
Err(anyhow::anyhow!("error enabling autostart {}", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
5
apps/desktop/desktop_native/core/src/autostart/mod.rs
Normal file
5
apps/desktop/desktop_native/core/src/autostart/mod.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
#[cfg_attr(target_os = "linux", path = "linux.rs")]
|
||||
#[cfg_attr(target_os = "windows", path = "unimplemented.rs")]
|
||||
#[cfg_attr(target_os = "macos", path = "unimplemented.rs")]
|
||||
mod autostart_impl;
|
||||
pub use autostart_impl::*;
|
||||
@@ -0,0 +1,5 @@
|
||||
use anyhow::Result;
|
||||
|
||||
pub async fn set_autostart(_autostart: bool, _params: Vec<String>) -> Result<()> {
|
||||
unimplemented!();
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod autofill;
|
||||
pub mod autostart;
|
||||
pub mod biometric;
|
||||
pub mod clipboard;
|
||||
pub mod crypto;
|
||||
|
||||
Reference in New Issue
Block a user