Merge branch 'master' into bulgarian
This commit is contained in:
commit
055befb30a
272 changed files with 4273 additions and 4972 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "cosmic-applet-minimize"
|
||||
version = "0.1.1"
|
||||
version = "1.0.2"
|
||||
edition = "2024"
|
||||
license = "GPL-3.0-only"
|
||||
|
||||
|
|
@ -8,9 +8,9 @@ license = "GPL-3.0-only"
|
|||
anyhow.workspace = true
|
||||
i18n-embed-fl.workspace = true
|
||||
i18n-embed.workspace = true
|
||||
image = { version = "0.25.8", default-features = false }
|
||||
image = { version = "0.25.9", default-features = false }
|
||||
libcosmic.workspace = true
|
||||
memmap2 = "0.9.8"
|
||||
memmap2 = "0.9.9"
|
||||
rust-embed.workspace = true
|
||||
rustix.workspace = true
|
||||
tokio.workspace = true
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ Name[de]=Minimierte Fenster
|
|||
Name[sk]=Minimalizované okná
|
||||
Name[es]=Ventanas minimizadas
|
||||
Name[sv]=Minimera fönster
|
||||
Name[it]=Finestre minimizzate
|
||||
Type=Application
|
||||
Exec=cosmic-applet-minimize
|
||||
Terminal=false
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
@ -46,7 +46,7 @@ where
|
|||
)
|
||||
} else {
|
||||
Element::from(
|
||||
icon.as_cosmic_icon()
|
||||
cosmic::widget::icon(icon.as_cosmic_icon())
|
||||
.width(Length::Fixed((size - border * 2.0).max(0.)))
|
||||
.height(Length::Fixed((size - border * 2.0).max(0.))),
|
||||
)
|
||||
|
|
@ -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)
|
||||
|
|
@ -72,8 +73,7 @@ where
|
|||
.class(Button::AppletIcon)
|
||||
.padding(0)
|
||||
.into(),
|
||||
icon: icon
|
||||
.as_cosmic_icon()
|
||||
icon: cosmic::widget::icon(icon.as_cosmic_icon())
|
||||
.width(Length::Fixed(size / 3.0))
|
||||
.height(Length::Fixed(size / 3.0))
|
||||
.into(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue