applet overlap
chore: mpris dep fix: dock buttons improv: battery and audio improvements feat: overlapping padding fix: input source text button fix: apply panel spacing to app tray chore: update libcosmic fix: spacing and padding fix(minimize): hide when empty
This commit is contained in:
parent
b026db6f7c
commit
836c0e378b
26 changed files with 627 additions and 576 deletions
|
|
@ -74,7 +74,7 @@ impl Minimize {
|
|||
return index;
|
||||
};
|
||||
let button_total_size = self.core.applet.suggested_size(true).0
|
||||
+ self.core.applet.suggested_padding(true) * 2
|
||||
+ self.core.applet.suggested_padding(true).0 * 2
|
||||
+ 4;
|
||||
let btn_count = max_major_axis_len / button_total_size as u32;
|
||||
if btn_count >= self.apps.len() as u32 {
|
||||
|
|
@ -143,8 +143,11 @@ impl cosmic::Application for Minimize {
|
|||
};
|
||||
|
||||
app.update_desktop_entries();
|
||||
|
||||
(app, Task::none())
|
||||
let t = iced::window::minimize::<cosmic::Action<Message>>(
|
||||
app.core.main_window_id().unwrap(),
|
||||
true,
|
||||
);
|
||||
(app, t)
|
||||
}
|
||||
|
||||
fn core(&self) -> &cosmic::app::Core {
|
||||
|
|
@ -205,11 +208,22 @@ impl cosmic::Application for Minimize {
|
|||
}
|
||||
|
||||
self.apps = apps;
|
||||
|
||||
return iced::window::maximize(self.core.main_window_id().unwrap(), true);
|
||||
}
|
||||
ToplevelUpdate::Remove(handle) => {
|
||||
let prev_was_empty = self.apps.is_empty();
|
||||
self.apps
|
||||
.retain(|a| a.toplevel_info.foreign_toplevel != handle);
|
||||
self.apps.shrink_to_fit();
|
||||
let changed = prev_was_empty != self.apps.is_empty();
|
||||
if self.apps.is_empty() && changed {
|
||||
// hide the window
|
||||
return iced::window::minimize(
|
||||
self.core.main_window_id().unwrap(),
|
||||
true,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
WaylandUpdate::Image(handle, img) => {
|
||||
|
|
@ -241,7 +255,7 @@ impl cosmic::Application for Minimize {
|
|||
|
||||
self.overflow_popup = Some(new_id);
|
||||
let icon_size = self.core.applet.suggested_size(true).0 as u32
|
||||
+ 2 * self.core.applet.suggested_padding(true) as u32;
|
||||
+ 2 * self.core.applet.suggested_padding(true).1 as u32;
|
||||
let spacing = self.core.system_theme().cosmic().space_xxs() as u32;
|
||||
let major_axis_len = (icon_size + spacing) * (pos.saturating_sub(1) as u32);
|
||||
let rectangle = match self.core.applet.anchor {
|
||||
|
|
@ -293,9 +307,16 @@ impl cosmic::Application for Minimize {
|
|||
}
|
||||
});
|
||||
let (width, _) = self.core.applet.suggested_size(false);
|
||||
let padding = self.core.applet.suggested_padding(false);
|
||||
let (major_padding, cross_padding) = self.core.applet.suggested_padding(false);
|
||||
let padding = if matches!(
|
||||
self.core.applet.anchor,
|
||||
PanelAnchor::Top | PanelAnchor::Bottom
|
||||
) {
|
||||
(major_padding, cross_padding)
|
||||
} else {
|
||||
(cross_padding, major_padding)
|
||||
};
|
||||
let theme = self.core.system_theme().cosmic();
|
||||
let space_xxs = theme.space_xxs();
|
||||
let icon_buttons = self.apps[..max_icon_count].iter().map(|app| {
|
||||
self.core
|
||||
.applet
|
||||
|
|
@ -332,6 +353,7 @@ impl cosmic::Application for Minimize {
|
|||
None
|
||||
};
|
||||
|
||||
let spacing = self.core.applet.spacing;
|
||||
// TODO optional dividers on ends if detects app list neighbor
|
||||
// not sure the best way to tell if there is an adjacent app-list
|
||||
let icon_buttons = icon_buttons.chain(overflow_btn);
|
||||
|
|
@ -343,14 +365,14 @@ impl cosmic::Application for Minimize {
|
|||
.align_y(cosmic::iced_core::Alignment::Center)
|
||||
.height(Length::Shrink)
|
||||
.width(Length::Shrink)
|
||||
.spacing(space_xxs)
|
||||
.spacing(spacing as f32)
|
||||
.into()
|
||||
} else {
|
||||
Column::with_children(icon_buttons)
|
||||
.align_x(cosmic::iced_core::Alignment::Center)
|
||||
.height(Length::Shrink)
|
||||
.width(Length::Shrink)
|
||||
.spacing(space_xxs)
|
||||
.spacing(spacing as f32)
|
||||
.into()
|
||||
};
|
||||
|
||||
|
|
@ -388,7 +410,15 @@ impl cosmic::Application for Minimize {
|
|||
}
|
||||
});
|
||||
let (width, _) = self.core.applet.suggested_size(false);
|
||||
let padding = self.core.applet.suggested_padding(false);
|
||||
let (major_padding, cross_padding) = self.core.applet.suggested_padding(false);
|
||||
let padding = if matches!(
|
||||
self.core.applet.anchor,
|
||||
PanelAnchor::Top | PanelAnchor::Bottom
|
||||
) {
|
||||
(major_padding, cross_padding)
|
||||
} else {
|
||||
(cross_padding, major_padding)
|
||||
};
|
||||
let theme = self.core.system_theme().cosmic();
|
||||
let space_xxs = theme.space_xxs();
|
||||
let icon_buttons = self.apps[max_icon_count..].iter().map(|app| {
|
||||
|
|
@ -429,15 +459,13 @@ impl cosmic::Application for Minimize {
|
|||
Row::with_children(icon_buttons)
|
||||
.align_y(cosmic::iced_core::Alignment::Center)
|
||||
.height(Length::Shrink)
|
||||
.width(Length::Shrink)
|
||||
.spacing(space_xxs),
|
||||
.width(Length::Shrink),
|
||||
)
|
||||
} else {
|
||||
Column::with_children(icon_buttons)
|
||||
.align_x(cosmic::iced_core::Alignment::Center)
|
||||
.height(Length::Shrink)
|
||||
.width(Length::Shrink)
|
||||
.spacing(space_xxs)
|
||||
.into()
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use cctk::{
|
|||
},
|
||||
toplevel_info::{ToplevelInfoHandler, ToplevelInfoState},
|
||||
toplevel_management::{ToplevelManagerHandler, ToplevelManagerState},
|
||||
wayland_client::{self, WEnum, protocol::wl_seat::WlSeat},
|
||||
wayland_client::{self, WEnum, delegate_noop, protocol::wl_seat::WlSeat},
|
||||
};
|
||||
use cosmic::{
|
||||
cctk::{
|
||||
|
|
@ -557,21 +557,10 @@ impl Dispatch<wl_shm_pool::WlShmPool, ()> for AppData {
|
|||
}
|
||||
}
|
||||
|
||||
impl Dispatch<wl_buffer::WlBuffer, ()> for AppData {
|
||||
fn event(
|
||||
_app_data: &mut Self,
|
||||
_buffer: &wl_buffer::WlBuffer,
|
||||
_event: wl_buffer::Event,
|
||||
(): &(),
|
||||
_: &Connection,
|
||||
_qh: &QueueHandle<Self>,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
sctk::delegate_shm!(AppData);
|
||||
sctk::delegate_seat!(AppData);
|
||||
sctk::delegate_registry!(AppData);
|
||||
cctk::delegate_toplevel_info!(AppData);
|
||||
cctk::delegate_toplevel_manager!(AppData);
|
||||
cctk::delegate_screencopy!(AppData);
|
||||
delegate_noop!(AppData: ignore wl_buffer::WlBuffer);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ where
|
|||
icon: &fde::IconSource,
|
||||
size: f32,
|
||||
on_press: Msg,
|
||||
padding: u16,
|
||||
padding: (u16, u16),
|
||||
) -> Self {
|
||||
let border = 1.0;
|
||||
Self {
|
||||
|
|
@ -63,8 +63,9 @@ where
|
|||
.height(Length::Shrink)
|
||||
.width(Length::Shrink),
|
||||
)
|
||||
.center(Length::Fixed(size + padding as f32 * 2.0))
|
||||
.padding(padding),
|
||||
.center_x(Length::Fixed(size + padding.0 as f32 * 2.0))
|
||||
.center_y(Length::Fixed(size + padding.1 as f32 * 2.0))
|
||||
.padding([padding.0 as f32, padding.1 as f32]),
|
||||
)
|
||||
.on_press(on_press)
|
||||
.width(Length::Shrink)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue