Unsolved Missing icons on "ssh -X" execution (fallback theme issue)
-
Hello, everybody!
I have a Linux Qt application with a tool-bar consisting of icons loaded using QIcon::fromTheme() with standard action icon names from https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html.
That works mostly fine and the icons look nice and consistent with everything else. However, sometimes users want to execute the application on a different host (where it's installed); they'll open a terminal window and enter a command of the form "ssh -X host myprogram". The remote system is typically running Red Hat Enterprise Linux 6 or 7, while the user is generally logged into GNOME or MATE on the display system. I suspect the behaviour will the the same under different desktop environments, though.
In this scenario, no icons will be displayed - instead, the tool-bar will have buttons with text only. The problem appears to be that Qt fails to identify a desktop system to pick up an icon theme setting from, and assumes the fall-back recommended in the icon theme specification: "hicolor". But, the "hicolor" theme doesn't actually have any action icons under RHEL - I've looked pretty hard for a package that might contain these, but found nothing.
What do you think is the best way around this? I guess everything would work if I set up ssh to transfer environment variables like DESKTOP_SESSION and XDG_CURRENT_DESKTOP, which Qt uses to figure out what desktop is active, but I really want everything to work on a "plain" installation without global config changes... I can also think about some other options, like
- Set DESKTOP_SESSION or XDG_CURRENT_DESKTOP to a hard-coded desktop name internally in the program.
- Specify the platform more directly via QT_QPA_PLATFORMTHEME.
- Just use QIcon::setThemeName().
I'm not sure I like any of them that much, though. Has anyone else come across this issue? What did you do? Also, what's your take on the fact that "hicolor" icons are missing? Is that something to yell at Red Hat about? And, regardless of whether you've had this particular problem, do you generally specify a fallback icon when using QIcon::fromTheme()?
Qt version may be 4.8.5, 5.6.1 or 5.9.2, by the way - depending on the version of my program. (5.9.2 is the latest release provided by Red Hat and CentOS). I see exactly the same in all cases.
Thanks.
Toralf