fix(wallpaper): show tab bar only when outputs > 1
This commit is contained in:
parent
8b7bab93cf
commit
2d7b635007
1 changed files with 15 additions and 9 deletions
|
|
@ -138,6 +138,9 @@ pub enum Category {
|
||||||
|
|
||||||
/// The page struct for the wallpaper view.
|
/// The page struct for the wallpaper view.
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
|
/// Whether to show the tab_bar or not.
|
||||||
|
show_tab_bar: bool,
|
||||||
|
|
||||||
/// The display that is currently being configured.
|
/// The display that is currently being configured.
|
||||||
///
|
///
|
||||||
/// If set to `None`, all displays will have the same wallpaper.
|
/// If set to `None`, all displays will have the same wallpaper.
|
||||||
|
|
@ -222,6 +225,7 @@ impl page::AutoBind<crate::pages::Message> for Page {}
|
||||||
impl Default for Page {
|
impl Default for Page {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let mut page = Page {
|
let mut page = Page {
|
||||||
|
show_tab_bar: false,
|
||||||
active_output: None,
|
active_output: None,
|
||||||
cached_display_handle: None,
|
cached_display_handle: None,
|
||||||
categories: {
|
categories: {
|
||||||
|
|
@ -856,6 +860,7 @@ impl Page {
|
||||||
self.outputs.clear();
|
self.outputs.clear();
|
||||||
self.wallpaper_service_config = update.service_config;
|
self.wallpaper_service_config = update.service_config;
|
||||||
self.selection = update.selection;
|
self.selection = update.selection;
|
||||||
|
self.show_tab_bar = update.displays.len() > 1;
|
||||||
|
|
||||||
// Sync custom colors from config.
|
// Sync custom colors from config.
|
||||||
for color in self.config.custom_colors() {
|
for color in self.config.custom_colors() {
|
||||||
|
|
@ -1109,8 +1114,8 @@ pub fn settings() -> Section<crate::pages::Message> {
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
|
|
||||||
children.push(if page.wallpaper_service_config.same_on_all {
|
if page.wallpaper_service_config.same_on_all {
|
||||||
text(fl!("all-displays"))
|
let element = text(fl!("all-displays"))
|
||||||
.font(cosmic::font::FONT_SEMIBOLD)
|
.font(cosmic::font::FONT_SEMIBOLD)
|
||||||
.horizontal_alignment(alignment::Horizontal::Center)
|
.horizontal_alignment(alignment::Horizontal::Center)
|
||||||
.vertical_alignment(alignment::Vertical::Center)
|
.vertical_alignment(alignment::Vertical::Center)
|
||||||
|
|
@ -1118,13 +1123,14 @@ pub fn settings() -> Section<crate::pages::Message> {
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
.apply(cosmic::widget::container)
|
.apply(cosmic::widget::container)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.height(Length::Fixed(32.0))
|
.height(Length::Fixed(32.0));
|
||||||
.into()
|
|
||||||
} else {
|
children.push(element.into());
|
||||||
tab_bar::horizontal(&page.outputs)
|
} else if page.show_tab_bar {
|
||||||
.on_activate(Message::Output)
|
let element = tab_bar::horizontal(&page.outputs).on_activate(Message::Output);
|
||||||
.into()
|
|
||||||
});
|
children.push(element.into());
|
||||||
|
}
|
||||||
|
|
||||||
let wallpaper_fit =
|
let wallpaper_fit =
|
||||||
cosmic::widget::dropdown(&page.fit_options, Some(page.selected_fit), Message::Fit);
|
cosmic::widget::dropdown(&page.fit_options, Some(page.selected_fit), Message::Fit);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue