fix(displays): do not show display options when display is disabled

This commit is contained in:
Michael Aaron Murphy 2024-04-11 19:21:15 +02:00 committed by Michael Murphy
parent b5789e5c6c
commit f3d09b943f

View file

@ -9,6 +9,7 @@ use crate::{app, pages};
use arrangement::Arrangement; use arrangement::Arrangement;
use cosmic::iced::{Alignment, Length}; use cosmic::iced::{Alignment, Length};
use cosmic::iced_widget::scrollable::{Direction, Properties, RelativeOffset}; use cosmic::iced_widget::scrollable::{Direction, Properties, RelativeOffset};
use cosmic::prelude::CollectionWidget;
use cosmic::widget::{ use cosmic::widget::{
column, container, dropdown, list_column, segmented_button, tab_bar, toggler, column, container, dropdown, list_column, segmented_button, tab_bar, toggler,
}; };
@ -414,7 +415,8 @@ impl Page {
let active_output = &self.list.outputs[active_id]; let active_output = &self.list.outputs[active_id];
let display_options = list_column() let display_options = active_output.enabled.then(|| {
list_column()
.add(cosmic::widget::settings::item( .add(cosmic::widget::settings::item(
&*text::DISPLAY_RESOLUTION, &*text::DISPLAY_RESOLUTION,
dropdown( dropdown(
@ -453,7 +455,8 @@ impl Page {
}) })
}, },
), ),
)); ))
});
let mut content = column().spacing(theme.cosmic().space_m()); let mut content = column().spacing(theme.cosmic().space_m());
@ -472,7 +475,7 @@ impl Page {
content content
.push(cosmic::widget::text::heading(&*text::DISPLAY_OPTIONS)) .push(cosmic::widget::text::heading(&*text::DISPLAY_OPTIONS))
.push(display_options) .push_maybe(display_options)
.apply(Element::from) .apply(Element::from)
.map(pages::Message::Displays) .map(pages::Message::Displays)
} }