Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 290102 - desktop.eclass: make_desktop_entry creates ugly .desktop file names
Summary: desktop.eclass: make_desktop_entry creates ugly .desktop file names
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-22 06:06 UTC by Konstantin
Modified: 2023-09-04 10:36 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
makes .desktop file names more human-readable (eutils_eclass-better_desktop_filenames.diff,412 bytes, patch)
2009-10-22 06:12 UTC, Konstantin
Details | Diff
second try (eutils_eclass-better_desktop_filenames.diff,595 bytes, text/plain)
2009-10-23 04:35 UTC, Konstantin
Details
third try (final?) (eutils_eclass-better_desktop_filenames.diff,1.19 KB, patch)
2009-10-23 06:19 UTC, Konstantin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin 2009-10-22 06:06:22 UTC
typical call eq
make_desktop_entry /usr/bin/xvst xVideoServiceThief xvst 'Qt;AudioVideo;Video'
creates file with quite ugly name
/usr/share/applications/_usr_bin_xvst-xvideoservicethief.desktop

here is a simple fix that makes these names nicer (/usr/share/applications/xvst-xvideoservicethief.desktop for given example)

Reproducible: Always

Steps to Reproduce:
Comment 1 Konstantin 2009-10-22 06:12:33 UTC
Created attachment 207889 [details, diff]
makes .desktop file names more human-readable
Comment 2 SpanKY gentoo-dev 2009-10-22 20:54:12 UTC
Comment on attachment 207889 [details, diff]
makes .desktop file names more human-readable

you missed the entire point.  the naming *guarantees* there will be no collisions.  your change silently allows them.

if you wanted to make a patch that used "nice" names by default but fell back to "full" names when a collision was detected, i'd be ok with that.
Comment 3 Konstantin 2009-10-23 04:35:21 UTC
Created attachment 207956 [details]
second try

add fallback to "full" name if collision was detected
Comment 4 Konstantin 2009-10-23 06:19:26 UTC
Created attachment 207960 [details, diff]
third try (final?)

in second try i forgot about commands in short form, my bad

third try tested with:
	make_desktop_entry /bin/dummy somename
	make_desktop_entry /usr/bin/dummy somename
	make_desktop_entry dummy somename
	make_desktop_entry /usr/sbin/dummy somename
	make_desktop_entry /sbin/dummy somename

got (as expected):
	/usr/share/applications/_bin_dummy-mytest.desktop
	/usr/share/applications/_sbin_dummy-mytest.desktop
	/usr/share/applications/_usr_bin_dummy-mytest.desktop
	/usr/share/applications/_usr_sbin_dummy-mytest.desktop
	/usr/share/applications/dummy-mytest.desktop
Comment 5 SpanKY gentoo-dev 2009-10-24 08:57:00 UTC
[[ ... ]] doesnt need quoting:
[[ -e ${desktop} ]]

but you do need quoting when accessing files like `cat "${desktop}"`

using sed to basically do `basename` is overkill.  use ${foo##*/}.

that cat|grep|sed is wasteful.  just do:
sed -n '/Exec=/s:^Exec=::{p;q}' "${desktop}"

then again, i dont think you need any of that Exec stuff.  just do:
 - start with short name
 - if short name has collision, use long name (what we use today)
 - if long name has collision, abort with `die`

i dont think there are any long name collisions today, and if there end up being ones, we can worry about the problem then.
Comment 6 Andrius Štikonas 2017-04-09 19:46:20 UTC
This might cause some problems on Wayland. .desktop file name must be consistent with application internal name. I tested Plasma Wayland session and e.g. bitcoin-qt shows generic wayland icon in the taskbar (now .desktop file is named bitcoin-qt_%u-bitcoin-qt.desktop but should be org.bitcoin.bitcoin-qt.desktop)
Comment 7 Dominique Michel 2023-09-04 10:36:11 UTC
From the Menu Entry Specification https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html 
the Exec key doesn't need to have the full path. To write only the executable name is enough, the desktop will search in $PATH for it.

So, it is just to use only the exec name, and to let the desktop do its job. Even a wm like fvwm do this very well.