lirios / shell

:shell: Convergent shell for desktops, phones and tables built with QtQuick, Wayland and Material Design
GNU General Public License v3.0
231 stars 14 forks source link

Chrome apps don't have the correct icons in the launcher #5

Open iBelieve opened 8 years ago

iBelieve commented 8 years ago

selection_002

plfiorini commented 8 years ago

What does the .desktop say for the Icon field?

iBelieve commented 8 years ago

Here's the .desktop file for Chrome Remote Desktop:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=Chrome Remote Desktop
Exec=/opt/google/chrome/google-chrome --profile-directory=Default --app-id=gbchcmhmhahfdphkhkmpfmihenigjmpp
Icon=chrome-gbchcmhmhahfdphkhkmpfmihenigjmpp-Default
StartupWMClass=crx_gbchcmhmhahfdphkhkmpfmihenigjmpp

The icons come from ~/.local/share/icons/hicolor:

/home/mspencer/.local/share/icons/
└── hicolor
    ├── 128x128
    │   └── apps
    │       ├── chrome-aohghmighlieiainnegkcijnfilokake-Default.png
    │       └── chrome-pnoffddplpippgcfjdhbmhkofpnaalpg-Default.png
    ├── 16x16
    │   └── apps
    │       ├── chrome-aohghmighlieiainnegkcijnfilokake-Default.png
    │       └── chrome-pnoffddplpippgcfjdhbmhkofpnaalpg-Default.png
    ├── 256x256
    │   └── apps
    │       ├── chrome-bgjohebimpjdhhocbknplfelpmdhifhd-Default.png
    │       └── chrome-pnoffddplpippgcfjdhbmhkofpnaalpg-Default.png
    ├── 32x32
    │   └── apps
    │       ├── chrome-hlffpaajmfllggclnjppbblobdhokjhe-Default.png
    │       └── chrome-pnoffddplpippgcfjdhbmhkofpnaalpg-Default.png
    ├── 48x48
    │   └── apps
    │       ├── chrome-gbchcmhmhahfdphkhkmpfmihenigjmpp-Default.png
    │       └── chrome-pnoffddplpippgcfjdhbmhkofpnaalpg-Default.png
    └── 512x512
        └── apps
            └── chrome-pnoffddplpippgcfjdhbmhkofpnaalpg-Default.png
plfiorini commented 8 years ago

@iBeliever It depends on the theme, I logged the requested icon and the resulting QIcon from the Fluid icon theme image provider with Papirus GTK:

Requested "chrome-dlhghfjpjbjckmefnkkmgechilbmhflf-Default" QIcon("chrome",availableSizes[normal,Off]=(QSize(16, 16), QSize(22, 22), QSize(24, 24), QSize(48, 48), QSize(32, 32)),cacheKey=0

Somehow Papirus GTK provides an icon for Chrome apps. There are icons like chrome.svg and chrome-okdgofnjkaimfebepijgaoimfphblkpd.svg though I don't know how this should affect the lookup exactly.

If I use Adwaita I can see the icon correctly and the log reports:

Requested "chrome-dlhghfjpjbjckmefnkkmgechilbmhflf-Default" QIcon("chrome-dlhghfjpjbjckmefnkkmgechilbmhflf-Default",availableSizes[normal,Off]=(QSize(48, 48), QSize(32, 32), QSize(256, 256), QSize(16, 16), QSize(128, 128), QSize(48, 48), QSize(32, 32), QSize(256, 256), QSize(16, 16), QSize(128, 128)),cacheKey=0x3400000000)

My Chrome application is this page and as you can see here it shows the GH icon:

icon

It might also be a Qt bug but I'm not sure what should I report since it works with Adwaita.

iBelieve commented 8 years ago

Yeah, it looks like somehow Paper is falling back to a generic Chrome icon instead of the original icons when a Paper version of the icon isn't found. I think the original issue was that I didn't have the Hawaii icon theme installed (I've since changed the theme in dconf).

iBelieve commented 8 years ago

Though, that only happens in qmlOS - they properly fall back to the original icons in GNOME.

plfiorini commented 8 years ago

QIcon might have some issue with hicolor.

This is a simple program:

#include <QtWidgets/QApplication>
#include <QtGui/QIcon>
#include <QDebug>

int main(int argc, char *argv[])
{
        QApplication app(argc, argv);
        qWarning() << QIcon::themeName();
        //QIcon::setThemeName("hicolor");
        qWarning() << QIcon::themeName();
        qWarning() << QIcon::fromTheme("rhythmbox");
        qWarning() << QIcon::fromTheme("chrome-dlhghfjpjbjckmefnkkmgechilbmhflf-Default");
        return app.exec();
}

Set XDG_DATA_DIRS=$HOME/.local/share:/usr/share, build and run.

This is the output:

"Papirus-GTK"
"Papirus-GTK"
QIcon("rhythmbox",availableSizes[normal,Off]=(QSize(16, 16), QSize(22, 22), QSize(24, 24), QSize(32, 32), QSize(48, 48)),cacheKey=0x100000000)
QIcon("chrome",availableSizes[normal,Off]=(QSize(16, 16), QSize(22, 22), QSize(24, 24), QSize(32, 32), QSize(48, 48)),cacheKey=0x200000000)

Uncomment the line that sets the theme to hicolor, build and run:

"Papirus-GTK"
"hicolor"
QIcon("rhythmbox",availableSizes[normal,Off]=(QSize(48, 48), QSize(32, 32), QSize(256, 256), QSize(24, 24), QSize(22, 22), QSize(16, 16)),cacheKey=0x100000000)
QIcon("chrome-dlhghfjpjbjckmefnkkmgechilbmhflf-Default",availableSizes[normal,Off]=(QSize(48, 48), QSize(32, 32), QSize(256, 256), QSize(16, 16), QSize(128, 128)),cacheKey=0x200000000)