Closed habibg1232191 closed 2 years ago
This question is about Windows target
I think, @habibg1232191, want to achieve something like this: https://roundwide.com/implementing-system-tray-app-with-wpf-and-mvvm/ (section Hiding and Restoring Window)
In WPF XAML it configures with ShowInTaskbar="{Binding ShowInTaskbar}"
Maybe in JVM it can be difficult...
@avdim that's right. What I wanted
I made sample with the desired behaviour https://github.com/avdim/compose-desktop-not-shown-in-task-bar @habibg1232191 Can you please check it?
Is the question about how to hide the window from taskbar, when it is opened, or - how to hide the window into tray instead of closing it?
If the second, then - as avdim described (or this way with Composable API).
If the first, then it is probably impossible with AWT/Swing API. We need to use a native API: retrieve ComposeWindow.windowHandle
, and write platform-specific logic via JNI. I don't know exactly what API is needed for that, but it is possible, as Toolbox has the same issue, and have fixed it. There is another issue will arise - we can hide window from the taskbar only if it is already visible. So there will be a small glitch - window appears on the taskbar for 300ms. It probably can't be avoided as far as we use Swing as implementation for Compose.
Is the question about how to hide the window from taskbar, when it is opened, or - how to hide the window into tray instead of closing it?
If the second, then - as avdim described (or this way with Composable API).
If the first, then it is probably impossible with AWT/Swing API. We need to use a native API: retrieve
ComposeWindow.windowHandle
, and write platform-specific logic via JNI. I don't know exactly what API is needed for that, but it is possible, as Toolbox has the same issue, and have fixed it. There is another issue will arise - we can hide window from the taskbar only if it is already visible. So there will be a small glitch - window appears on the taskbar for 300ms. It probably can't be avoided as far as we use Swing as implementation for Compose.
My sample hide window from taskbar only in Windows OS and some Linux distributions. It achieves with usage JDialog() instead of JFrame()
I found this solution on StackOverflow https://stackoverflow.com/questions/2054347/show-jframe-but-not-show-title-bar-on-task-bar
It achieves with usage JDialog() instead of JFrame()
Indeed, thanks!
Interesting, ComposeDialog
shows the icon in the taskbar. I have fixed that here.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Here is an example in awt.