1
0
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:
Bernd Schoolmann
2025-05-26 00:30:52 +02:00
committed by GitHub
parent 23f4af6984
commit 04ed114e0e
10 changed files with 73 additions and 14 deletions

View File

@@ -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 }

View 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))
}
}
}

View 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::*;

View File

@@ -0,0 +1,5 @@
use anyhow::Result;
pub async fn set_autostart(_autostart: bool, _params: Vec<String>) -> Result<()> {
unimplemented!();
}

View File

@@ -1,4 +1,5 @@
pub mod autofill;
pub mod autostart;
pub mod biometric;
pub mod clipboard;
pub mod crypto;