Xfce Forum

Sub domains
 

You are not logged in.

#1 2024-07-05 22:43:52

advice1010
Member
Registered: 2023-02-19
Posts: 95

Questions about program associations

I am trying to understand more about how programs are associated with MIME types and I have some questions / items to be confirmed if anyone is interested.

ITEM TO CONFIRM
So from how it appears, the command that gets used when opening MIME types are the same commands that are used by your panel menu, for example Whisker Menu.
If you add any options to these commands in you Whisker Menu, these get applied to any MIME types associated with that applications command.
Is this true.

INFO
-My main confusion at the moment are media MIME types (audio,video, images).
-Lets use the application MPV to open up media files.
-For these lets just say MIME types are being opened from within Thunar with the programs associated to open them.

QUESTIONS
1.) I noticed that MPV is associated with all media files on my system, what actually assigned these MIME types all to MPV?  I also have VLC on my machine which does not have these associations.  Does MPV do this automatically when it was installed, because MPV was installed after VLC?

2.) Continuation of question above, as far as I know you have to set a default application per MIME types, so if user wanted to assign all audio MIME types to a different application, how would you do this?  You have to assign each one at a time?

3.) Similar question, if my above assumption is confirmed to be true, lets say you have MPV in your menu with just a basic command: mpv %U
but you want to apply a specific mpv command with an option to all audio files.
Now that all media is not using that same command from menu, how would user apply an mpv command with option to every audio MIME type?
All I see in XFCE is that you have to go into 
Default Applications - Others
and go into each MIME type and choose the following option
"Use A Custom Command"
and have to apply to each command

Hopefully some of this makes sense.
Thank you to anyone who reads this and for any info shared.

Last edited by advice1010 (2024-07-05 22:45:02)

Offline

#2 2024-07-05 23:31:35

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

Re: Questions about program associations

Start by reading this Arch wiki article on default applications to understand the basics. Even if you don't use Arch, it provides a good base understanding.

ITEM TO CONFIRM
So from how it appears, the command that gets used when opening MIME types are the same commands that are used by your panel menu, for example Whisker Menu.
If you add any options to these commands in you Whisker Menu, these get applied to any MIME types associated with that applications command.
Is this true.

I'm not sure I understand what you are asking here. The Whiskermenu (and other Xfce menu systems) display the content from .desktop files (from either /usr/share/applications, ~/.local/share/applications, and I believe /usr/local/sharea/applications). They run the command in the "Exec=" line. Btw, these same desktop files listed the mimetypes that this application can be associated with.

1.) I noticed that MPV is associated with all media files on my system, what actually assigned these MIME types all to MPV?  I also have VLC on my machine which does not have these associations.  Does MPV do this automatically when it was installed, because MPV was installed after VLC?

Look at mpv's .desktop file. It will list the mimetypes that it can process. If there is no set default application for a particular file, the system will pick one (see /usr/share/applications/mimeinfo.cache) or will ask you.

2.) Continuation of question above, as far as I know you have to set a default application per MIME types, so if user wanted to assign all audio MIME types to a different application, how would you do this?  You have to assign each one at a time?

Manually, one at a time. There may be a script of program that someone has created but I am unaware of one.

3.) Similar question, if my above assumption is confirmed to be true, lets say you have MPV in your menu with just a basic command: mpv %U
but you want to apply a specific mpv command with an option to all audio files.
Now that all media is not using that same command from menu, how would user apply an mpv command with option to every audio MIME type?

Copy mpv's .desktop file from /usr/share/applications to ~/.local/share/applications, edit it an on the "Exec=" line, append the option to the command before the %U.

All I see in XFCE is that you have to go into
Default Applications - Others
and go into each MIME type and choose the following option
"Use A Custom Command"
and have to apply to each command

The previous way is easier, but this will work as well. It basically does the same thing.


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 2024-07-09 23:14:04

advice1010
Member
Registered: 2023-02-19
Posts: 95

Re: Questions about program associations

@ToZ
Thank you for your response.
ITEM TO CONFIRM
Okay with some of the knowledge you shared I figured out what was going on.
To explain a little better about what I was talking about with Whisker Menu.
In Whisker if you go into an applications context menu and choose “edit application” and change the command in field, that command for that application gets applied to all MIME types associated with that application.
Also its .desktop file keeps the old default command in /usr/share/applications
The .desktop file located in ~/.local/share/applications is the one that shows the new command changed in “edit application”

1.)  Yeah, but VLC also contains all the supported MIME types in its .desktop file.
VLC was installed first and I imagine was originally associated with all audio/video MIME types.
Then when MPV was installed all of a sudden all audio/video MIME types were then associated with MPV.
I maybe manually set one or two to MPV as the default application, but I know I didn't do all of them.
So not sure, maybe VLC wasn't linked to any media MIME types and MPV was just picked like you said or maybe there is something in MPV install that just overrides current media MIME types.  Windows applications would do this, where the most recent application would associate overriding previous associations.

2.) Ahh one at a time.  I actually am going to mention something about this.

3.) My ~/.local/share/applications already contained a mpv.desktop file so I assume I would have to make a unique desktop file for this.  Then I would have to assign one audio MIME type at a time to this new .desktop file created.
I guess I would not have to edit any of the MIME type information within this new .desktop file because I have to link each audio MIME manually to this file anyways.
Like you said this would be the easier way because then just link all to that .desktop file rather than having to copy & paste the command manually into each MIMEs "Use A Custom Command" field.

Thank you again for your detailed response

Offline

Board footer

Powered by FluxBB