Skip to content
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

GWL: Set reasonable min width for panel item ... #12339

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fredcw
Copy link
Contributor

@fredcw fredcw commented Aug 6, 2024

... in case application icon is missing.

Fixes: #12307

@mtwebster
Copy link
Member

If the application icon is missing there should be a placeholder/missing-image icon, not an empty space - I don't think this is a good way to address that issue.

@fredcw
Copy link
Contributor Author

fredcw commented Aug 6, 2024

The problem is that app.create_icon_texture_for_window() and app.create_icon_texture() return an StIcon with no indication that the icon is missing and I don't see any obvious way to detect that. I have the same problem in Cinnamenu. I'll have another look later to see if I can find a way to do it.

@fredcw
Copy link
Contributor Author

fredcw commented Aug 6, 2024

Ah, it seems that both app.create_icon_texture_for_window() and app.create_icon_texture() should return the icon application-x-executable where no other icon is found. But these don't seem to be working reliably.

@mtwebster
Copy link
Member

I think since the example app/theme (breeze/alacarte) are defined and have a matching desktop file (so are not window-backed), we're calling cinnamon_app_create_icon_texture ().

That gets the icon info from the GAppInfo (the desktop file representation) and never check if it's available before returning a useless StIcon.

This could be fixed easily in StIcon (checking the theme for the icon before trying to use it) but we'd lose the ability to have different context-dependent fallback icons (default app icon for gwl, missing image icon in other places, etc...).

It makes the most sense to check this as part of cinnamon_app_create_icon_texture () maybe using gtk_icon_theme_lookup_by_gicon (), but desktop files can also use an absolute path for their Icon entry - now you're checking if a file exists, which is racy...

I don't have a good answer yet lol I was just digging a bit.

@fredcw
Copy link
Contributor Author

fredcw commented Aug 10, 2024

I think I have a solution. On line https://github.com/linuxmint/cinnamon/blob/master/src/cinnamon-app.c#L188 instead of g_themed_icon_new, use g_themed_icon_new_from_names.

I'm not sure how to do it in C but in JS I can use Gio.ThemedIcon.new_from_names(['bob','application-x-executable']) instead of Gio.ThemedIcon.new('bob') to get the 'application-x-executable' icon if 'bob' doesn't exist.

@fredcw
Copy link
Contributor Author

fredcw commented Aug 10, 2024

Actually, this only solves the problem for cinnamon_app_create_icon_texture_for_window but not for cinnamon_app_create_icon_texture.

In cinnamon_app_create_icon_texture, line 303:

icon = g_app_info_get_icon (G_APP_INFO (app->info));

also returns an invalid gicon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grouped window list item become a difficult-to-see thin bar if the application specifies an unavailable icon
2 participants