Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 11: Notifications vanishes after few seconds. #987

Open
sblantipodi opened this issue Jan 5, 2024 · 12 comments
Open

Windows 11: Notifications vanishes after few seconds. #987

sblantipodi opened this issue Jan 5, 2024 · 12 comments
Labels
bug Something isn't working jbs:reported Someone from our org has reported it to OpenJDK keep This label can be applied to prevent the Stale bot from closing it after a period of inactivity

Comments

@sblantipodi
Copy link
Contributor

sblantipodi commented Jan 5, 2024

Please provide a brief summary of the bug

With previous version of Windows and JDK notification sticked in the Windows Notification Center forever until cancelled.

Since the latest Windows/JDK, notifications vanishes automatically after few seconds.

Code to reproduce the problem

import java.awt.*;

public class Main {
    public static void main(String[] args) throws Exception {
        SystemTray tray = SystemTray.getSystemTray();

        Image image = Toolkit.getDefaultToolkit().createImage("");
        TrayIcon trayIcon = new TrayIcon(image);
        trayIcon.setImageAutoSize(true);
        trayIcon.setToolTip("Demo");
        tray.add(trayIcon);

        trayIcon.displayMessage("Hello, World", "notification demo", TrayIcon.MessageType.INFO);
    }
}

Expected Results

Notifications sent from a TrayIcon should not vanish automatically after few seconds but should stay in the notification center until cancelled by the user.

Actual Results

Notifications sent from a TrayIcon vanishes automatically after few seconds

What Java Version are you using?

21.0.1

What is your operating system and platform?

Windows 11

How did you install Java?

MSI

@sblantipodi sblantipodi added the bug Something isn't working label Jan 5, 2024
@karianna karianna added the jbs:reported Someone from our org has reported it to OpenJDK label Jan 5, 2024
@karianna
Copy link
Contributor

karianna commented Jan 5, 2024

@sblantipodi
Copy link
Contributor Author

@karianna thanks for the kind answer, I appreciate it.
I know that this isn't the best place where to open this issue but I don't know where to open it and I don't know where to start to fix it.
I want to thank you karianna and your team for the great work you are doing here and for the continued help you give to the community, this is much much appreciated.

People from OpenJDK closed this issue with a PASS status but it's obviously not passed since I can reproduce it in all my computers with various JDK versions and various Windows versions :)
I opened similar issue in past but my issues has been closed as well with a passed status.

it's sad to see that issues are closed without even testing them since sometimes opening them requires time...

@karianna
Copy link
Contributor

karianna commented Jan 7, 2024

I've added you use case to that issue to see if that helps them repro.

@karianna
Copy link
Contributor

karianna commented Jan 8, 2024

See https://bugs.openjdk.org/browse/JDK-8310352 - this is a Windows issue that will need to be reported to Microsoft.

@sblantipodi
Copy link
Contributor Author

sblantipodi commented Jan 9, 2024

Thanks for the answer karianna, I appreciate it.
One last question if possible.

Java is using a 30 years old API for the notifications.
The same API used in Windows 95 (Shell_NotifyIcon).

Microsoft released new APIs for Windows 11 notifications. (ToastNotification).

Is it correct to consider it a Windows issue?
Every other languages updated their APIs to use the new Windows APIs,
why Java still uses a 30 years old API for such an important feature like OS Notifications?

@karianna
Copy link
Contributor

karianna commented Jan 9, 2024

Thanks for the answer karianna, I appreciate it. One last question if possible.

Java is using a 30 years old API for the notifications. The same API used in Windows 95 (Shell_NotifyIcon).

Microsoft released new APIs for Windows 11 notifications. (ToastNotification).

Is it correct to consider it a Windows issue? Every other languages updated their APIs to use the new Windows APIs, why Java still uses a 30 years old API for such an important feature like OS Notifications?

Might be, I've updated the upstream issue with some MSFT learn docs on the new API

@karianna
Copy link
Contributor

https://bugs.openjdk.org/browse/JDK-8310352 has been updated with a link to the new feature request for toast notifcations

@sblantipodi
Copy link
Contributor Author

hope to see it implemented in the near future, thank you for your help and for your super great work here karianna,
it is much appreciated.

Copy link

We are marking this issue as stale because it has not been updated for a while. This is just a way to keep the support issues queue manageable.
It will be closed soon unless the stale label is removed by a committer, or a new comment is made.

@github-actions github-actions bot added the stale label Apr 18, 2024
@karianna karianna removed the stale label Apr 18, 2024
Copy link

We are marking this issue as stale because it has not been updated for a while. This is just a way to keep the support issues queue manageable.
It will be closed soon unless the stale label is removed by a committer, or a new comment is made.

@github-actions github-actions bot added the stale label Jul 18, 2024
@karianna
Copy link
Contributor

https://bugs.openjdk.org/browse/JDK-8323821 for the new feature

@karianna karianna added keep This label can be applied to prevent the Stale bot from closing it after a period of inactivity and removed stale labels Jul 18, 2024
@sblantipodi
Copy link
Contributor Author

something tells me that we will not see it implemented (for the next years) but thanks for linking the new feature request. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jbs:reported Someone from our org has reported it to OpenJDK keep This label can be applied to prevent the Stale bot from closing it after a period of inactivity
Projects
None yet
Development

No branches or pull requests

2 participants