fabiospampinato / vscode-open-in-application

Open an arbitrary file in its default app, or the app you want.
MIT License
19 stars 0 forks source link

Support `*.desktop` applications #2

Open AnnyCaroline opened 5 years ago

AnnyCaroline commented 5 years ago

Hi,

I have a app.desktop file that receives a file as input. It is not installed (i.e. located in /usr/share/applications or ~/.local/share/applications). My current configuration is:

"openInApplication.applictions": {
    "txt": ["/home/user/Desktop/run/app.desktop", "other app"]
} 

But when I try to open a file using "Open in Application" simply don't work. How can I use "Open in Application" with .desktop files, them?

fabiospampinato commented 5 years ago

But when I try to open a file using OpenWith simply don't work. How can I use OpenWith with .desktop files, them?

What is OpenWith? Are you using another extension instead of this one?

This extension uses open under the hood, which in turns uses the xdg-open script under linux, if you can properly open that app using this script you should be able to use this extension as well.

Maybe it's not working at the moment because your app.desktop doesn't handle the file that gets passed to it? Or doesn't it open at all?

AnnyCaroline commented 5 years ago

What is OpenWith? Are you using another extension instead of this one?

Sorry for the error, I was referring to "Open in Application".

This extension uses open under the hood, which in turns uses the xdg-open script under linux, if you can properly open that app using this script you should be able to use this extension as well.

I didn't understand it. I thought xdg-open only opens a file using the default application.

Maybe it's not working at the moment because your app.desktop doesn't handle the file that gets passed to it? Or doesn't it open at all?

It doesn't open at all. My .desktop file works, since I can drag & drop a file to it.

fabiospampinato commented 5 years ago

@AnnyCaroline could you post your .desktop file so that I can try to reproduce the problem?

AnnyCaroline commented 5 years ago
[Desktop Entry]
Name=MyDesktopFile
Comment=Run application
Exec=bash -c 'cd $(dirname %k) && $(dirname %k)/../run/make-desk.sh %U && read -n1 -r -p "Press any key to continue..." key;'
Type=Application
Terminal=true
Icon=star

My make-desk.sh used to do a lot of things. For testing, now it simply echos $PWD.

fabiospampinato commented 5 years ago

Thank you, I'll try to find the time for testing this 👍

fabiospampinato commented 5 years ago

I'm sorry but I didn't have the time to try to fix this, if anyone could help with this I'd appreciate it.