diff --git a/cosmic-settings/src/pages/desktop/workspaces.rs b/cosmic-settings/src/pages/desktop/workspaces.rs index 33d8e203..48a8caee 100644 --- a/cosmic-settings/src/pages/desktop/workspaces.rs +++ b/cosmic-settings/src/pages/desktop/workspaces.rs @@ -44,8 +44,10 @@ pub struct Page { enum Asset { WorkspaceSpanDisplay, WorkspaceSeparateDisplay, - WorkspaceOrientationVertical, - WorkspaceOrientationHorizontal, + WorkspaceOrientationLeft, + WorkspaceOrientationRight, + WorkspaceOrientationTop, + WorkspaceOrientationBottom, TrackpadGestureSwipeVertical, TrackpadGestureSwipeHorizontal, TrackpadGestureSwipeLeft, @@ -60,8 +62,10 @@ impl Asset { match self { Asset::WorkspaceSpanDisplay => "assets/workspace-span-display", Asset::WorkspaceSeparateDisplay => "assets/workspace-separate-display", - Asset::WorkspaceOrientationVertical => "assets/workspace-orientation-vertical", - Asset::WorkspaceOrientationHorizontal => "assets/workspace-orientation-horizontal", + Asset::WorkspaceOrientationLeft => "assets/workspace-orientation-left", + Asset::WorkspaceOrientationRight => "assets/workspace-orientation-right", + Asset::WorkspaceOrientationTop => "assets/workspace-orientation-top", + Asset::WorkspaceOrientationBottom => "assets/workspace-orientation-bottom", Asset::TrackpadGestureSwipeVertical => "assets/trackpad-gesture-swipe-vertical", Asset::TrackpadGestureSwipeHorizontal => "assets/trackpad-gesture-swipe-horizontal", Asset::TrackpadGestureSwipeLeft => "assets/trackpad-gesture-swipe-left", @@ -211,19 +215,36 @@ impl Page { fl!("workspaces-orientation", "right"), ], }; + self.comp_workspace_config.workspace_thumbnail_placement = + match self.comp_workspace_config.workspace_layout { + WorkspaceLayout::Vertical => { + if self.selected_workspace_thumbnail_placement == 0 { + WorkspaceThumbnailPlacement::Left + } else { + WorkspaceThumbnailPlacement::Right + } + } + WorkspaceLayout::Horizontal => { + if self.selected_workspace_thumbnail_placement == 0 { + WorkspaceThumbnailPlacement::Top + } else { + WorkspaceThumbnailPlacement::Bottom + } + } + }; self.save_comp_config(); } Message::SetWorkspaceThumbnailPlacement(value) => { self.comp_workspace_config.workspace_thumbnail_placement = match self.comp_workspace_config.workspace_layout { - WorkspaceLayout::Horizontal => { + WorkspaceLayout::Vertical => { if value == 0 { WorkspaceThumbnailPlacement::Left } else { WorkspaceThumbnailPlacement::Right } } - WorkspaceLayout::Vertical => { + WorkspaceLayout::Horizontal => { if value == 0 { WorkspaceThumbnailPlacement::Top } else { @@ -232,10 +253,7 @@ impl Page { } }; self.selected_workspace_thumbnail_placement = value; - // TODO apply the setting - // if let Err(err) = self.config.set("show_workspace_number", value) { - // error!(?err, "Failed to set config 'show_workspace_number'"); - // } + self.save_comp_config(); } Message::SetShowName(value) => { self.show_workspace_name = value; @@ -271,7 +289,7 @@ fn multi_behavior() -> Section { ListColumn::default() .add( cosmic::iced::widget::column!( - widget::vertical_space(1), + widget::vertical_space().height(1), settings::item_row(vec![radio( text::body(&descriptions[span]), WorkspaceMode::Global, @@ -283,11 +301,11 @@ fn multi_behavior() -> Section { cosmic::iced::widget::svg(asset_handle(Asset::WorkspaceSpanDisplay)) ) .spacing(cosmic::theme::active().cosmic().space_s()) - .align_items(Alignment::Center), + .align_x(Alignment::Center), ) .add( cosmic::iced::widget::column!( - widget::vertical_space(1), + widget::vertical_space().height(1), settings::item_row(vec![radio( text::body(&descriptions[separate]), WorkspaceMode::OutputBound, @@ -299,7 +317,7 @@ fn multi_behavior() -> Section { cosmic::iced::widget::svg(asset_handle(Asset::WorkspaceSeparateDisplay)) ) .spacing(cosmic::theme::active().cosmic().space_s()) - .align_items(Alignment::Center), + .align_x(Alignment::Center), ) .spacing(0)) .title(§ion.title) @@ -342,11 +360,15 @@ fn workspace_orientation() -> Section { .add( cosmic::iced::widget::column!( cosmic::iced::widget::svg( - match page.comp_workspace_config.workspace_layout { - WorkspaceLayout::Vertical => - asset_handle(Asset::WorkspaceOrientationVertical), - WorkspaceLayout::Horizontal => - asset_handle(Asset::WorkspaceOrientationHorizontal), + match page.comp_workspace_config.workspace_thumbnail_placement { + WorkspaceThumbnailPlacement::Left => + asset_handle(Asset::WorkspaceOrientationLeft), + WorkspaceThumbnailPlacement::Right => + asset_handle(Asset::WorkspaceOrientationRight), + WorkspaceThumbnailPlacement::Top => + asset_handle(Asset::WorkspaceOrientationTop), + WorkspaceThumbnailPlacement::Bottom => + asset_handle(Asset::WorkspaceOrientationBottom), } ), cosmic::iced::widget::container( @@ -360,7 +382,7 @@ fn workspace_orientation() -> Section { .height(32.0), ) .spacing(cosmic::theme::active().cosmic().space_m()) - .align_items(Alignment::Center), + .align_x(Alignment::Center), ) .add(settings::item( &descriptions[thumbnail_placement_label], @@ -408,9 +430,9 @@ fn workspace_orientation() -> Section { .add( cosmic::iced::widget::row!( text(&descriptions[switch_workspace]), - cosmic::iced::widget::horizontal_space(2), + cosmic::iced::widget::horizontal_space().width(2), text(&descriptions[switch_ws_label]).font(cosmic::font::bold()), - cosmic::iced::widget::horizontal_space(Length::Fill), + cosmic::iced::widget::horizontal_space().width(Length::Fill), cosmic::iced::widget::container(cosmic::iced::widget::svg( switch_ws )) @@ -418,31 +440,31 @@ fn workspace_orientation() -> Section { .height(92) ) .width(Length::Fill) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .padding([0, 16]), ) .add( cosmic::iced::widget::row!( text(&descriptions[open_workspaces]), - cosmic::iced::widget::horizontal_space(2), + cosmic::iced::widget::horizontal_space().width(2), text(&descriptions[open_ws_label]).font(cosmic::font::bold()), - cosmic::iced::widget::horizontal_space(Length::Fill), + cosmic::iced::widget::horizontal_space().width(Length::Fill), cosmic::iced::widget::container(cosmic::iced::widget::svg(open_ws)) .width(115) .height(92) ) .width(Length::Fill) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .padding([0, 16]), ) .add( cosmic::widget::list_column().add( cosmic::iced::widget::row!( text(&descriptions[open_applications]), - cosmic::iced::widget::horizontal_space(2), + cosmic::iced::widget::horizontal_space().width(2), text(&descriptions[open_app_label]) .font(cosmic::font::bold()), - cosmic::iced::widget::horizontal_space(Length::Fill), + cosmic::iced::widget::horizontal_space().width(Length::Fill), cosmic::iced::widget::container(cosmic::iced::widget::svg( open_app )) @@ -450,7 +472,7 @@ fn workspace_orientation() -> Section { .height(92) ) .width(Length::Fill) - .align_items(Alignment::Center) + .align_y(Alignment::Center) .padding([0, 16]), ), ), diff --git a/resources/assets/workspace-orientation-bottom-dark.svg b/resources/assets/workspace-orientation-bottom-dark.svg new file mode 100644 index 00000000..bd0e707e --- /dev/null +++ b/resources/assets/workspace-orientation-bottom-dark.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/resources/assets/workspace-orientation-bottom-light.svg b/resources/assets/workspace-orientation-bottom-light.svg new file mode 100644 index 00000000..cea02b20 --- /dev/null +++ b/resources/assets/workspace-orientation-bottom-light.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/resources/assets/workspace-orientation-horizontal-light.svg b/resources/assets/workspace-orientation-horizontal-light.svg deleted file mode 100644 index b371ddd3..00000000 --- a/resources/assets/workspace-orientation-horizontal-light.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/resources/assets/workspace-orientation-vertical-dark.svg b/resources/assets/workspace-orientation-left-dark.svg similarity index 85% rename from resources/assets/workspace-orientation-vertical-dark.svg rename to resources/assets/workspace-orientation-left-dark.svg index 2fccf13c..32608cd9 100644 --- a/resources/assets/workspace-orientation-vertical-dark.svg +++ b/resources/assets/workspace-orientation-left-dark.svg @@ -1,7 +1,7 @@ - - + + diff --git a/resources/assets/workspace-orientation-vertical-light.svg b/resources/assets/workspace-orientation-left-light.svg similarity index 92% rename from resources/assets/workspace-orientation-vertical-light.svg rename to resources/assets/workspace-orientation-left-light.svg index 34f113bd..5b5edb76 100644 --- a/resources/assets/workspace-orientation-vertical-light.svg +++ b/resources/assets/workspace-orientation-left-light.svg @@ -1,8 +1,8 @@ - - + + diff --git a/resources/assets/workspace-orientation-right-dark.svg b/resources/assets/workspace-orientation-right-dark.svg new file mode 100644 index 00000000..72fe697e --- /dev/null +++ b/resources/assets/workspace-orientation-right-dark.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/resources/assets/workspace-orientation-horizontal-dark.svg b/resources/assets/workspace-orientation-top-dark.svg similarity index 84% rename from resources/assets/workspace-orientation-horizontal-dark.svg rename to resources/assets/workspace-orientation-top-dark.svg index 2c0c29ce..54954f8e 100644 --- a/resources/assets/workspace-orientation-horizontal-dark.svg +++ b/resources/assets/workspace-orientation-top-dark.svg @@ -1,11 +1,11 @@ - - + + - + \ No newline at end of file diff --git a/resources/assets/workspace-orientation-top-light.svg b/resources/assets/workspace-orientation-top-light.svg new file mode 100644 index 00000000..6b5d30a6 --- /dev/null +++ b/resources/assets/workspace-orientation-top-light.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/resources/assets/workspace-separate-display-dark.svg b/resources/assets/workspace-separate-display-dark.svg index 69e9cc81..320c8e00 100644 --- a/resources/assets/workspace-separate-display-dark.svg +++ b/resources/assets/workspace-separate-display-dark.svg @@ -1,10 +1,10 @@ - - + @@ -19,10 +19,10 @@ - - + diff --git a/resources/assets/workspace-separate-display-light.svg b/resources/assets/workspace-separate-display-light.svg index e5b789c7..f674f13b 100644 --- a/resources/assets/workspace-separate-display-light.svg +++ b/resources/assets/workspace-separate-display-light.svg @@ -1,7 +1,7 @@ - - + + @@ -12,8 +12,8 @@ - - + + diff --git a/resources/assets/workspace-span-display-dark.svg b/resources/assets/workspace-span-display-dark.svg index f6c46f65..092c0372 100644 --- a/resources/assets/workspace-span-display-dark.svg +++ b/resources/assets/workspace-span-display-dark.svg @@ -20,10 +20,10 @@ xmlns:xlink="http://www.w3.org/1999/xlink"> - - + @@ -34,10 +34,10 @@ xmlns:xlink="http://www.w3.org/1999/xlink"> d="M12.8806 93.572C12.8806 91.3629 14.6715 89.572 16.8806 89.572H191.881V162.572H16.8806C14.6715 162.572 12.8806 160.781 12.8806 158.572V93.572Z" fill="#63D0DF" /> - - + diff --git a/resources/assets/workspace-span-display-light.svg b/resources/assets/workspace-span-display-light.svg index 7ccd3cd6..80f60252 100644 --- a/resources/assets/workspace-span-display-light.svg +++ b/resources/assets/workspace-span-display-light.svg @@ -1,6 +1,6 @@ - - + + @@ -9,8 +9,8 @@ - - + +