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

[BUG] Rofi can't show icons of desktop entries when the desktop entry contains a path for the icon #1977

Closed
2 tasks done
Samueru-sama opened this issue Apr 17, 2024 · 25 comments
Labels
Milestone

Comments

@Samueru-sama
Copy link

Rofi version (rofi -v)

Version: 1.7.5 (Also happens with rofi-git).

Configuration

https://gist.github.com/Samueru-sama/7fa680f9a3485756aef1141e2fcacee4

Theme

https://gist.github.com/Samueru-sama/4b1976c1abdccd4e469599922184ba3f

Timing report

No response

Launch command

rofi -show-icons -show drun

Step to reproduce

This issue happens when the .desktop file contains a path to an icon in /opt. It doesn't happen if the icon is in $HOME oddly enough.

image

This issue also only happens with rofi, as other application launchers like the whisker menu for the xfce4-panel don't have this issue, neither thunar has the issue.

image

Expected behavior

The icon should just display like it does when the Icon= path in the desktop file points to home instead.

Actual behavior

Icon doesn't display.

Additional information

No response

Using wayland display server protocol

  • No, I don't use the wayland display server protocol

I've checked if the issue exists in the latest stable release

  • Yes, I have checked the problem exists in the latest stable version
@Samueru-sama Samueru-sama changed the title [BUG] Rofi can't show icons of desktop entries when the desktop entry [BUG] Rofi can't show icons of desktop entries when the desktop entry contains a path for the icon Apr 17, 2024
@DaveDavenport
Copy link
Collaborator

Can you pastebin a desktop file?

@DaveDavenport
Copy link
Collaborator

Rofi does 'g_path_is_absolute' on the icon passed to load (before it queries the icon theme), and loads it directly if that returns true.
So I wonder why it fails.

@Samueru-sama
Copy link
Author

Can you pastebin a desktop file?

[Desktop Entry]
Version=1.0
Exec=es-de
Icon=/opt/es-de/icons/es-de
Terminal=false
Type=Application
StartupNotify=true
Hidden=false
Categories=Game;Emulator;
Name=ES-DE
GenericName=Emulator Frontend
Keywords=emulator;emulation;front-end;frontend;

If I change the path in the icon for any random image in my $HOME the issue gets fixed, it is when the Icon= path points to /opt that it can't display it.

@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Apr 18, 2024

Is this an image? rofi looks for valid file extension (maybe not in this case, but this looks odd):

Icon=/opt/es-de/icons/es-de

@Samueru-sama
Copy link
Author

Samueru-sama commented Apr 18, 2024

Is this an image? rofi looks for valid file extension:

Icon=/opt/es-de/icons/es-de

Yes it is an image, however it doesn't have the .png extension.

image

I just tested adding the .png to the image and it didn't work.

image

@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Apr 18, 2024

weird.. it does a gdk_pixbuf_new_from_file_at_scale on the path.. can you attach the image?

(if you add .png, did you also update the desktop file?)

I cannot find this file in the appimage..

@Samueru-sama
Copy link
Author

Samueru-sama commented Apr 18, 2024

weird.. it does a gdk_pixbuf_new_from_file_at_scale on the path.. can you attach the image?

(if you add .png, did you also update the desktop file?)

It isn't just this image, it is any image from any application installed in that location. And even more weird, if I move the image to my home and change the path it suddenly works:

image
image

I cannot find this file in the appimage..

es-de was installed with AM, this: https://github.com/ivan-hc/AM It often pulls the icon from the repo or other sites.

You can quickly test this by doing an am -i es-de or any other application.

AM has a portable mode called appman where the appimages and icon get installed in home instead of /opt, when that is used then rofi has no issue displaying the icons in the .desktop path, only when it is in /opt it is that this happens.

@DaveDavenport
Copy link
Collaborator

Can't you just attach the image? I don't want to install weird tools just to test?

@DaveDavenport
Copy link
Collaborator

Looking at the code, no extension it is not loaded.
There is no code in rofi that should not load from /opt.

@DaveDavenport
Copy link
Collaborator

