From 62eeb5a704bc7aadd32ddb4a7f8b691e60a5126c Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Fri, 26 Apr 2024 01:02:31 -0400 Subject: [PATCH] wip: overflow --- Cargo.toml | 4 ++ .../data/com.system76.CosmicAppList.desktop | 2 + cosmic-applet-audio/src/lib.rs | 48 ++++++++++++++++++- cosmic-applet-power/Cargo.toml | 1 + cosmic-applet-power/src/lib.rs | 1 + 5 files changed, 55 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 40321a5d..8b695bd7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,7 +58,11 @@ serde = { version = "1.0.152", features = ["derive"] } freedesktop-desktop-entry = "0.6.1" [profile.release] +<<<<<<< Updated upstream lto = "fat" +======= +opt-level = 1 +>>>>>>> Stashed changes [workspace.metadata.cargo-machete] ignored = ["libcosmic"] diff --git a/cosmic-app-list/data/com.system76.CosmicAppList.desktop b/cosmic-app-list/data/com.system76.CosmicAppList.desktop index f96eb44b..f1683646 100644 --- a/cosmic-app-list/data/com.system76.CosmicAppList.desktop +++ b/cosmic-app-list/data/com.system76.CosmicAppList.desktop @@ -11,4 +11,6 @@ StartupNotify=true NoDisplay=true X-CosmicApplet=true X-MinimizeApplet=5 +# Indicate that the applet should be shrunk if the panel is too small to fit it +X-ShrinkApplet=100 X-HostWaylandDisplay=true diff --git a/cosmic-applet-audio/src/lib.rs b/cosmic-applet-audio/src/lib.rs index d94ccf02..cba8bc7b 100644 --- a/cosmic-applet-audio/src/lib.rs +++ b/cosmic-applet-audio/src/lib.rs @@ -6,6 +6,26 @@ mod mouse_area; use crate::{localize::localize, pulse::DeviceInfo}; use config::AudioAppletConfig; +use cosmic::cctk::sctk::reexports::calloop; +use cosmic::cctk::sctk::reexports::protocols::xdg::shell::client::xdg_positioner::Anchor; +use cosmic::cosmic_config::CosmicConfigEntry; +use cosmic::iced::widget; +use cosmic::iced::Limits; +use cosmic::iced::Point; +use cosmic::iced::Rectangle; +use cosmic::iced::{ + self, + widget::{column, row, slider, text}, + window, Alignment, Length, Size, Subscription, +}; +use cosmic::iced_runtime::core::alignment::Horizontal; +use cosmic::iced_style::application; +use cosmic::widget::button; +use cosmic::widget::horizontal_space; +use cosmic::widget::Column; +use cosmic::widget::Row; +use cosmic::widget::{divider, icon}; +use cosmic::Renderer; use cosmic::{ app::Command, applet::{ @@ -25,6 +45,7 @@ use cosmic::{ widget::{button, divider, horizontal_space, icon, Column, Row}, Element, Renderer, Theme, }; +use cosmic::{Element, Theme}; use cosmic_settings_subscriptions::pulse as sub_pulse; use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline}; use iced::{ @@ -136,6 +157,7 @@ pub enum Message { Token(TokenUpdate), OpenSettings, PulseSub(sub_pulse::Event), + Popup2, } impl Audio { @@ -618,6 +640,30 @@ impl cosmic::Application for Audio { } } }, + Message::Popup2 => { + if let Some(p) = self.popup.as_ref() { + let mut popup_settings = self.core.applet.get_popup_settings( + p.clone(), + window::Id::unique(), + None, + None, + None, + ); + popup_settings.positioner.anchor = Anchor::Left; + popup_settings.positioner.anchor_rect = Rectangle:: { + x: 50, + y: 50, + width: 200, + height: 200, + }; + popup_settings.positioner.size_limits = Limits::NONE + .min_height(1.0) + .min_width(1.0) + .max_width(300.0) + .max_height(400.0); + return get_popup(popup_settings); + } + } }; Command::none() @@ -863,7 +909,7 @@ impl cosmic::Application for Audio { ) .padding([0, 24]), padded_control(divider::horizontal::default()), - menu_button(text(fl!("sound-settings")).size(14)).on_press(Message::OpenSettings) + menu_button(text(fl!("sound-settings")).size(14)).on_press(Message::Popup2) ] .align_items(Alignment::Start) .padding([8, 0]); diff --git a/cosmic-applet-power/Cargo.toml b/cosmic-applet-power/Cargo.toml index 2fffa0de..5a8251be 100644 --- a/cosmic-applet-power/Cargo.toml +++ b/cosmic-applet-power/Cargo.toml @@ -16,3 +16,4 @@ tracing-log.workspace = true tracing-subscriber.workspace = true tracing.workspace = true zbus.workspace = true +tokio = { version = "1.36.0", features = ["sync", "macros"] } diff --git a/cosmic-applet-power/src/lib.rs b/cosmic-applet-power/src/lib.rs index a868713a..3ef2f8a3 100644 --- a/cosmic-applet-power/src/lib.rs +++ b/cosmic-applet-power/src/lib.rs @@ -115,6 +115,7 @@ impl cosmic::Application for Power { } fn init(core: cosmic::app::Core, _flags: ()) -> (Self, Command) { + panic!("init"); ( Self { core,