Hi guys, any idea on how to show notifications fro...
# compose-desktop
b
Hi guys, any idea on how to show notifications from KMP jvm desktop app? I tried SystemTray. It works on Windows. Not on macOS. Any help is very much appreciated.
a
Use the
Tray()
composable. IIRC it has a state which you use to push notifications into
👀 1
b
Thanks alex. I tried it from androidx.compose.ui.window.Window and it did not work.
z
@Binish Mathew i am a library for that: https://github.com/zoff99/jni_notifications
👍 1
b
Thanks alot @Zoff
z
its not a published lib yet. so a bit manual copying the files into your project required
👍 1
a
@Binish Mathew you cannot place a
Tray
inside a
Window
. Here is how to use it
K 2
@Zoff is your lib using native apis on all platforms?
b
Thanks. Let me try again.
z
no only on macos and linux. on windows tray is used. see my usage example linked above
first call init_system_tray() on windows. you can copy my whole class if need be
t
@Binish Mathew I just implemented: https://github.com/mirzemehdi/KMPNotifier/ Took me 5min and works on JVM, Android and iOS. Might be worth looking into it
❤️ 1
245 Views