Converting the svg to png myself:
rofi-2024-04-18-2224-00000

Putting it in /opt/es-de/ etc with the png extension and adding .png in desktop file and it loads fine.

(process:19050): Helpers.IconFetcher-DEBUG: 22:24:33.241: Query: /opt/es-de/icons/es-de.png(85)
(process:19050): Helpers.IconFetcher-DEBUG: 22:24:33.241: Found path: /opt/es-de/icons/es-de.png
(process:19050): Helpers.IconFetcher-DEBUG: 22:24:33.250: Got surface from pixbuf: /opt/es-de/icons/es-de.png

@DaveDavenport
Copy link
Collaborator

I suspect this is the issue: https://github.com/davatorium/rofi/blob/next/source/rofi-icon-fetcher.c#L357
and it will work when setting a correct extension.

@Samueru-sama
Copy link
Author

Can't you just attach the image? I don't want to install weird tools just to test?

es-de

Once again the issue isn't with the image, happens with all other apps in that location:

image

And if I go and move the librewolf icon from /opt, place it in home and edit the .desktop file to change the path of the icon to point to home it works.

@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Apr 18, 2024

I do not think it is the location. I have many things in my /opt that show up just fine.

If it is an absolute path, there is no code that checks 'location'.. there is code that checks for a extension.
I think that code is wrong, you can test that by renaming a file to have a .png and update the .desktop file to poin the file with the .png extension.

You said you did this, so I want to double check the file, to check that we are not hunting two different bugs.

@DaveDavenport
Copy link
Collaborator

Or try latest git, where I removed that check.

@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Apr 18, 2024

https://github.com/davatorium/rofi/blob/next/source/rofi-icon-fetcher.c#L302 <-- here we check absolute path.
https://github.com/davatorium/rofi/blob/next/source/rofi-icon-fetcher.c#L303 <-- here we set icon_path to this path.
https://github.com/davatorium/rofi/blob/next/source/rofi-icon-fetcher.c#L368 <-- here we load the image.
No path check .

(It worked in your homedir because it check for extension is broken and it checks for a '.').

@DaveDavenport
Copy link
Collaborator

Fixed in: 9b6e70b

@DaveDavenport DaveDavenport added this to the 1.7.6 milestone Apr 18, 2024
@Samueru-sama
Copy link
Author

Also happens with rofi-gi

I did try rofi-git as well (mentioned in the first comment of the issue).

Here is a video showing everything (and how it gets fixed when I move the icon to a different place in home): https://streamable.com/trhsno

But looks like I came too late, will update rofi-git again and update this.

@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Apr 18, 2024

It works in home, as then it has a '.' in the file path ('/home/{user}/.local/'). This was a silly test (no idea why it was there).
This test is removed and should fix your issue.

@DaveDavenport
Copy link
Collaborator

I did try rofi-git as well (mentioned in the first comment of the issue).

I've updated git, that is why I suggested that.

@Samueru-sama
Copy link
Author

I did try rofi-git as well (mentioned in the first comment of the issue).

I've updated git, that is why I suggested that.

Alright I don't know if I need to wait for the rofi-git aur package to update, because I just reinstalled it and the issue of the video is still there. (Will reboot right now just in case that is needed).

@DaveDavenport
Copy link
Collaborator

No reboot needed.
I reproduced the issue you had with the above desktop file and image.. then it indeed did not work for me
after this commit it works for me.

@DaveDavenport
Copy link
Collaborator

can you pastebin the output of rofi -v to check if you are indeed on latest.

@Samueru-sama
Copy link
Author

Samueru-sama commented Apr 18, 2024

No reboot needed. I reproduced the issue you had with the above desktop file and image.. then it indeed did not work for me after this commit it works for me.

It woks now, I had to reboot for some reason though. Thank you!

EDIT: Likely rofi didnt fully quit as I use it for other stuff in my system.

@DaveDavenport
Copy link
Collaborator

It woks now, I had to reboot for some reason though. Thank you!

Happy to hear it works.
Not sure why you need to reboot archlinux , rofi does not keep running, so every launch should be a new instance.

Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants