2 deleted 13 characters in body
source | link

I'm trying to write a script that launches the default application for a given mime type. For example, I would like to say my-script text/plain and have it open KWrite for me.

What I know is that you can use xdg-mime to query what is the default application for a given mime type

$ xdg-mime query default text/plain
org.kde.kwrite.desktop

However, I don't know what is the command-line command I can use to launch KWrite given org.kde.kwrite.desktop. How can I do that? Is having the name of the desktop file enough or do I also need to find out where it is stored (/usr/share/applications, .local/share/applications, etc)?


By the way, I don't think I can solve my original problem using xdg-open because XDG open expects to receive a filename or URL as a parameter and I want to be able to launch my applications without needing to pass a filename. For example, I want to be able to open the text editor on a blank file buffer or open my web browser on its home page.

I'm trying to write a script that launches the default application for a given mime type. For example, I would like to say my-script text/plain and have it open KWrite for me.

What I know is that you can use xdg-mime to query what is the default application for a given mime type

$ xdg-mime query default text/plain
org.kde.kwrite.desktop

However, I don't know what is the command-line command I can use to launch KWrite given org.kde.kwrite.desktop. How can I do that? Is having the name of the desktop file enough or do I also need to find out where it is stored (/usr/share/applications, .local/share/applications, etc)?


By the way, I don't think I can solve my original problem using xdg-open because XDG open expects to receive a filename or URL as a parameter and I want to be able to launch my applications without needing to pass a filename. For example, I want to be able to open the text editor on a blank file buffer or open my web browser on its home page.

I'm trying to write a script that launches the default application for a given mime type. For example, I would like to say my-script text/plain and have it open KWrite for me.

What I know is that you can use xdg-mime to query what is the default application for a given mime type

$ xdg-mime query default text/plain
org.kde.kwrite.desktop

However, I don't know what is the command I can use to launch KWrite given org.kde.kwrite.desktop. How can I do that? Is having the name of the desktop file enough or do I also need to find out where it is stored (/usr/share/applications, .local/share/applications, etc)?


By the way, I don't think I can solve my original problem using xdg-open because XDG open expects to receive a filename or URL as a parameter and I want to be able to launch my applications without needing to pass a filename. For example, I want to be able to open the text editor on a blank file buffer or open my web browser on its home page.

1
source | link

How can I run a .desktop file?

I'm trying to write a script that launches the default application for a given mime type. For example, I would like to say my-script text/plain and have it open KWrite for me.

What I know is that you can use xdg-mime to query what is the default application for a given mime type

$ xdg-mime query default text/plain
org.kde.kwrite.desktop

However, I don't know what is the command-line command I can use to launch KWrite given org.kde.kwrite.desktop. How can I do that? Is having the name of the desktop file enough or do I also need to find out where it is stored (/usr/share/applications, .local/share/applications, etc)?


By the way, I don't think I can solve my original problem using xdg-open because XDG open expects to receive a filename or URL as a parameter and I want to be able to launch my applications without needing to pass a filename. For example, I want to be able to open the text editor on a blank file buffer or open my web browser on its home page.