Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-10-29 19:45:34

uibits
Member
Registered: 2022-07-02
Posts: 39

[SOLVED] After '.desktop' file edit, 'open with' functionality broken

I edited a .desktop file in /usr/share/applications/

I had to wrap the Exec commands but accidentally wrapped %U in single quotes instead of double. I fixed this but...

Now from Thunar, files of the type that were associated with this program are not opening with it. In fact I can't even select the program from the "Open with..." select dialog.

The program has vanished from the Default Applications program.

Do I have to restart the PC or just a single application?

Do I have to Timeshift to restore?

Last edited by uibits (2023-11-03 16:51:25)

Offline

#2 2023-10-29 23:27:01

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: [SOLVED] After '.desktop' file edit, 'open with' functionality broken

Try re-installing the applications - it should overwrite the file you edited in /usr/share/applications (in case there is a typo in it).

In case you are looking to do this again, its better to copy the .desktop file to ~/.local/share/applications and then edit that version. It will supersede the one in /usr/share/applications and you can always revert by simply deleting the file you created.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2023-10-30 09:26:19

uibits
Member
Registered: 2022-07-02
Posts: 39

Re: [SOLVED] After '.desktop' file edit, 'open with' functionality broken

Hi ToZ, yes, its not best practice to edit files there but I'm thinking what's good for the 'goose' (me) is good for the 'gander' (others using the machine).

The double/single quote issue I mentioned seems to have been a red herring.

So what I'm trying to do is run a program in a (`sg`) group. It works from the Whisker menu, with all programs launching totally normally and inside the group, the big issue seems to be when trying to launch by opening files in Thunar, and not being compatible with Default Applications.

It is something about running the program in groups while *also* trying to provide files to it?

Previous 'exec' commands looked like this:

Exec=/usr/bin/vlc --started-from-file %U
TryExec=/usr/bin/vlc

Changed looks like this:

Exec=sg groupname '/usr/bin/vlc --started-from-file %U'
TryExec=sg groupname '/usr/bin/vlc'

Could it just be the %U being quoted???

Offline

#4 2023-10-30 10:53:12

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: [SOLVED] After '.desktop' file edit, 'open with' functionality broken

TryExec should just be the name of the executable file. It checks to see if it exists before it enables the .desktop file:

Exec=sg groupname '/usr/bin/vlc --started-from-file %U'
TryExec=/usr/bin/vlc

From https://specifications.freedesktop.org/ … atest.html:

TryExec   

Path to an executable file on disk used to determine if the program is actually installed. If the path is not an absolute path, the file is looked up in the $PATH environment variable. If the file is not present or if it is not executable, the entry may be ignored (not be used in menus, for example).


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2023-11-03 16:48:40

uibits
Member
Registered: 2022-07-02
Posts: 39

Re: [SOLVED] After '.desktop' file edit, 'open with' functionality broken

Thanks Toz, that most definately solved the issue.

I am always learning, its scary how much I don't know. Makes me feel so stupid sometimes.

Thanks.:)

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.010 seconds, 7 queries executed - Memory usage: 534.54 KiB (Peak: 535.38 KiB) ]