From 88e4f3c135b21d7990b5b6b3a6dba11c12c6affb Mon Sep 17 00:00:00 2001 From: Samuel Onoja Date: Wed, 30 Sep 2026 05:57:37 +0100 Subject: [PATCH] Remove duplicate dialog frames and give source lists enough height --- portal/src/consent.rs | 1 + portal/src/picker.rs | 30 ++++++++++++++++++++----- shell/ferese-polkit-agent/src/prompt.rs | 1 + 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/portal/src/consent.rs b/portal/src/consent.rs index e7f1cb6..99c0ddb 100644 --- a/portal/src/consent.rs +++ b/portal/src/consent.rs @@ -104,6 +104,7 @@ impl cosmic::Application for Consent { core.window.show_headerbar = false; core.window.border_padding = Some(0); core.window.content_container = false; + core.window.use_template = false; let app = Self { core, prompt, diff --git a/portal/src/picker.rs b/portal/src/picker.rs index eb495fe..b8e1b68 100644 --- a/portal/src/picker.rs +++ b/portal/src/picker.rs @@ -24,6 +24,25 @@ pub struct Prompt { pub rememberable: Vec, } +impl Prompt { + fn source_list_height(&self) -> f32 { + let visible = &self.sources[..self.sources.len().min(4)]; + let mut sections = 0; + let mut previous_kind = None; + if !self.window_capture { + for source in visible { + let is_window = source.window_id().is_some(); + if previous_kind != Some(is_window) { + sections += 1; + previous_kind = Some(is_window); + } + } + } + let rows = visible.len(); + (rows * 64 + rows.saturating_sub(1) * 6 + sections * 24) as f32 + } +} + #[derive(Serialize, Deserialize)] #[serde(deny_unknown_fields)] pub(crate) struct Selection { @@ -76,9 +95,8 @@ pub fn run() -> Result<(), Box> { } let (theme, font, background, palette) = appearance(); - let height = 180. - + (prompt.sources.len().min(4) as f32 * 56.) - + if prompt.persist_mode > 0 { 64. } else { 0. }; + let height = + 180. + prompt.source_list_height() + if prompt.persist_mode > 0 { 64. } else { 0. }; cosmic::app::run::( Settings::default() .size(cosmic::iced::Size::new(400., height)) @@ -120,6 +138,7 @@ impl cosmic::Application for Picker { core.window.show_headerbar = false; core.window.border_padding = Some(0); core.window.content_container = false; + core.window.use_template = false; // No preselected source: clicking Share must be a deliberate choice. let mut app = Self { core, @@ -310,9 +329,8 @@ impl cosmic::Application for Picker { .on_press(Message::Select(index)), ); } - content = content.push(scrollable(sources).height(Length::Fixed( - (self.prompt.sources.len().min(4) * 56) as f32, - ))); + content = content + .push(scrollable(sources).height(Length::Fixed(self.prompt.source_list_height()))); content = content.push( self.text(if self.prompt.window_capture { "Only the selected window will be captured." diff --git a/shell/ferese-polkit-agent/src/prompt.rs b/shell/ferese-polkit-agent/src/prompt.rs index bab284b..f7c89a2 100644 --- a/shell/ferese-polkit-agent/src/prompt.rs +++ b/shell/ferese-polkit-agent/src/prompt.rs @@ -216,6 +216,7 @@ impl cosmic::Application for Prompt { core.window.show_headerbar = false; core.window.border_padding = Some(0); core.window.content_container = false; + core.window.use_template = false; let height = content_height(&description, None); let bounds = core .main_window_id()