As indicated in the comment by PretzelJones you don't need to run those files like that, as they can be launched from Slingshot if you put them in
Even more, as explained here by the developer the change is intended to avoid file manager being tricked into executing arbitrary code: therefore, use the below solutions with caution, especially the one intended to execute the desktop file without asking by just clicking (solution no 1), and favor solution 3.
So, if you have some files in
~/.local/share/applications or other places that you must or want to run from Files for any reason, there must be different ways to do it, and the most obvious is to use other file managers to handle the
.desktop files through Pantheon Files, either
- by creating a
~/.local/share/applications/run-desktop.desktop file and make that "application" the default for
.desktop files and thus executing them as before with one or double click, or
- by creating a
contract file to add a special context menu entry in Pantheon Files or, even better
- by creating a
~/.local/share/applications/run-or-edit.desktop file (also using a
zenity script), making that "application" the default for
.desktop files and thus getting a pop-up window asking if you want to run or edit that file.
I have both Thunar and PCManFM installed, and they are both light enough, coming with no supplementary dependencies. (These file managers could be used directly when dealing with the desktop files, and not through Pantheon Files, but that's another matter.)
sudo apt install pcmanfm
sudo apt install thunar
1. To run
.desktop files by double click without asking - by changing the default application for that type of files (the less safe solution):
Name=PCManFM to Run desktop file
Then make it executable:
sudo chmod a+x ~/.local/share/applications/run-desktop.desktop
(or maybe you could try my option here)
Then, selecting any
.desktop file, right-click, 'Properties', and under 'Open with' select that new "application":
You should consider the fact that the above is risky, as already indicated, while the solutions below are safer.
2. To add a context menu entry in Files to execute desktop files by creating a contract file:
Name=Run the desktop file
and you should see the "Run" right-click custom menu:
(To make that context menu option show a "Run or edit" option instead of simply running the file: replace the line
Exec=pcmanfm %f with
Exec=bash -c '/path/to/your/scripts/location/run_or_edit_.sh %f' according to the the next solution below.)
3. To get a pop-up window asking you to chose between run or edit (safest option):
sudo apt-get install zenity
zenity --question --text="What to do?" \
case $? in
Make that script executable.
Name=Run or edit
Exec=bash -c '/path/to/your/scripts/location/run_or_edit_.sh %f'
Make that executable, then selecting any
.desktop file, right-click, 'Properties', and under 'Open with' select that new "application" called 'Run or edit'.
Now when you click a
.desktop file you will get this:
Thunar can be used in the same way as PCManFM.
I find these file managers useful on the system for other purposes too, like for instance to add Thunar's bulk-renaming tool in Pantheon Files and to get pop-up options upon insertion of removable media with PCManFM daemon.