https://bugs.kde.org/show_bug.cgi?id=509990
--- Comment #19 from [email protected] --- (In reply to Zamundaaa from comment #16) > (In reply to equeim from comment #15) > > How would an app activate itself when its tray icon (or tray icon context > > menu action) is clicked? It doesn't receive an activation token like it does > > when e.g. notification is clicked, and it can't request a token from > > compositor because it's not in focus at that moment. > It does receive an activation token when you click the tray icon, but > activating from the context menu is indeed still broken. > > If you're interested in fixing it, > https://invent.kde.org/plasma/kwin/-/issues/186 has a few people in it that > know more about SNI than I do and may be able to give some pointers for > where to look. Thanks, I didn't know it was already supported by the protocol. > Actually, I just looked a bit at plasma workspace code myself, and figured > out how to fix that case :) It actually doesn't work for direct clicks on tray icon either, when using Qt apps that make use of QSystemTrayIcon. I think I figured it out why: Inside KDE session Qt apps use KDE's platform integration plugin which provides its own QSystemTrayIcon implementation that goes through KStatusNotifierItem. KStatusNotifierItem supports SNI's ProvideXdgActivationToken method, and it is implemented through KWindowSystem::setCurrentXdgActivationToken(). However, KWindowSystem's window activation mechanism is not integrated with Qt's built-in xdg-activation support (that was added in Qt 6.5 IIRC) and so when application code shows the window on QSystemTrayIcon::activated signal, activation doesn't happen. KWindowSystem::setCurrentXdgActivationToken only sets its own internal state which Qt doesn't know about (https://github.com/KDE/kwindowsystem/blob/5d038c249493ef3704a3ee3599634b8ca711a8f0/src/platforms/wayland/windowsystem.cpp#L103C20-L103C35). Qt's own mechanism works by setting XDG_ACTIVATION_TOKEN env variable that's automatically read from (and cleared) when a window is shown. -- You are receiving this mail because: You are watching all bug changes.
