More appropriate button theming
This commit is contained in:
parent
fccc5f26e5
commit
a0a11b6e02
1 changed files with 13 additions and 8 deletions
|
|
@ -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::{
|
use cosmic::{
|
||||||
iced::{
|
iced::{
|
||||||
self,
|
self,
|
||||||
|
|
@ -57,19 +60,14 @@ pub(crate) fn workspace_item<'a>(
|
||||||
workspace: &'a Workspace,
|
workspace: &'a Workspace,
|
||||||
output: &wl_output::WlOutput,
|
output: &wl_output::WlOutput,
|
||||||
) -> cosmic::Element<'a, Msg> {
|
) -> cosmic::Element<'a, Msg> {
|
||||||
// TODO style
|
|
||||||
let theme = if workspace.is_active {
|
|
||||||
cosmic::theme::Button::Suggested
|
|
||||||
} else {
|
|
||||||
cosmic::theme::Button::Standard
|
|
||||||
};
|
|
||||||
column![
|
column![
|
||||||
close_button(Msg::CloseWorkspace(workspace.handle.clone())),
|
close_button(Msg::CloseWorkspace(workspace.handle.clone())),
|
||||||
widget::button(column![
|
widget::button(column![
|
||||||
capture_image(workspace.img_for_output.get(output)),
|
capture_image(workspace.img_for_output.get(output)),
|
||||||
widget::text(&workspace.name)
|
widget::text(&workspace.name)
|
||||||
])
|
])
|
||||||
.style(theme)
|
.selected(workspace.is_active)
|
||||||
|
.style(cosmic::theme::Button::Image)
|
||||||
.on_press(Msg::ActivateWorkspace(workspace.handle.clone())),
|
.on_press(Msg::ActivateWorkspace(workspace.handle.clone())),
|
||||||
]
|
]
|
||||||
.height(iced::Length::Fill)
|
.height(iced::Length::Fill)
|
||||||
|
|
@ -125,6 +123,13 @@ fn toplevel_preview(toplevel: &Toplevel) -> cosmic::Element<Msg> {
|
||||||
column![
|
column![
|
||||||
close_button(Msg::CloseToplevel(toplevel.handle.clone())),
|
close_button(Msg::CloseToplevel(toplevel.handle.clone())),
|
||||||
widget::button(capture_image(toplevel.img.as_ref()))
|
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())),
|
.on_press(Msg::ActivateToplevel(toplevel.handle.clone())),
|
||||||
widget::text(&toplevel.info.title)
|
widget::text(&toplevel.info.title)
|
||||||
.horizontal_alignment(iced::alignment::Horizontal::Center)
|
.horizontal_alignment(iced::alignment::Horizontal::Center)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue