-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wf-dock] improved icon search. #82
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think we should finally put this code in some shared place, because it is duplicated for panel's window-list too https://github.com/WayfireWM/wf-shell/blob/master/src/panel/widgets/window-list/toplevel.cpp#L643
Would you like to do that? (there are already shared things in src/util/
)
I think I can do it, maybe it can be moved to src/util/gtk-utils.hpp or create a separate src/util/gtk-iconprovider.hpp file. What do you think is more desirable? |
I think it is fine to put it in gtk-utils |
* Added improved set_image_from_icon() that also uses an app basename for icon lookup, eg: an app id 'org.name.appname' may fail but the basename 'appname' may work. * Added get_desktop_app_info() that takes into consideration a user ~/.local/share/applications directory for custom apps. Also searches the app basename and if everything fails performs a best match lookup using g_desktop_app_info_search() which works for applications like pamac that report an appid of pamac-manager but uses a desktop file named org.manjaro.pamac.manager.desktop * Improved set_image_icon() to also take into consideration image names that may be an absolute path to an icon file since some .desktop files declare the 'Icon' property as a path to image.
* Removed desktop app info loading function from IconProvider. * Removed not used anymore tolower() from IconProvider.
* Also search lower case appid basename. * If appid is divided by dashes search the first component which works for blueman-applet and others. * If appid is divided by dots and nothing was found take each component and try to find a matching desktop file, works for applications that report appid as appname.arch/ext and the desktop file is appname.desktop * Added workaround for visual studio code. * Check if DesktopAppInfo has the 'Icon' key to prevent crash.
|
||
app_id_variations.push_back(app_id); | ||
|
||
// If appid has dashes add first component to search |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds too hacky. Which clients require this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One example would be blueman which has .desktop files:
- blueman-adapters.desktop
- blueman-manager.desktop
- bluetooth-sendto.desktop
If I click on the blueman tray icon (using waybar for tray support) and select 'Local Services' the reported appid is blueman-applet and no icon is found. With the discussed code an icon related to blueman is properly picked instead of unknown.
} | ||
|
||
// If app has dots try each component | ||
if (!app_info && app_id.find('.') != std::string::npos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we already had a heuristic above (line 143) which handles this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On line 143 the search is for the last component of the application, for example, some applications have the appid properly named org.somename.appname but the .desktop file is named appname.desktop so this works on this cases.
Line 226 is when the app id is reported as appname.ext where ext (like in some games) can be the architecture of the application eg: gamename.x86_64 or gamename.aarch64, etc... In this kind of cases a desktop file gamename.desktop exists and with this method it is properly found. We perform this method as last because all previous searching method should have higher priority and for applications that provide a proper appid (org.name.appname) and desktop file (org.name.appname.desktop) it would result on picking an incorrect icon.
…esktop_app_info_search().
…ktop_app_info() to properly use user overrides of .desktop files.
Fixes application icons not found like Quassel Client where the icon is not named org.kde.quassel but quassel or Wayfire config manager which .desktop file is not named org.gtk.wayfire-config-manager.desktop but instead wayfire-config-manager.desktop.