App icons under wayland show as a W

David Boddie david at boddie.org.uk
Wed May 12 17:16:03 BST 2021


On Wednesday, 12 May 2021 14:14:50 CEST Barry Scott wrote:
> > On 11 May 2021, at 23:12, David Boddie <david at boddie.org.uk> wrote:

> > How are you setting the icon? Are you also setting the application name?
> 
> I use the setWindowIcon() on my main window passing a QIcon object that
> was created from a resource built into the app.

OK. That sounds reasonable. It's what I thought you might have done.

> > The reason I ask is because I encountered an issue with GTK applications
> > where the application name/ID needed to match the program name in order
> > for Wayland to match up the application with its icon.
> 
> What is "application name/ID" in this context?
> Is it the name of the .desktop file?
> Is it the filename of the Exec= line in the .desktop file?
> Is it the filename of the running process?

In the case I was looking at, bearing in mind that this was with GTK, the
ID was the fully-qualified name (com.example.first_application) and this was
set at run-time as the filename of the running process:

https://source.puri.sm/Librem5/example-apps/first-application/-/blob/master/
src/main.py#L19

It might be that you don't need to worry about the program name, but the
window icon name may well be something you need to deal with. See this (old)
blog for a note about that (under "Setting window icon"):

https://blog.martin-graesslin.com/blog/2015/07/porting-qt-applications-to-wayland/

> But the icon on top-right corner of the main window is still the
> W. I have some more experiments to try and will update then.
> 
> BTW I'm going this under KDE Plasma desktop.

I don't know if Plasma has a workaround for the window icon issue when
running on top of Wayland. Even if it has, you might want to find a more
general solution so that you can ensure that window icons appear in other
environments.

David




More information about the PyQt mailing list