From d5eb4b83083a442713841584e58754ab3eea0b2e Mon Sep 17 00:00:00 2001 From: Lionel DARNIS Date: Fri, 3 Jul 2026 14:04:49 +0200 Subject: [PATCH] fix: absorb libcosmic theme-v2 API + reqwest stream feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Leyoda 2026 – GPLv3 --- Cargo.toml | 6 +++++- src/main.rs | 12 +++++++----- src/menu.rs | 6 +++--- src/terminal_box.rs | 4 ++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b6bf29e..9f6950a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,10 @@ regex = "1" ron = "0.11" serde = { version = "1", features = ["serde_derive"] } shlex = "1" -tokio = { version = "1", features = ["sync"] } +tokio = { version = "1", features = ["sync", "rt", "macros", "time"] } +# HTTP client for Modjo AI integration +reqwest = { version = "0.12", features = ["json", "stream"], optional = true } +serde_json = { version = "1", optional = true } # CLI arguments clap_lex = "0.7" # Internationalization @@ -62,6 +65,7 @@ dbus-config = ["cosmic/dbus-config"] wgpu = ["cosmic/wgpu", "cosmic-files/wgpu"] wayland = ["cosmic/wayland", "cosmic-files/wayland"] password_manager = ["secret-service", "thiserror", "secstr"] +modjo = ["dep:reqwest", "dep:serde_json"] [profile.release-with-debug] inherits = "release" diff --git a/src/main.rs b/src/main.rs index 52d0635..005cbc3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -688,7 +688,7 @@ impl App { // Update terminal window background color { - let color = Color::from(theme.cosmic().background.base); + let color = Color::from(theme.cosmic().background(false).base); let bytes = color.into_rgba8(); let data = u32::from(bytes[2]) | (u32::from(bytes[1]) << 8) @@ -2968,7 +2968,9 @@ impl Application for App { let pos_y = _position.y as i32; tasks.push(cosmic::task::message(Message::Surface( - cosmic::surface::action::app_popup(move |_app: &mut Self| { + cosmic::surface::action::app_popup( + |_: &Self| cosmic::surface::action::LiveSettings::default(), + move |_app: &mut Self| { use cosmic::cctk::wayland_protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity}; use cosmic::iced::runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner}; @@ -3542,9 +3544,9 @@ impl Application for App { .class(style::Container::Custom(Box::new(|theme| { let cosmic = theme.cosmic(); cosmic::iced::widget::container::Style { - icon_color: Some(Color::from(cosmic.background.on)), - text_color: Some(Color::from(cosmic.background.on)), - background: Some(iced::Background::Color(cosmic.background.base.into())), + icon_color: Some(Color::from(cosmic.background(false).on)), + text_color: Some(Color::from(cosmic.background(false).on)), + background: Some(iced::Background::Color(cosmic.background(false).base.into())), border: iced::Border::default(), shadow: iced::Shadow::default(), snap: true, diff --git a/src/menu.rs b/src/menu.rs index 7b03d59..57c03ca 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -45,7 +45,7 @@ pub fn context_menu<'a>( String::new() }; fn key_style(theme: &cosmic::Theme) -> TextStyle { - let mut color = theme.cosmic().background.component.on; + let mut color = theme.cosmic().background(false).component.on; color.alpha *= 0.75; TextStyle { color: Some(color.into()), @@ -131,7 +131,7 @@ pub fn context_menu<'a>( //TODO: move style to libcosmic .style(|theme| { let cosmic = theme.cosmic(); - let component = &cosmic.background.component; + let component = &cosmic.background(false).component; widget::container::Style { icon_color: Some(component.on.into()), text_color: Some(component.on.into()), @@ -179,7 +179,7 @@ pub fn color_scheme_menu<'a>( //TODO: move style to libcosmic .style(|theme| { let cosmic = theme.cosmic(); - let component = &cosmic.background.component; + let component = &cosmic.background(false).component; widget::container::Style { icon_color: Some(component.on.into()), text_color: Some(component.on.into()), diff --git a/src/terminal_box.rs b/src/terminal_box.rs index 92947e6..1b00e31 100644 --- a/src/terminal_box.rs +++ b/src/terminal_box.rs @@ -756,7 +756,7 @@ where let scrollbar_color: Color = if pressed { // pressed_state_color, 0.5 cosmic_theme - .background + .background(false) .component .pressed .without_alpha() @@ -766,7 +766,7 @@ where } else if hover { // hover_state_color, 0.2 cosmic_theme - .background + .background(false) .component .hover .without_alpha()