From 91d6280698e28350d4a4fa00807d55b80e938364 Mon Sep 17 00:00:00 2001 From: Daisuke Murase Date: Thu, 19 Feb 2026 14:24:39 -0800 Subject: [PATCH] fix: use CGMainDisplayID() instead of NSScreen.main for primary display detection NSScreen.main returns the screen with keyboard focus (key window), not the primary display with the menu bar. This caused items without an explicit display to migrate to the wrong screen on display change events. Use CGMainDisplayID() which always returns the menu bar display. --- Cargo.lock | 6 +++--- app/Sources/RanmaAppDelegate.swift | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cbdf391..7a9d0d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -452,7 +452,7 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "ranma-cli" -version = "0.1.6" +version = "0.1.8" dependencies = [ "argh", "libc", @@ -462,7 +462,7 @@ dependencies = [ [[package]] name = "ranma-core" -version = "0.1.6" +version = "0.1.8" dependencies = [ "parking_lot", "serde", @@ -737,7 +737,7 @@ dependencies = [ [[package]] name = "uniffi-bindgen" -version = "0.1.6" +version = "0.1.8" dependencies = [ "uniffi", ] diff --git a/app/Sources/RanmaAppDelegate.swift b/app/Sources/RanmaAppDelegate.swift index 389bf6d..e2276ef 100644 --- a/app/Sources/RanmaAppDelegate.swift +++ b/app/Sources/RanmaAppDelegate.swift @@ -50,7 +50,7 @@ class RanmaAppDelegate: NSObject, NSApplicationDelegate { DisplayInfo( id: screen.displayID, name: screen.localizedName, - isMain: screen == NSScreen.main + isMain: screen.displayID == CGMainDisplayID() ) } setDisplays(displays: displays)