Skip to content

Commit

Permalink
fix: applet updates
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Dec 8, 2023
1 parent ba90e52 commit 2b9e0c0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
- winit
- winit_wgpu
- wayland
- applet
runs-on: ubuntu-22.04
steps:
- name: Checkout sources
Expand Down
17 changes: 11 additions & 6 deletions src/applet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ impl Context {
#[allow(clippy::cast_precision_loss)]
pub fn window_settings(&self) -> crate::app::Settings {
let (width, height) = self.suggested_size();
let width = u32::from(width);
let height = u32::from(height);
let width = f32::from(width);
let height = f32::from(height);
let mut settings = crate::app::Settings::default()
.size((width + APPLET_PADDING * 2, height + APPLET_PADDING * 2))
.size(iced_core::Size::new(
width + APPLET_PADDING as f32 * 2.,
height + APPLET_PADDING as f32 * 2.,
))
.size_limits(
Limits::NONE
.min_height(height as f32 + APPLET_PADDING as f32 * 2.0)
Expand Down Expand Up @@ -235,6 +238,8 @@ pub fn run<App: Application>(autosize: bool, flags: App::Flags) -> iced::Result
crate::icon_theme::set_default(icon_theme);
}

let (width, height) = (settings.size.width as u32, settings.size.height as u32);

let mut core = Core::default();
core.window.show_window_menu = false;
core.window.show_headerbar = false;
Expand All @@ -245,8 +250,8 @@ pub fn run<App: Application>(autosize: bool, flags: App::Flags) -> iced::Result

core.debug = settings.debug;
core.set_scale_factor(settings.scale_factor);
core.set_window_width(settings.size.0);
core.set_window_height(settings.size.1);
core.set_window_width(width);
core.set_window_height(height);

THEME.with(move |t| {
let mut cosmic_theme = t.borrow_mut();
Expand All @@ -268,7 +273,7 @@ pub fn run<App: Application>(autosize: bool, flags: App::Flags) -> iced::Result
autosize: settings.autosize,
client_decorations: settings.client_decorations,
resizable: settings.resizable,
size: settings.size,
size: (width, height),
size_limits: settings.size_limits,
title: None,
transparent: settings.transparent,
Expand Down

0 comments on commit 2b9e0c0

Please sign in to comment.