App icon specified in .csproj file doesn't appear on app windows on (at least) Kubuntu Linux and Linux Mint
See original GitHub issueDescribe the bug
On Linux (or at least KDE Plasma?), the icon specified in the .csproj file for an Avalonia project (via ApplicationIcon
) doesn’t appear on the application’s windows when it is run.
To Reproduce Steps to reproduce the behavior:
- Add the
<ApplicationIcon>ICON_NAME_HERE.ico</ApplicationIcon>
element to aPropertyGroup
in the .csproj file for an Avalonia project, ensuring that ICON_NAME_HERE refers to the name of an ico file that exists there - Build and run the project on Linux (tested on Kubuntu Linux 20.04, and also I think on some version of Linux Mint)
- Look at the application window’s presence on the Taskbar/Dock/whatever, and in its titlebar (if it has one, and if the current setup is supposed to show windows’ icons in their titlebars)
- Notice that both are icon’t (or, in less playful terms, notice that the app icon is simply…not present)
Expected behavior The icon should appear in the Taskbar/Dock/etc, and titlebar…some Window Managers/Desktop Environments/etc may not show these elements, but a stock install of Kubuntu 20.04 should, and does so successfully for other apps…just not for this one.
Screenshots
On Kubuntu 20.04:
On whatever version of Linux Mint or whatever it is @jmacato uses:
Desktop (please complete the following information):
- OS: Kubuntu, Linux Mint
- Version: 20.04 (Kubuntu), not sure what version of Linux Mint…@jmacato, as it was in his screenshot on Gitter
Additional context https://github.com/mike-ward/Loon is known to be affected by this, as was discovered when I was aiding @mike-ward in documenting how to build this app on Linux earlier today.
Also, it should be noted that I was able to work around the issue by adding
Icon="avares://Loon/app.ico"```
to the opening tag of Loon's `Views/MainWindow.xaml`, though this seemed like more of a dumb workaround than anything, so I figured we'd best bring this up just in case.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (8 by maintainers)
That’s definitely a thing Windows does, yes…but I’ve just observed a bit of a wrinkle in your explanation: The icon is embedded when building on Linux, as can be determined via software such as Resource Hacker.
Now I’m wondering if Windows may automatically propagate the app executable’s icon to its windows, while I guess Linux doesn’t. If that’s correct, then…this creates a bit of a problem: some Linux users will specify custom icons for their apps via .desktop files.
I don’t know if other Linux apps are able to detect whether or not the user has done this and show the custom icon on their window accordingly…but if it can be done, I’d say Avalonia should do so.
If it were my call, I would say that if the user has specified a custom icon for their program, Avalonia should propagate the icon they’ve provided to any app windows for which no icon is explicitly specified by the app’s developer. If they haven’t, then I suppose the sensible course of action would be to do the same thing, but with the icon embedded into the program itself.
This leads to two other considerations:
Maybe this stackoverflow question can help for Windows:
<ApplicationIcon>nome.ico</ApplicationIcon>
` <PropertyGroup>
</PropertyGroup>`