#set_size not setting correct size

18 messages · Page 1 of 1 (latest)

keen ridge
#

I'm not too sure how to describe my issue - this part of my code:

let hud_window = match app.get_webview_window("hud") {
        Some(window) => window,
        None => tauri::WebviewWindowBuilder::new(&app, "hud", tauri::WebviewUrl::App("/hud".into()))
            .decorations(false)
            .transparent(true)
            .resizable(false)
            .always_on_top(true)
            .skip_taskbar(true)
            .center()
            .min_inner_size(300.0, 80.0)
            .max_inner_size(300.0, 80.0)
            .inner_size(300.0, 80.0)
            .build()
            .map_err(|e| e.to_string())?,
    };

    hud_window.set_size(PhysicalSize::new(300.0, 80.0)).map_err(|e| e.to_string())?;
    println!("HUD window size: {:?}", hud_window.inner_size());

Gives me:

HUD window size: Ok(LogicalSize { width: 352.0, height: 252.0 })

Why is it not setting the correct size?

somber latch
keen ridge
#

make a floating window

#

something akin to this

keen ridge
somber latch
#

And how does it look right now?

keen ridge
#

well... the wrong size

somber latch
#

Wait for some help from others.

wraith pilot
#

can you check if it sets the same size if you use .decorations(true) ?
also, the output of tauri info would be nice.

keen ridge
#
❯ pnpm tauri info

[✔] Environment
    - OS: EndeavourOS Rolling Release x86_64 (X64) (Hyprland on wayland)
    ✔ webkit2gtk-4.1: 2.48.3
    ✔ rsvg2: 2.60.0
    ✔ rustc: 1.87.0 (17067e9ac 2025-05-09)
    ✔ cargo: 1.87.0 (99624be96 2025-05-06)
    ✔ rustup: 1.28.2 (e4f3ad6f8 2025-04-28)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 22.16.0
    - pnpm: 10.11.1
    - yarn: 1.22.22
    - npm: 10.9.2
    - bun: 1.2.15
    - deno: deno 2.0.0

[-] Packages
    - tauri 🦀: 2.5.1
    - tauri-build 🦀: 2.2.0
    - wry 🦀: 0.51.2
    - tao 🦀: 0.33.0
    - tauri-cli 🦀: 2.5.0
    - @tauri-apps/api : 2.5.0
    - @tauri-apps/cli : 2.5.0

[-] Plugins
    - tauri-plugin-single-instance 🦀: 2.2.4
    - @tauri-apps/plugin-single-instance : not installed!
    - tauri-plugin-opener 🦀: 2.3.0
    - @tauri-apps/plugin-opener : 2.2.7 (outdated, latest: 2.3.0)
    - tauri-plugin-shell 🦀: 2.2.2
    - @tauri-apps/plugin-shell : 2.2.1 (outdated, latest: 2.2.2)
    - tauri-plugin-deep-link 🦀: 2.3.0
    - @tauri-apps/plugin-deep-link : 2.3.0
    - tauri-plugin-clipboard-manager 🦀: 2.2.3
    - @tauri-apps/plugin-clipboard-manager : 2.2.2 (outdated, latest: 2.2.3)
    - tauri-plugin-global-shortcut 🦀: 2.2.1
    - @tauri-apps/plugin-global-shortcut : 2.2.1

[-] App
    - build-type: bundle
    - CSP: http://asset.localhost
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite
wraith pilot
#

thanks. since you two talked about logical vs physical. which size do you end up with if you change rs hud_window.set_size(PhysicalSize::new(300.0, 80.0)).map_err(|e| e.to_string())?; to ```rs
hud_window.set_size(LogicalSize::new(300.0, 80.0)).map_err(|e| e.to_string())?;

keen ridge
#

thanks so much!

wraith pilot
#

i totally forgot about that issue 😅

keen ridge
#

amazing how you can keep track of all these issues and recall them haha