diff --git a/Cargo.lock b/Cargo.lock index 6807a54..e176962 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1077,7 +1077,7 @@ dependencies = [ [[package]] name = "cosmic-config" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "atomicwrites 0.4.2", "cosmic-config-derive", @@ -1096,7 +1096,7 @@ dependencies = [ [[package]] name = "cosmic-config-derive" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "quote", "syn 1.0.109", @@ -1128,7 +1128,7 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "almost", "cosmic-config", @@ -2493,7 +2493,7 @@ dependencies = [ [[package]] name = "iced" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "dnd", "iced_accessibility", @@ -2511,7 +2511,7 @@ dependencies = [ [[package]] name = "iced_accessibility" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "accesskit", "accesskit_winit", @@ -2520,7 +2520,7 @@ dependencies = [ [[package]] name = "iced_core" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "bitflags 2.6.0", "bytes", @@ -2543,7 +2543,7 @@ dependencies = [ [[package]] name = "iced_futures" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "futures", "iced_core", @@ -2569,7 +2569,7 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "bitflags 2.6.0", "bytemuck", @@ -2591,7 +2591,7 @@ dependencies = [ [[package]] name = "iced_renderer" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -2603,7 +2603,7 @@ dependencies = [ [[package]] name = "iced_runtime" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "bytes", "dnd", @@ -2617,7 +2617,7 @@ dependencies = [ [[package]] name = "iced_tiny_skia" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "bytemuck", "cosmic-text", @@ -2633,7 +2633,7 @@ dependencies = [ [[package]] name = "iced_wgpu" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "as-raw-xcb-connection", "bitflags 2.6.0", @@ -2664,7 +2664,7 @@ dependencies = [ [[package]] name = "iced_widget" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "dnd", "iced_renderer", @@ -2681,7 +2681,7 @@ dependencies = [ [[package]] name = "iced_winit" version = "0.14.0-dev" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "dnd", "iced_futures", @@ -3001,7 +3001,7 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libcosmic" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic.git#d8357d0ea3a60b28ed7fa115604b97077f5b62b8" +source = "git+https://github.com/pop-os/libcosmic.git#a355a049d917823dafcd6669cad6afa6983bc6c6" dependencies = [ "apply", "ashpd 0.9.1", diff --git a/Cargo.toml b/Cargo.toml index 626206c..7bb9e5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ thiserror = "1.0.65" [dependencies.libcosmic] git = "https://github.com/pop-os/libcosmic.git" default-features = false -features = ["multi-window", "tokio", "winit", "wgpu", "desktop"] +features = ["multi-window", "tokio", "winit", "wgpu", "about"] [dependencies.i18n-embed] version = "0.14" diff --git a/src/app.rs b/src/app.rs index 7e609b3..c25662a 100644 --- a/src/app.rs +++ b/src/app.rs @@ -7,6 +7,7 @@ use crate::core::models::Task; use crate::core::service::{Provider, TaskService}; use chrono::{Local, NaiveDate}; use cli_clipboard::{ClipboardContext, ClipboardProvider}; +use cosmic::app::context_drawer::ContextDrawer; use cosmic::app::{message, Core, Message as CosmicMessage}; use cosmic::cosmic_config::Update; use cosmic::cosmic_theme::ThemeMode; @@ -62,6 +63,7 @@ pub enum Message { ToggleContextPage(ContextPage), Application(ApplicationAction), Open(String), + ContextToggle, } #[derive(Debug, Clone)] @@ -272,15 +274,24 @@ impl Application for Tasks { (app, app::Task::batch(tasks)) } - fn context_drawer(&self) -> Option> { + fn context_drawer(&self) -> Option> { if !self.core.window.show_context { return None; } Some(match self.context_page { - ContextPage::About => widget::about(&self.about, Message::Open), - ContextPage::Settings => self.settings(), - ContextPage::TaskDetails => self.details.view().map(Message::Details), + ContextPage::About => { + app::context_drawer::about(&self.about, Message::Open, Message::ContextToggle) + } + ContextPage::Settings => { + app::context_drawer::context_drawer(self.settings(), Message::ContextToggle) + .title(self.context_page.title()) + } + ContextPage::TaskDetails => app::context_drawer::context_drawer( + self.details.view().map(Message::Details), + Message::ContextToggle, + ) + .title(self.context_page.title()), }) } @@ -469,13 +480,13 @@ impl Application for Tasks { } } Message::ToggleContextPage(context_page) => { - if self.context_page == context_page { - self.core.window.show_context = !self.core.window.show_context; - } else { - self.context_page = context_page.clone(); - self.core.window.show_context = true; + if self.context_page != context_page { + self.context_page = context_page; } - self.set_context_title(context_page.clone().title()); + tasks.push(self.update(Message::ContextToggle)); + } + Message::ContextToggle => { + self.core.window.show_context = !self.core.window.show_context } Message::Dialog(dialog_action) => match dialog_action { DialogAction::Open(page) => {