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

Wrong icon. Wrong .desktop file. #31

Closed
dusanx opened this issue May 4, 2024 · 21 comments
Closed

Wrong icon. Wrong .desktop file. #31

dusanx opened this issue May 4, 2024 · 21 comments

Comments

@dusanx
Copy link

dusanx commented May 4, 2024

This happens with any program that has multiple .desktop files, including Thunar and emacs. I'll explain on Thunar example.

Thunar file manager has 4 different .desktop files:

> ls /usr/share/applications | grep -i thunar
thunar-bulk-rename.desktop
thunar-settings.desktop
thunar-volman-settings.desktop
thunar.desktop

When I start thunar.desktop, which contains Exec=thunar %U, regular Thunar is started, but (probably due to the same bug I am describing), icon already differs from what nwg-drawer is showing.

If I pin this dock icon, it is stored in .cache/nwg-dock-pinned as 'thunar'. When I click on this icon to start Thunar, first .desktop file (partial match?) is executed, so it starts Exec=thunar --bulk-rename %F as defined in thunar-bulk-rename.desktop, probably because it is alphabetically first to find.

I am aware it may be tricky to figure out what .desktop file is most adequate for the pinned dock icon or running program, but current matching makes dock unusable -- resulting in wrong icon and wrong .desktop file being run.

@dusanx
Copy link
Author

dusanx commented May 4, 2024

Partial solution for the launcher problem would be to be able to pin exact .desktop file in .cache/nwg-dock-pinned but that doesn't solve the problem of showing the wrong icon. I am not sure what is possible here, if I can help with something just let me know.

@nwg-piotr
Copy link
Owner

nwg-piotr commented May 4, 2024

What the dock only knows about running clients are their class names, as reported by Hyprland. In the case of thunar, thunar-bulk-rename and thunar-settings, it's exactly the same string: "Thunar".

❯ hyprctl clients
Window 5a31020b4740 -> piotr - Thunar:
	mapped: 1
	hidden: 0
	at: 2484,965
	size: 1272,682
	workspace: 4 (4)
	floating: 0
	monitor: 1
	class: Thunar
	title: piotr - Thunar
	initialClass: Thunar
	initialTitle: piotr - Thunar
	pid: 47246
	xwayland: 0
	pinned: 0
	fullscreen: 0
	fullscreenmode: 0
	fakefullscreen: 0
	grouped: 0
	swallowing: 0
	focusHistoryID: 3

Window 5a310215ebe0 -> Wsadowe zmienianie nazw:
	mapped: 1
	hidden: 0
	at: 2484,275
	size: 1272,682
	workspace: 4 (4)
	floating: 0
	monitor: 1
	class: Thunar
	title: Wsadowe zmienianie nazw
	initialClass: Thunar
	initialTitle: Wsadowe zmienianie nazw
	pid: 47246
	xwayland: 0
	pinned: 0
	fullscreen: 0
	fullscreenmode: 0
	fakefullscreen: 0
	grouped: 0
	swallowing: 0
	focusHistoryID: 1

Window 5a310208e7c0 -> Preferencje:
	mapped: 1
	hidden: 0
	at: 2676,581
	size: 798,586
	workspace: 4 (4)
	floating: 1
	monitor: 1
	class: Thunar
	title: Preferencje
	initialClass: Thunar
	initialTitle: Preferencje
	pid: 47246
	xwayland: 0
	pinned: 0
	fullscreen: 0
	fullscreenmode: 0
	fakefullscreen: 0
	grouped: 0
	swallowing: 0
	focusHistoryID: 2

I can't think of a way to resolve the issue. IMO the problem is on the Thunar side.

@dusanx
Copy link
Author

dusanx commented May 4, 2024

I understand the problem and could ignore Thunar but same happens with emacs, which is something I wouldn't avoid.
From one angle they are not separate programs so there is nothing wrong with app class, it is the same Thunar executable with different parameters. But in my tests, nwg-dock-hyprland doesn't select thunar.desktop (which exists and exactly matches class name), it selects thunar-bulk-rename.desktop (as first thunar*.desktop match?) which is wrong.
Same thunar* matching is the reason why pinning Thunar executes wrong .desktop file.
If nwg-dock-hyprland would match class exactly then it would show main app class icon and execute main app class .desktop file, right?

@nwg-piotr
Copy link
Owner

If I understand well, this would be a partial solution. Let me make some experiments.

@nwg-piotr
Copy link
Owner

nwg-piotr commented May 4, 2024

Could you clone and make run from the hyprdir branch? Kill the resident dock instance first, if you're running one.

@nwg-piotr
Copy link
Owner

Well, I'll merge and release this branch one way or another, as the current 0.1.7 version won't work on Hyprland 0.40. Let me know how it behaves on your side.

