From b6f6fba94d910e737978786ca51e802917c089df Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Mon, 3 Aug 2026 01:27:24 -0400 Subject: [PATCH] Open synced folders from COSMIC --- Cargo.lock | 36 +++++++++++++++++++++++++++++++++--- appa-cosmic/Cargo.toml | 1 + appa-cosmic/src/app.rs | 10 ++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f537448..a4137bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -327,6 +327,7 @@ dependencies = [ "anyhow", "appa", "libcosmic", + "open", "tokio", ] @@ -4012,6 +4013,25 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "is-docker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" +dependencies = [ + "once_cell", +] + +[[package]] +name = "is-wsl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" +dependencies = [ + "is-docker", + "once_cell", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.2" @@ -4214,7 +4234,7 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a1886916523694cd6ea3d175f03a1e5010699a2a4cc13696d83d7bea1d80638" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -5367,6 +5387,16 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +[[package]] +name = "open" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0b3d059e795d52b8a72fef45658620edd4d9c359b338564aa14391ffa511ed5" +dependencies = [ + "is-wsl", + "libc", +] + [[package]] name = "openssl-probe" version = "0.2.1" @@ -6486,7 +6516,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.4.15", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -7805,7 +7835,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" dependencies = [ "memoffset", "tempfile", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] diff --git a/appa-cosmic/Cargo.toml b/appa-cosmic/Cargo.toml index bd97cc1..ba2d250 100644 --- a/appa-cosmic/Cargo.toml +++ b/appa-cosmic/Cargo.toml @@ -9,6 +9,7 @@ description = "COSMIC desktop companion for Appa" [dependencies] anyhow = "1.0.104" appa = { path = ".." } +open = "5.3.2" tokio = { version = "1.53.1", features = ["rt-multi-thread"] } [dependencies.libcosmic] diff --git a/appa-cosmic/src/app.rs b/appa-cosmic/src/app.rs index 345a966..67b5180 100644 --- a/appa-cosmic/src/app.rs +++ b/appa-cosmic/src/app.rs @@ -34,6 +34,7 @@ pub enum Message { InvitationCreated(Result), ShowFolder(PathBuf), CloseFolderDetails, + OpenFolder(PathBuf), RequestRevocation { folder_path: PathBuf, device_id: String, @@ -159,6 +160,11 @@ impl cosmic::Application for AppModel { return load_folder_details(path); } Message::CloseFolderDetails => self.details = None, + Message::OpenFolder(path) => { + if let Err(error) = open::that_detached(path) { + self.notice = Some(format!("Could not open the folder: {error}")); + } + } Message::RequestRevocation { folder_path, device_id, @@ -253,6 +259,10 @@ impl AppModel { .push( widget::button::text("Close details").on_press(Message::CloseFolderDetails), ) + .push( + widget::button::text("Open folder") + .on_press(Message::OpenFolder(details.summary.path.clone())), + ) .spacing(cosmic::theme::spacing().space_s), ) .spacing(cosmic::theme::spacing().space_s); -- 2.51.2