Skip to content

Commit

Permalink
Indicate which window is focused
Browse files Browse the repository at this point in the history
  • Loading branch information
ids1024 committed Jan 7, 2023
1 parent 8a6ee91 commit 84de42f
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,6 @@ impl App {
) -> Option<&mut Toplevel> {
self.toplevels.iter_mut().find(|i| &i.handle == handle)
}

fn layer_surface_for_output_name(
&mut self,
output_name: Option<&str>,
) -> Option<&mut LayerSurface> {
for surface in self.layer_surfaces.values_mut() {
if surface.output_name.as_deref() == output_name {
return Some(surface);
}
}
None
}
}

impl Application for App {
Expand Down Expand Up @@ -313,12 +301,18 @@ fn layer_surface<'a>(app: &'a App, surface: &'a LayerSurface) -> cosmic::Element
}

fn workspace_sidebar_entry(workspace: &Workspace) -> cosmic::Element<Msg> {
// Indicate active workspace?
// TODO style
let theme = if workspace.is_active {
cosmic::theme::Button::Primary
} else {
cosmic::theme::Button::Secondary
};
widget::column![
widget::button(widget::text("X")), // TODO close button
widget::button(widget::Image::new(workspace.img.clone().unwrap_or_else(
|| widget::image::Handle::from_pixels(0, 0, vec![0, 0, 0, 255])
)))
.style(theme)
.on_press(Msg::ActivateWorkspace(workspace.handle.clone())),
widget::text(&workspace.name)
]
Expand Down

0 comments on commit 84de42f

Please sign in to comment.