Tell nemo to open application using gtk-launch instead of xdg-open

I wrote a .desktop file with this content:

[Desktop Entry]
Version=1.0
Type=Application
Name=xls_to_csv
Comment=convert xls to csv using ssconvert
Exec=/path/to/xls_to_csv.sh %u
Icon=edit-copy
Path=
Terminal=false
StartupNotify=false
Actions=
Categories=Copy;Utility

and placed it in ~/local/share/applications.
Next I added this “application” as an “open with” alternative in nemo file manager, so I can right-click on an .xlsx-file, choose open with → xls_to_csv.desktop

This doesn’t seem to work. When I run the command in terminal I get the output
xdg-open: unexpected argument 'test.xlsx'

An alternative seems to be to use gtk-launch, at least in the terminal it works.
Now my question is how to tell nemo to ues gtk-launch for executing my xsl_to_csv.desktop file instead of xdg-open?

System is Manjaro sway edition.

Maybe try

Exec=/usr/bin/sh -c '/path/to/xls_to_csv.sh %u'

For nemo this didn’t change anything.

In terminal probably I can’t really test this, or is there another way than doing it like this?

$ xdg-open ~/.local/share/applications/xls_to_csv.desktop test.xlsx
xdg-open: unexpected argument 'test.xlsx'
Try 'xdg-open --help' for more information.
1 Like

Why not making it into Nemo Action and add it in ~/.local/share/nemo/actions ?
You will have to change

into
[Nemo Action]
I’m sure you can find plenty of references and explanations here:
https://askubuntu.com/questions/190535/is-it-possible-to-use-nautilus-actions-with-nemo-file-manager

https://askubuntu.com/questions/419532/nemo-custom-action-sh-script-does-not-execute

Also, since i guess you do have ~/.local/bin/ and is in the $PATH, why not add your script there and no need to provide /the/longest/path/to/execute/a/small/script

Not sure how your .sh is done, but if in terminal you have to specify the file to convert it, then you also have to do to your context menu (regardless that is a .desktop file or .nemo_action file) how to work on your right clicked file, otherwise will not do anything i guess.

1 Like