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

tray icon tooltips broken in windows 11 #65

Open
Samuel12321 opened this issue Sep 19, 2021 · 24 comments
Open

tray icon tooltips broken in windows 11 #65

Samuel12321 opened this issue Sep 19, 2021 · 24 comments

Comments

@Samuel12321
Copy link

just displays tooltip

@Lakritzator
Copy link
Collaborator

Hey @Samuel12321, do you have more information or is that all?
What do you mean with "just displays tooltip"?
In what scenario is the tray icon running, did you try the samples?

Best wishes,
Robin

@Samuel12321
Copy link
Author

Hi @Lakritzator ,
Thanks for the quick response.
I'm one of the devs for ModernFlyouts, we have been using Hardcodet WPF NotifyIcon to display a tray icon. When the user hovers over it it is supposed to display a tooltip saying "ModernFlyouts" as seen in the image below.
image
This works well on all versions of Windows 10, however if the app is installed on Windows 11, it just displays "tooltip", as seen in the image below.
image
We have multiple reports confirming this occurs on all versions of Windows 11.
The source code is below.

using Hardcodet.Wpf.TaskbarNotification;
using ModernFlyouts.Helpers;
using ModernFlyouts.Utilities;
using ModernWpf;
using ModernWpf.Controls;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;

namespace ModernFlyouts.UI
{
    internal class TrayIconManager
    {
        #region Properties

        public static TaskbarIcon TaskbarIcon { get; private set; }

        public static ContextMenu TaskbarIconContextMenu { get; private set; }

        public static ToolTip TaskbarIconToolTip { get; private set; }

        #endregion

        public static void SetupTrayIcon()
        {
            var settingsItem = new MenuItem()
            {
                Header = Properties.Strings.SettingsItem,
                ToolTip = Properties.Strings.SettingsItemDescription,
                Icon = new FontIcon() { Glyph = CommonGlyphs.Settings },
                Command = CommonCommands.OpenSettingsWindowCommand
            };

            var exitItem = new MenuItem()
            {
                Header = Properties.Strings.ExitItem,
                ToolTip = Properties.Strings.ExitItemDescription,
                Icon = new FontIcon() { Glyph = CommonGlyphs.PowerButton },
                Command = CommonCommands.ExitAppCommand
            };

            TaskbarIconContextMenu = new ContextMenu()
            {
                Items = { settingsItem, exitItem }
            };

            TaskbarIconToolTip = new ToolTip() { Content = Program.AppName };

            TaskbarIcon = new TaskbarIcon()
            {
                TrayToolTip = TaskbarIconToolTip,
                ContextMenu = TaskbarIconContextMenu,
                DoubleClickCommand = CommonCommands.OpenSettingsWindowCommand
            };
        }

        public static void UpdateTrayIconVisibility(bool isVisible)
        {
            TaskbarIcon.Visibility = isVisible ? Visibility.Visible : Visibility.Collapsed;
        }

        public static void UpdateTrayIconInternal(ElementTheme currentTheme, bool useColoredTrayIcon)
        {
            ThemeManager.SetRequestedTheme(TaskbarIconContextMenu, currentTheme);
            ThemeManager.SetRequestedTheme(TaskbarIconToolTip, currentTheme);

            Uri iconUri;
            if (useColoredTrayIcon)
            {
                iconUri = PackUriHelper.GetAbsoluteUri(@"Assets\Logo.ico");
            }
            else
            {
                iconUri = PackUriHelper.GetAbsoluteUri(currentTheme == ElementTheme.Light ? @"Assets\Logo_Tray_Black.ico" : @"Assets\Logo_Tray_White.ico");
            }

            TaskbarIcon.IconSource = BitmapFrame.Create(iconUri);
        }
    }
}

Thanks,
Sam

@Lakritzator
Copy link
Collaborator

Hi Sam,

That explanation makes a bit more sense, as that what I understood before. I though you meant that the tray icon only shows tooltips and nothing else... It didn't get to me that you ment it doesn't show the correct text 😆

I will look into it, fortunately I do have some Windows 11 to play around with for my Greenshot development.

Btw. nice project.

Best wishes,
Robin

@fgimian
Copy link

fgimian commented Oct 21, 2021

I can confirm thes issue here too on a fresh Windows 11 install with my app TotalMix Volume Control.

image

Instead of something like:

image

Thanks so much in advance
Fotis

@Samuel12321
Copy link
Author

Wondering if this could be the source of the problem, just saw this https://aka.ms/AAd21h2

NIN_POPUPOPEN is never sent when NOTIFYICON_VERSION_4 is specified and NIF_SHOWTIP is not
Normally, when apps used notification icons version 4 with Shell_NotifyIcon and did not specify NIF_SHOWTIP, they would receive NIN_POPUPOPEN to be able to show their own tooltip. In Windows 11, these apps never receive NIN_POPUPOPEN and the Windows-default tooltip will always show, which is undesirable for some apps and completely nullifies the point of NIF_SHOWTIP.

@Lakritzator
Copy link
Collaborator

@Samuel12321 I was expecting something like that, but didn't find it yet.
Yes, that is exactly describing the issue!

Thanks for covering that up.

