Skip to content

Commit

Permalink
More appropriate button theming
Browse files Browse the repository at this point in the history
  • Loading branch information
ids1024 committed Nov 17, 2023
1 parent fccc5f2 commit a0a11b6
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/view/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use cctk::wayland_client::protocol::wl_output;
use cctk::{
cosmic_protocols::toplevel_info::v1::client::zcosmic_toplevel_handle_v1,
wayland_client::protocol::wl_output,
};
use cosmic::{
iced::{
self,
Expand Down Expand Up @@ -57,19 +60,14 @@ pub(crate) fn workspace_item<'a>(
workspace: &'a Workspace,
output: &wl_output::WlOutput,
) -> cosmic::Element<'a, Msg> {
// TODO style
let theme = if workspace.is_active {
cosmic::theme::Button::Suggested
} else {
cosmic::theme::Button::Standard
};
column![
close_button(Msg::CloseWorkspace(workspace.handle.clone())),
widget::button(column![
capture_image(workspace.img_for_output.get(output)),
widget::text(&workspace.name)
])
.style(theme)
.selected(workspace.is_active)
.style(cosmic::theme::Button::Image)
.on_press(Msg::ActivateWorkspace(workspace.handle.clone())),
]
.height(iced::Length::Fill)
Expand Down Expand Up @@ -125,6 +123,13 @@ fn toplevel_preview(toplevel: &Toplevel) -> cosmic::Element<Msg> {
column![
close_button(Msg::CloseToplevel(toplevel.handle.clone())),
widget::button(capture_image(toplevel.img.as_ref()))
.selected(
toplevel
.info
.state
.contains(&zcosmic_toplevel_handle_v1::State::Activated)
)
.style(cosmic::theme::Button::Image)
.on_press(Msg::ActivateToplevel(toplevel.handle.clone())),
widget::text(&toplevel.info.title)
.horizontal_alignment(iced::alignment::Horizontal::Center)
Expand Down

0 comments on commit a0a11b6

Please sign in to comment.