@dusanx
Copy link
Author

dusanx commented May 5, 2024

Could you clone and make run from the hyprdir branch? Kill the resident dock instance first, if you're running one.

Thank you, I'll test today and report back.

@dusanx
Copy link
Author

dusanx commented May 5, 2024

Hi @nwg-piotr did you push? This repo only has master branch?

@dusanx
Copy link
Author

dusanx commented May 5, 2024

D'oh it is merged in master. So launchers are perfect with this update, icon still looks wrong for Thunar. They don't go both trough the same code?

@nwg-piotr
Copy link
Owner

nwg-piotr commented May 5, 2024

They don't go both trough the same code?

They do.

What's wrong about Thunar icons? I have 2 different ones.

obraz

@dusanx
Copy link
Author

dusanx commented May 5, 2024

WhiteSur-dark icon theme (and others),

First image shows dock without Thunar, with nwg-drawer showing proper Thunar icon for this theme (looking like Mac finder, highlighted):
1

Second image is when I click on "Thunar File Manager" in nwg-drawer that actually points to regular thunar.desktop, executing Thunar:
2
As you can see Thunar is 5th icon from the left, showing folder icon instead of Thunar icon.

At all times nwg-drawer shows proper theme icon, which should be also visible in dock after starting the app, but it is not.

I tested with few more themes and it seems it is not theme dependent, WhiteSur only being good for showing the problem.

@dusanx
Copy link
Author

dusanx commented May 5, 2024

thunar.desktop contains only one Icon definition:
Icon=org.xfce.thunar where org.xfce.thunar translates to /usr/share/icons/WhiteSur/apps/scalable/org.xfce.thunar.svg (it is the only org.xfce.thunar I have), which looks exactly as on first screenshot (as shown in nwg-drawer). I can't figure out from where did icon in dock arrive, makes no sense.

Edit: also to confirm that hyprctl clients reports running Thunar with class: thunar, so everything checks out that thunar.desktop should be used to show the icon.

@nwg-piotr
Copy link
Owner

nwg-piotr commented May 5, 2024

On my machine org.xfce.thunar looks like a folder icon (theme: WhiteSur-nord-dark).

obraz

I see this certain icon in the dock, but a different one in the drawer.

obraz

@dusanx
Copy link
Author

dusanx commented May 5, 2024

I'll install nwg-icon-picker and try but I am 99% certain that drawer picks the right icon, when I manually follow the paths, finder like icon is the only one named org.xfce.thunar. Let me test and I'll report back.

@nwg-piotr
Copy link
Owner

Just an idea: you could copy your thunar*.desktop files to ~/.local/share/applications/ and edit them to point to whatever icon you want.

@dusanx
Copy link
Author

dusanx commented May 5, 2024

This is super odd, with this test theme I am using https://aur.archlinux.org/packages/whitesur-icon-theme, org.xfce.thunar icon looks exactly as it should, same as in drawer, but it doesn't show that icon in dock:

20240505_12h56m22s_grim

Re copying .desktop, I will try but this finder icon is already the only one I have with org.xfce.thunar, even if I copy it it will stay the same. I can try changing to something else but I suspect that's not the solution.

@dusanx
Copy link
Author

dusanx commented May 5, 2024

Wait, why nwg-icon-picker shows finder like icon in the list (the highlighted line) but right below title, top of the window, shows same wrong folder icon as in dock?! Please see my screenshot.

@nwg-piotr
Copy link
Owner

No idea. It must wait at least till the evening, as I'll have to leave in 15 minutes. For now I only know that thunar icons are a mess.

@dusanx
Copy link
Author

dusanx commented May 5, 2024

I'll try figuring something out, thanks. nwg-icon-picker is a great tool btw, I was almost ready to write something similar. I bet the current problem is something in the line of dock matching icon with class instead of with what .desktop file says. No rush, I'll give it a try too, bit rusty in go but I can manage.

@nwg-piotr
Copy link
Owner

I bet the current problem is something in the line of dock matching icon with class instead of with what .desktop file says.

Most probably. Nwg-drawer just reads all the .desktop files, while the dock only knows the class value.

@dusanx
Copy link
Author

dusanx commented May 5, 2024

In conclusion, wrong icon seems to be deeper problem on the GTK level. Experimenting with nwg-icon-picker, loading icon to pixbuf with gtk_icon_theme.load_icon(name, 24,... results in loading correct icon, setting same name with icon_info.update(name) and wrong icon may be loaded. I stopped digging at this moment as it shows inconsistency across GTK.

Solution: make dang .desktop copy in ~/.local/share/applications/ and select icon that doesnt.have.stupid.name that could confuse GTK. Closing.

@dusanx dusanx closed this as completed May 5, 2024
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

No branches or pull requests

2 participants