Handle custom panel sizes in cosmic-app-list
With custom panel sizes, we use ranges that equal the values you would normally get from the hardcoded panel sizes Update libcosmic Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
This commit is contained in:
parent
417f43a0f5
commit
78e108ed7e
2 changed files with 43 additions and 26 deletions
34
Cargo.lock
generated
34
Cargo.lock
generated
|
|
@ -1385,7 +1385,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"atomicwrites",
|
||||
"cosmic-config-derive",
|
||||
|
|
@ -1407,7 +1407,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-config-derive"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
|
|
@ -1485,7 +1485,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-panel-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-panel#36a8e558ea326383821bf50f2bbc5f45c9f41aff"
|
||||
source = "git+https://github.com/pop-os/cosmic-panel#dcf73a52d8b5d074e57032b0c317d6ce49057650"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cosmic-config",
|
||||
|
|
@ -1571,7 +1571,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cosmic-theme"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"almost",
|
||||
"cosmic-config",
|
||||
|
|
@ -2888,7 +2888,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced"
|
||||
version = "0.14.0-dev"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"dnd",
|
||||
"iced_accessibility",
|
||||
|
|
@ -2906,7 +2906,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_accessibility"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"accesskit_winit",
|
||||
|
|
@ -2915,7 +2915,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_core"
|
||||
version = "0.14.0-dev"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bytes",
|
||||
|
|
@ -2939,7 +2939,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_futures"
|
||||
version = "0.14.0-dev"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"iced_core",
|
||||
|
|
@ -2965,7 +2965,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_graphics"
|
||||
version = "0.14.0-dev"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"bytemuck",
|
||||
|
|
@ -2987,7 +2987,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_renderer"
|
||||
version = "0.14.0-dev"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"iced_graphics",
|
||||
"iced_tiny_skia",
|
||||
|
|
@ -2999,7 +2999,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_runtime"
|
||||
version = "0.14.0-dev"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"cosmic-client-toolkit",
|
||||
|
|
@ -3014,7 +3014,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_tiny_skia"
|
||||
version = "0.14.0-dev"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"cosmic-text",
|
||||
|
|
@ -3030,7 +3030,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_wgpu"
|
||||
version = "0.14.0-dev"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"as-raw-xcb-connection",
|
||||
"bitflags 2.9.1",
|
||||
|
|
@ -3061,7 +3061,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_widget"
|
||||
version = "0.14.0-dev"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"cosmic-client-toolkit",
|
||||
"dnd",
|
||||
|
|
@ -3080,7 +3080,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "iced_winit"
|
||||
version = "0.14.0-dev"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"cosmic-client-toolkit",
|
||||
"dnd",
|
||||
|
|
@ -3892,7 +3892,7 @@ checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
|
|||
[[package]]
|
||||
name = "libcosmic"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b61a7ebd5fedf2621c39f2547dd007722477cfe2"
|
||||
source = "git+https://github.com/pop-os/libcosmic#b73532f62f0a97b1611f2c35f54d0a805f845480"
|
||||
dependencies = [
|
||||
"apply",
|
||||
"ashpd",
|
||||
|
|
@ -7679,7 +7679,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "xdg-shell-wrapper-config"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/pop-os/cosmic-panel#36a8e558ea326383821bf50f2bbc5f45c9f41aff"
|
||||
source = "git+https://github.com/pop-os/cosmic-panel#dcf73a52d8b5d074e57032b0c317d6ce49057650"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"wayland-protocols-wlr",
|
||||
|
|
|
|||
|
|
@ -85,9 +85,20 @@ impl AppletIconData {
|
|||
let icon_spacing = 4.0;
|
||||
|
||||
let (dot_radius, bar_size) = match applet.size {
|
||||
Size::PanelSize(PanelSize::XL) | Size::PanelSize(PanelSize::L) => (2.0, 12.0),
|
||||
Size::PanelSize(PanelSize::M) | Size::Hardcoded(_) => (2.0, 8.0),
|
||||
Size::PanelSize(PanelSize::S) | Size::PanelSize(PanelSize::XS) => (1.0, 8.0),
|
||||
Size::Hardcoded(_) => (2.0, 8.0),
|
||||
Size::PanelSize(ref s) => {
|
||||
let size = s.get_applet_icon_size_with_padding(false);
|
||||
// Define size thresholds, to handle custom sizes
|
||||
let small_size_threshold = PanelSize::S.get_applet_icon_size_with_padding(false);
|
||||
let medium_size_threshold = PanelSize::M.get_applet_icon_size_with_padding(false);
|
||||
if size <= small_size_threshold {
|
||||
(1.0, 8.0)
|
||||
} else if size <= medium_size_threshold {
|
||||
(2.0, 8.0)
|
||||
} else {
|
||||
(2.0, 12.0)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let padding = padding as f32;
|
||||
|
|
@ -1470,11 +1481,17 @@ impl cosmic::Application for CosmicAppList {
|
|||
PanelAnchor::Left | PanelAnchor::Right => false,
|
||||
};
|
||||
let divider_padding = match self.core.applet.size {
|
||||
Size::PanelSize(PanelSize::XL)
|
||||
| Size::PanelSize(PanelSize::L)
|
||||
| Size::PanelSize(PanelSize::M) => 8,
|
||||
Size::PanelSize(PanelSize::S) | Size::PanelSize(PanelSize::XS) | Size::Hardcoded(_) => {
|
||||
4
|
||||
Size::Hardcoded(_) => 4,
|
||||
Size::PanelSize(ref s) => {
|
||||
let size = s.get_applet_icon_size_with_padding(false);
|
||||
|
||||
let small_size_threshold = PanelSize::S.get_applet_icon_size_with_padding(false);
|
||||
|
||||
if size <= small_size_threshold {
|
||||
4
|
||||
} else {
|
||||
8
|
||||
}
|
||||
}
|
||||
};
|
||||
let (favorite_popup_cutoff, active_popup_cutoff) = self.panel_overflow_lengths();
|
||||
|
|
@ -1793,7 +1810,7 @@ impl cosmic::Application for CosmicAppList {
|
|||
|
||||
match popup_type {
|
||||
PopupType::RightClickMenu => {
|
||||
fn menu_button<'a, Message>(
|
||||
fn menu_button<'a, Message: Clone + 'a>(
|
||||
content: impl Into<Element<'a, Message>>,
|
||||
) -> cosmic::widget::Button<'a, Message> {
|
||||
button::custom(content)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue