feat: tooltips for app-list, minimize, and applet buttons
This commit is contained in:
parent
0de336d0d7
commit
d29c756c3c
4 changed files with 127 additions and 78 deletions
|
|
@ -23,7 +23,7 @@ use cosmic::{
|
|||
window::{self},
|
||||
Length, Limits, Subscription,
|
||||
},
|
||||
surface_message::{SurfaceMessage, MessageWrapper},
|
||||
surface_message::{MessageWrapper, SurfaceMessage},
|
||||
widget::{autosize::autosize, mouse_area},
|
||||
Task,
|
||||
};
|
||||
|
|
@ -252,27 +252,20 @@ impl cosmic::Application for Minimize {
|
|||
let theme = self.core.system_theme().cosmic();
|
||||
let space_xxs = theme.space_xxs();
|
||||
let icon_buttons = self.apps[..max_icon_count].iter().map(|(info, data, img)| {
|
||||
tooltip(
|
||||
Element::from(crate::window_image::WindowImage::new(
|
||||
img.clone(),
|
||||
&data.icon,
|
||||
width as f32,
|
||||
Message::Activate(info.foreign_toplevel.clone()),
|
||||
padding,
|
||||
)),
|
||||
text(data.name.clone()).shaping(text::Shaping::Advanced),
|
||||
// tooltip::Position::FollowCursor,
|
||||
// FIXME tooltip fails to appear when created as indicated in design
|
||||
// maybe it should be a subsurface
|
||||
match self.core.applet.anchor {
|
||||
PanelAnchor::Left => tooltip::Position::Right,
|
||||
PanelAnchor::Right => tooltip::Position::Left,
|
||||
PanelAnchor::Top => tooltip::Position::Bottom,
|
||||
PanelAnchor::Bottom => tooltip::Position::Top,
|
||||
},
|
||||
)
|
||||
.snap_within_viewport(false)
|
||||
.into()
|
||||
self.core
|
||||
.applet
|
||||
.applet_tooltip(
|
||||
Element::from(crate::window_image::WindowImage::new(
|
||||
img.clone(),
|
||||
&data.icon,
|
||||
width as f32,
|
||||
Message::Activate(info.foreign_toplevel.clone()),
|
||||
padding,
|
||||
)),
|
||||
data.name.clone(),
|
||||
self.overflow_popup.is_some(),
|
||||
)
|
||||
.into()
|
||||
});
|
||||
let overflow_btn = if max_icon_count < self.apps.len() {
|
||||
let icon = match self.core.applet.anchor {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue