Skip to content

Commit 0cb3a3b

Browse files
committed
fix(macOS): detach menu when no items are present
Ensured the native menu is cleared (`null`) on macOS when no menu items are available, allowing the system to detach the menu properly.
1 parent b9013c0 commit 0cb3a3b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/commonMain/kotlin/com/kdroid/composetray/lib/mac/MacTrayManager.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ internal class MacTrayManager(
203203
val trayObj = tray ?: return
204204

205205
if (menuItems.isEmpty()) {
206+
// When there are no menu items, clear the native menu pointer so macOS detaches the menu.
207+
trayObj.menu = null
206208
return
207209
}
208210

0 commit comments

Comments
 (0)