I want to run .desktop files from the terminal and dmenu. From the terminal, it should ideally be run with ./app.desktop or /path/to/app.desktop, and app.desktop would be put in a $PATH directory. I'd rather not have to use an external command like gtk-launch app.desktop.
Additionally, I've found that gtk-launch doesn't always work to launch the application with gtk-launch app.desktop, and even when it does work, putting #!/path/to/gtk-launch at the top of the .desktop returns the error gtk-launch: no such application ./app.desktop when I run ./app.desktop with it executable.
I'm using bspwm and generally prefer launching things from the terminal or with dmenu_run so I don't have a desktop from which I can click on the .desktop files to launch them.
How can I make the .desktop files executable?
xdg-open app.desktop, it doesn't run theExec=line but instead runs$EDITOR app.desktopwhich opens the.desktopfile for editing in nvim for me withoutperl-file-mimeinfoinstalled (I'm on Manjaro). Withperl-file-mimeinfo, it opens thepath/to/app,desktopin my browser, which then prompts me to download the file. How should I configurexdg-opento correctly open the application? – ChocolateOverflow Dec 30 '20 at 02:15content-type: application/x-desktopbut tries to edit them. For confirmation I tested with the example from this answer. – village Jun 15 '23 at 09:01