I'd like to propose an alternative to the changes made from this closed issue:
#56 (closed)
I just updated my system to the newest version of Thunar and my carefully organized desktop shortcut folder was transformed into an untenable mess.
On Thunar 1.8.16, .desktop files with executable permission display the contents of the Name= parameter instead of their filename.
On Thunar 4.16.0, .desktop files will only display their filename.
I'm probably not what you would consider a standard use-case here. Not everyone has directories filled with hundreds of .desktop files. But I do. And the system I had in place was dependent on this older behavior. By keeping the Name= parameter the same for multiple files, I was able to have Thunar randomly sort these files for me. I had a shell script to change the Name= parameter of some files, allowing me to reorganize files without touching the filename. All of this is now no longer possible.
I understand the reasoning behind this change. Normally, .desktop files go in the application menu, or the Desktop. But not for this many files. A file manager is really the only tool that can accomplish this, and up until now Thunar was my file manager of choice.
Rather than just asking to revert the change, I want to propose a solution that could benefit both use-cases.
The old behavior was a toggle. Filenames were displayed if it wasn't marked as executable, and otherwise it was Name=.
Can we add a toggle as a proper setting in the file manager? It should be our choice whether we want to see the filename or the actual desktop shortcut name. It shouldn't only display the filename.
Edited
Designs
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
Sorry for the inconvenience. Though I dont plan to revert the commit and add a toggle setting to show the Application name for some reasons:
That would require additional code to be written, just for a very exotic special case.
When that possible special-setting "show desktop launcher name" is enabled, we would still need to take care for the bugs described in #56 (closed), since it would be possible again to trigger them.
I think your problem can be solved in a different, more simple way: How about renaming all your desktop files to the name of the related Application ?
Here a short script which should do the job for a folder. (Caution, best first comment the 'mv' line to see if it works fine for you/for all possible files, I did not test it properly.
The way that my script currently works is that it edits the shortcut when I launch it. It checks another file for it's number and re-orients and shuffles itself according to the progress that I made, by editing the Name= parameter. The shortcuts have the same name because they point to the same application with different flags and inputs, and have individual icons to differentiate themselves.
It's a very non-standard use-case. Hopefully I did a better job of explaining it this time.
Just to make it perfectly clear, here's the relevant snippet of code that these .desktop files are running:
# Update Quote Totals On .Desktop FilesQ_NUM=0for QUOTE in $(cat $QUOTE_FILE -E | grep "QUOTE: "); do if [[ $QUOTE == *"$"* ]]; then let Q_NUM++; fidonefor LAUNCHER in $(find $LAUNCHER_DIR/$NAME*.desktop); do sed -i "2 c\Name=($Q_NUM) $NAME" "$LAUNCHER"done
Renaming or moving the files in another way is an option I can explore, but moving the files each time I launch the .desktop file seems much less elegant than editing the Name= parameter.
So your script can do the renaming in your for loop already. Looks like you have the LAUNCHER file-Uri and the new name there. Note that you will need to suffix the filename with e.g. some incremental number to make the filename unique in case an application has multiple launchers.
Renaming or moving the files in another way is an option I can explore, but moving the files each time I launch the .desktop file seems much less elegant than editing the Name= parameter.
I think it would be a solid solution to move the files. Yes, it's an additional step, though would as well look clean on console, and is a magnitude less work than supporting name shadowing in thunar
It's not that niche @flameleaf, I also prefer the old way of displaying the Name for executable .desktop-files. But I also understand the implications. „explicit is better than implicit” is probably preferrable to prevent confusion.
What about a hidden option in Xfconf for the old behavior? I miss the old names too. In my case I don't save bookmarks within the browser but within disk folders. Over the years gathered almost 3000 of these web links and as you can imagine maybe having them stored in browser menus is less convenient with this size. Damn I guess I am spending too much time online ^^ But I also understand when the devs wouldn't accept a patch for a hidden setting because of code bloat. I also of course understand the security concerns and I respect that but if I am not mistaken these are still there on Xfdesktop because Xfdesktop still shows .desktop files in the old way. Also we should not forget we have now an inconsistency between Thunar and Xfdesktop which can be confusing too for users. So ladies and gentlemen what do you think about a hidden option in Xfsettings?
On Windows and I believe on MacOS too there are different file types for program starters and web links. On Windows we have the file types .url and .lnk. And I think that makes it easier for web links regarding security concerns. On Linux we have both features in one file which seems to make things more complicated because we always have to be care regarding security.
A web link is basically a program starter that executes the web browser with the target website as an argument.
Security is definitely something to consider, but I thought the old behavior worked well enough. Newly created or downloaded .desktop files would display the full filename. They only changed to displaying the Name= value if the user gave them executable permission.
Ok, fine, you got me. There seems to be a demand for this feature by multiple users. So here is, what I would support:
The xfconf settings needs to be opt-in. Default should be: "show real file names".
No support to rename the launcher name property via "rename". That was just super confusing. Instead show an item "modify launcher", like xfdesktop does. The dialog needs to be re-used in some way (no copy-paste from xfdesktop --> move to libxfce4ui ?).
Like before, "file->display_name" can be used to store the string of the Name-Property. But in addition we need a new thunar_file_get_name and use it over thunar_file_get_display_name wherever it makes sense, in order to prevent all the issues reported in #56 (closed). There is already thunar_file_get_basename for that purpose. It's just about using the correct method at the correct point in time.
So we then would have a new checkbox in the Thunar settings saying something like "Show real file names for launchers"? Have I understand you correctly?
This could be one way to do it but what do you think about the following idea? We could have a checkbox in Thunar settings which says "Show real file name for .desktop files". So when the box is checked it is clear what we do. We show the actual file name for all launchers. But when the box is unchecked we show the name property from within the file but only for .desktop files which are trusted ones via the gvfs sha256 checksum. And for the ones which aren't trusted we still show the actual file name.
This would have several benefits:
We would unify the appearance of .desktop files across Thunar and Xfdesktop and would cause less confusion among users
The setting is not hidden anymore and therefore easier to find
The security would not decrease because untrusted launchers still show the actual file name.
Now that we have trusted launchers via the checksum set in gvfs we could also improve the launchers for Xfdesktop because there is still the old behavior of launchers available meaning we show the name property from within the file even for untrusted launchers. So my proposal would be to show only the actual file name for untrusted launchers on Xfdesktop and for the trusted ones we show the name property from within the .desktop file.
So what do you think about that? Many thanks in advance.
Now that I think a bit more over it maybe there shouldn't be any setting at all and we should just make this what I described above the default behavior. The benefit would be then that we have no further clustering of the settings in Xfce.
Would you like to have one or two separate patches. One for the xfconf setting and one for the correct display name?
Showing the correct display name is working quite good already but for now when one sets the gvfs flag via thunar_apr then the display name is not updated immediately. Instead one has to first press F5 to reload the view in Thunar. Can you get me a basic idea how to correct this? Do I have to send a signal from the Thunar APR plugin to Thunar or what? IPC needed? A certain class or function I can use? Stupid question?
Would you like to have one or two separate patches. One for the xfconf setting and one for the correct display name?
Fine for me to have both together.
How to know that the gvfs flag changed ?
Phew, that is a good question. Maybe G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED is triggered for the file via GFileMonitor on a metadata modification, though I am not sure on that .. to be tested.
Yeah I also got that idea with GFileMonitor. What I found out is that when I toggle the other checkbox "file is allowed to be started as .desktop file" in the same dialogue (thunar apr desktop page) then the icon refreshes immediately. Maybe that does now mean GFileMonitor cannot help us here but I am not sure...
By the way, we have no favicon set for https://developer.xfce.org/. Not a big thing but looks a bit weird when saved as a bookmark in Firefox.
Possibly G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED is missing on one of our file monitors. It's just used once in thunar (Or possibly it does not matter at all, because the flag does not detect metadata changes at all) ... to be tested.
By the way, we have no favicon set for https://developer.xfce.org/. Not a big thing but looks a bit weird when saved as a bookmark in Firefox.
I suppose some running-mouse icon will do. Though dont know which project that website belongs to.
I took the freedom and also asked the guys over at Gnome and got a quite helpful response. So looks like I have to implement this via DBus.
Regarding the favicon we have the same icon for gitlab.xfce.org and www.xfce.org. Maybe we can use that. You mean Gitlab project? Maybe @lastonestanding can help us here?
@alexxcons I have this working now but without listening to meta data changes which would require a workaround via dbus because GFileMonitor doesn't support meta data changes yet. This means the file name of a .desktop file doesn't get updated when somebody marks a .desktop file as secure/unsecure so the user needs to refresh the view of Thunar with F5. By the way, we already have this issue in the current Thunar version 4.18.6 when the user drag n drops an URL from Firefox into Thunar. So my question is would you still be happy to see a merge request without a meta data change listener? I am asking because I am not sure if I have the motivation, energy or brain to implement the listener via the dbus workaround.
This means the file name of a .desktop file doesn't get updated when somebody marks a .desktop file as secure/unsecure so the user needs to refresh the view of Thunar with F5
Afaik that is already the case now, if only the trusted flag is changed ... so should be fine / is a different issue (I suppose we will need to trigger a redraw whenever the flag is set via the properties dialog)
In the properties menu of the .desktop files we now have two checkboxes which have the same function:
Allow file to be executed as program (file permissions tab)
File is allowed to be launched as .desktop file (launcher tab)
I wonder if we could remove one? For example we could remove the checkbox on the launcher tab and move the checkbox "Mark this file as trusted" to the permissions tab. I mean we have duplicate widgets here and I asked myself if this is really necessary. So what do you think?
That's a different story. Please open a separate bug for it to discuss it there. So far the trusted flag is only for launchers. Not sure if it makes sense to as well use it for executables.