Please all upvote this: https://aka.ms/AAd21h2

@Samuel12321
Copy link
Author

@Lakritzator Any ideas on a workaround for this? i doubt MS will fix this quickly.

@Lakritzator
Copy link
Collaborator

I don't see an easy way to workaround this, when the right event is missing on a level which is out of our control, it's usually hard to find some way to mitigate this. Mostly this results in a weird & ugly workaround. I myself would rather see if Microsoft can fix this, before someone spends hours of work on it.

We might be able find a Microsoft application which has the same issue, this might speed up fixing it.
I tried to have a look already, for me it would have been the best if PowerToys had an issue, but unfortunately it only shows a simple tooltip in Windows 10...

@sylveon
Copy link

sylveon commented Dec 2, 2021

I'm the one that filled the Feedback Hub entry linked above - I don't think any fix should be expected soon. We all know that Feedback Hub is like speaking to a wall.

In my case it wasn't too bad because I use the APIs raw from C++ so was able to easily find the issue (and I've always gave an appropriate fallback text, so it only downgrades from a newer tooltip to the old tooltip style in the end). It might be possible to fill an issue on the Windows App SDK repo, as they also own these OS APIs. I'd happily upvote and comment on such an issue.

It might be interesting to check the newer insider builds, since if it was fixed it probably wouldn't qualify for a cumulative update.

@Duncanma
Copy link

Duncanma commented Dec 7, 2021

FYI, if someone just sets ToolTipText, would that work as a fallback then on Windows 11? I don't have a non-Windows 11 machine, so I want to make sure setting this doesn't prevent the nice/fancy tool tip from showing up on hover on Windows 10 or previous

Duncanma added a commit to Duncanma/MTGAHelper-Windows-Client that referenced this issue Dec 7, 2021
@Symbai
Copy link

Symbai commented Dec 27, 2021

FYI, if someone just sets ToolTipText, would that work as a fallback then on Windows 11?

Yes

@mogikanin
Copy link

There is another bug on Windows 11. By some reason long tooltip texts now showing multiline. Here the sample
image
On any other Windows version this tooltip is showing as single line.
The usage is quite simple.

  <tb:TaskbarIcon x:Name="trayIcon" Visibility="Visible"                           
                                 IconSource="{Binding Path=IconSource}"
                                 ToolTipText="some long long long text"/>

@AliveDevil
Copy link
Contributor

Fixed with Windows 11 22h2 Moment 2 (22621.1343).

image

@Lakritzator
Copy link
Collaborator

Lakritzator commented Feb 24, 2023

I had a look at the release notes, but there wasn't a direct mentioning of this.

https://blogs.windows.com/windows-insider/2023/02/21/releasing-windows-11-build-22621-1343-to-the-release-preview-channel/

They did mention that they changed something with the system tray though:
This update enhanced the system tray (formerly called the notification area). All icons had a rounded focus and hover treatment in the lower right, including the “Show hidden icons” flyout menu. You could move icons to rearrange them in the “Show hidden icons” flyout menu or move icons to the taskbar.

It's a shame there is not feedback from Microsoft in the feedback hub... https://aka.ms/AAd21h2

@sylveon
Copy link

sylveon commented Feb 24, 2023

The taskbar (and therefore the system tray) has been reimplemented with that update, it is now fully UWP XAML, instead of the weird GDI/XAML mix it was before.

@Lakritzator
Copy link
Collaborator

Oh, where did you get that information?

@sylveon
Copy link

sylveon commented Feb 24, 2023

Figured it out by inspecting the taskbar though the Live Visual Tree when injecting the VS debugger into explorer.

@kornelijepetak
Copy link

For our app, it seems to have been fixed in Windows Build 22621.1343 (KB5022913)

https://github.com/toggl/track-windows-feedback/issues/2#issuecomment-1451629613

@fhumayun
Copy link

Please note this is being reported, as an active and as a legacy bug, here:
canton7/SyncTrayzor#398

@prakharb5
Copy link

Not sure if this is a new issue, or if it was there before, but there are now 2 tooltips: one from here, one from windows

image

Here, "ModernFlyouts" one is from this library, while the one in top left corner is from windows, showing up just blank.

@sylveon
Copy link

sylveon commented Jun 13, 2024

Yes, I believe that's a Windows bug

@Emma1963
Copy link

Emma1963 commented Sep 5, 2024

How to set the theme for tooltip with the Windows theme?
Our app only shows the whilte background.
image

@AliveDevil
Copy link
Contributor

Your comment is a duplicate of #95.
Use this repository main branch, build the library, or wait until a NuGet artifact is pushed and your issue is fixed when using ToolTipText.

Or find a library that backports WPF dynamic theming, so that <Tooltip /> is styled accordingly.

@Emma1963
Copy link

Emma1963 commented Sep 5, 2024

Your comment is a duplicate of #95. Use this repository main branch, build the library, or wait until a NuGet artifact is pushed and your issue is fixed when using ToolTipText.

Or find a library that backports WPF dynamic theming, so that <Tooltip /> is styled accordingly.

Thank you. I built develop branch and tried. It worked. But I am not sure I can use the private build because of company policy.
About the a library to backports WPF theming. Could you please share a example name for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests