Skip to content

Commit 016b79b

Browse files
synleclaude
andcommitted
fix(tray): use actual window width for popup placement clamp (v6.4.7)
position_window_near_tray hardcoded win_w = 360 * target_scale, but the window is 400 logical px wide (since v6.3.20 widened the popup). The clamp was 40 logical px short, so on Windows at 1.25x scale the popup leaked 50 physical px past the right edge of the active monitor — visibly spanning into the next display. Read win_w from window.outer_size() like win_h already does. With this fix, future width changes in tauri.conf.json stay in sync with the placement math automatically. Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
1 parent 2a06228 commit 016b79b

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src-tauri/src/tray.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,12 @@ pub fn position_window_near_tray(
671671
tauri::Size::Logical(s) => (s.width * target_scale, s.height * target_scale),
672672
};
673673

674-
// Window size in target monitor's physical pixels
675-
let win_w = 360.0 * target_scale;
674+
// Window size in target monitor's physical pixels.
675+
// Read actual width/height from outer_size (NOT hardcoded) so width changes
676+
// in tauri.conf.json don't desync the placement clamp. outer_size returns
677+
// physical pixels at the window's current scale, so divide by window_scale
678+
// to get logical, then multiply by target_scale to get target-physical.
679+
let win_w = window.outer_size()?.width as f64 * target_scale / window_scale;
676680
let win_h = window.outer_size()?.height as f64 * target_scale / window_scale;
677681
dbg(&format!(
678682
"tray x={} y={} w={} h={} | win_w={} win_h={}",

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/nicoverbruggen/tauri-v2-docs/refs/heads/main/schemas/config.schema.json",
33
"productName": "Display DJ",
4-
"version": "6.4.6",
4+
"version": "6.4.7",
55
"identifier": "com.synle.display-dj",
66
"build": {
77
"beforeDevCommand": "npm run dev",

0 commit comments

Comments
 (0)