cerebroapp / cerebro

🔵 Cerebro is an open-source launcher to improve your productivity and efficiency
https://www.cerebroapp.com/
MIT License
8.32k stars 454 forks source link

Icon theme #97

Open Djaler opened 7 years ago

Djaler commented 7 years ago

It would be very cool if on Linux Cerebro will use app icons from active theme, not default.

pkajaba commented 7 years ago

This is not that hard.

theme is chosen on this line of code https://github.com/KELiON/cerebro/blob/master/app/main/plugins/core/basic-apps/linux.js#L49

You can get default icon theme for gnome for example this way: THEME=$(gsettings get org.gnome.desktop.interface icon-theme | tr -d "'"). This just get you currently enabled theme and not path, so you would have to figure out whether it's in /usr/share/ or in home directory.

But I doubt that developers would accept pull request which works just for gnome.

maximbaz commented 7 years ago

To be fair this command returns a correct GTK theme even on my ArchLinux ("Adwaita" in my case).

However, I can also see that on my linux none of the installed apps placed their icons in the /usr/share/icons/Adwaita/**/apps/, they only placed them in /usr/share/icons/hicolor/**/apps/ folder.

I think it makes sense to accept a pull request which will look in the theme's folder in addition to the default hicolor one. Just add the line to look in the theme's folder above the line mentioned by @pkajaba, so that it is considered first, but there is still a fallback to the default hicolor.

pkajaba commented 7 years ago

@maximbaz that command is not about distribution but desktop. I doubt that gsettings would work under KDE or anything what is not gnome.

It makes for all applications put their icons into hicolor folder since it's default theme defined by freedesktop: https://specifications.freedesktop.org/icon-theme-spec/latest/ar01s03.html

This is quite funny thing since Settings applications does not have icons inside hicolor folder so it does not match anything.

maximbaz commented 7 years ago

Thanks for the hints, it was interesting to read about this. As it happens, I don't have gnome desktop environment installed, but I do have some bits and pieces of it on my box that were installed by other apps as dependencies (like gtk2, gtk3, and specifically glib2 which provides gsettings binary).

In any case, if there will be a pull request, I would be happy to test it.

KELiON commented 7 years ago

Ok, summarizing: looks like we can use gsettings get org.gnome.desktop.interface icon-theme | tr -d "'" to get theme and after that look up for app icon in the same folders, that we use now + replace hicolor with current theme.

Should be easy change! Thanks @pkajaba

maximbaz commented 7 years ago

@KELiON hicolor should not be replaced, like I mentioned earlier all my app icons are in hicolor despite the fact that my reported theme is Adwaita. Just look in the theme folder first, and if the icon is not there, look in hicolor.

pkajaba commented 7 years ago

It's bit messy, but to summarize it:

The proper way how to tackle this is do some research how KDE or other alternatives handle this and try all possible paths and when icon is not found fallback to 'hicolor'

Djaler commented 7 years ago

Up

Djaler commented 7 years ago

@KELiON, please :D

MPE2016 commented 5 years ago

Hi all,

I would love, love, love to see this feature in cerebro. if anyone would be able to make cerebro use the theme of my choice, that would make me switch to cerebro as my go to app for starting, searching, and everything else.

Now, I still sort of switch between the system stuff (I'm using Linux Mint, cinnamon desktop) and cerebro.

Is there anything I could do to implement this feature?