So I've been trying to figure out how to give an SFML program the right icon or set of icons on each OS so that you see all the right-sized icons in all the right places, just like any professional program.
On Windows and Mac I believe I've already accomplished that (after modifying the SFML source code a little), but on my Ubuntu VM I'm getting some ludicrously inconsistent results, and I have no idea whether to blame myself, SFML, Ubuntu, Unity, X, or VMware.
When building from source I use CMake just as the tutorial describes, with BUILD_SHARED_LIBS turned off (I like static linking) and SFML_BUILD_EXAMPLES turned on (since they make great test programs), and all other variables left on their default values. The source code itself is the official 2.1 release (I don't recall seeing any chances since then which might affect icons on Linux).
For the record I did a LOT of tests besides what I describe here. I'm posting this one because here I decided to "steal" Firefox's icon in order to make absolutely sure I wasn't using the wrong size or wrong format or wrong folder or anything like that.
So after building everything, what I did was make a simple desktop entry with "Icon=firefox", since that's the exact line used in Firefox's desktop entry, and have its Exec line point to the SFML example program called "opengl." I also modified opengl.cpp so that it loads firefox.png into an sf::Image which it then passes to setIcon(). I've confirmed that I'm loading the right firefox.png because changing its name causes the real Firefox to lose its icon too. I've also confirmed in Pinta that it's exactly 128x128, which is the size I pass to setIcon.
For some strange reason, at best I get the Firefox icon in the sidebar and alt+tab menu but very blurry. Sometimes I get Ubuntu's placeholder question mark. And sometimes I get no icon at all; my program simply doesn't appear in the sidebar or the alt+tab list at all. I've taken screenshots of all three of these cases, with the real Firefox browser running at the same time so you can clearly see the difference in icon resolution. You can also see the code I added in opengl.cpp and the desktop entry I used and part of the opengl test window itself (with the spinning wooden cube).
These pictures were taken with my iPhone because it appears impossible to take a regular screenshot with the alt+tab menu open.
Case 1: Blurry custom icon in both places, Firefox has non-blurry custom icon
Case 2: Default question mark icon in both places, Firefox still has non-blurry custom icon
Case 3: No icon at all in both places, Firefox still has non-blurry custom icon
These three screenshots were taken during the same series of tests. All I did was close and reopen the "opengl" test program several times (and I opened it by double clicking on the desktop entry, of course) until all three cases appeared. How common each one is seems to be completely random, though I feel like the frequency of #2 is correlated to how recently I recompiled.
So, any idea what layer of software I should be blaming for this bizarre behavior? I want to think it's Unity/Ubuntu, but every other program consistently has a non-blurry custom icon. So then I want to think it's SFML, but what the hell could it be doing to cause a random distribution of these three behaviors? I guess it could be VMware, but then it makes no sense that this would only be happening to my test program and nothing else in the VM.
I *think* that's all the potentially relevant information, but do tell me if I left something out.