[HOWTO] Using rootcopy/ and assigning userapp to handle filetypes - mimeapps.list and userapp-*.desktop

Post tutorials, HOWTO's and other useful resources here.
User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

[HOWTO] Using rootcopy/ and assigning userapp to handle filetypes - mimeapps.list and userapp-*.desktop

Post#1 by Rava » 01 Nov 2021, 07:26

TL;DR
When you assign a custom application to handle a certain file type, only saving mimeapps.list to your rootcopy/ is not enough, you also have to save the most recent relevant userapp-*.desktop file.
_________________________________

Elaborate version

The default for aac files switched to audacious in my system. I changed that to a custom script and saved mimeapps.list to my rootcopy-module, but at next bootup again audacious was the default app for handling aac.

The below is most probably only true when you want to change the file association to a different program that is considered an "userapp", an app that is not standard or has no *.desktop file on its own.

I set it so that aac is opened by default by my /usr/local/bin script ffplay-hide_banner-loop .

While I saved my changed ~/.config/mimeapps.list into my 992-rootcopy_5.0rc3c-RECENT.xzm module… at next bootup audacious was again the defined application for handling aac, not my /usr/local/bin script ffplay-hide_banner-loop .

So I compared both mimeapps.list after I again set ffplay-hide_banner-loop as the default for opening aac:

Code: Select all

guest@porteus:~$ diff .config/mimeapps.list /mnt/live/memory/images/992-rootcopy_5.0rc3c-RECENT.xzm/home/guest/.config/mimeapps.list
56c56
< audio/aac=userapp-ffplay-hide_banner-loop-CC12B1.desktop
---
> audio/aac=userapp-ffplay-hide_banner-loop-PN3MB1.desktop
< audio/aac=userapp-ffplay-hide_banner-BFVRW0.desktop;audacious.desktop;userapp-ffplay-hide_banner-loop-V8JOA1.desktop;userapp-ffplay-hide_banner-loop-0ROV90.desktop;userapp-ffplay-hide_banner-loop-YZOJB1.desktop;userapp-ffplay-hide_banner-loop-PN3MB1.desktop;userapp-ffplay-hide_banner-loop-CC12B1.desktop;
---
> audio/aac=userapp-ffplay-hide_banner-BFVRW0.desktop;audacious.desktop;userapp-ffplay-hide_banner-loop-V8JOA1.desktop;userapp-ffplay-hide_banner-loop-0ROV90.desktop;userapp-ffplay-hide_banner-loop-YZOJB1.desktop;userapp-ffplay-hide_banner-loop-PN3MB1.desktop;
As you can see, the main difference is that a different userapp-*.desktop was assigned to handle aac.

Only saving mimeapps.list is not enough, you also need to save the userapp-ffplay-hide_banner-loop-??????.desktop file.

The funny issue here: I did save the userapp-ffplay-hide_banner-loop-??????.desktop file - but I forgot to save the most recent version and remove any older versions when I did my last edit, so it was an older version of userapp-ffplay-hide_banner-loop-??????.desktop in my rootcopy-module.

As you can see here:

Code: Select all

 /mnt/live/memory/images/992-rootcopy_5.0rc3c-RECENT.xzm/home/guest/.local/share/applications/userapp-ffplay-hide_banner-BFVRW0.desktop
that is the version in my 992-rootcopy_5.0rc3c-RECENT.xzm when it should have been userapp-ffplay-hide_banner-loop-PN3MB1.desktop instead of userapp-ffplay-hide_banner-BFVRW0.desktop . :wall:

The contents is always the same, but the name seems to be randomly assigned by the running system, and any entries in mimeapps.list that direct to an unknown userapp-*.desktop (e.g. in my case because I forgot too either rename the userapp-*.desktop to its current name, or remove the old version and copy the new version) get reset to the system default.

So be aware when setting a custom application to handle your files and you not use automatically save-changes, remember to also always save the most recent relevant userapp-*.desktop into your rootcoy/home/guest/.local/share/applications/
_____________________________________

As you can see, old invalid entries are also kept, as seen in different versions of userapp-ffplay-hide_banner-loop-??????.desktop - 5 differnt versions for audio/aac - all but one being invalid.

How that can be cleaned up in a way the system not resets mimeapps.list I yet have to figure out.

For now I try editing mimeapps.list, saving it under a different name, exit X (it won't get started again by itself since I run my Porteus in init mode 3 not init mode 4) [ see man init and /etc/initab ] and replace mimeapps.list with my edited version (saving a backup of the system created mimeapps.list won't hurt at that moment), then start X again via startx and see if the file associations still are set to my customs or reset to the system default.

Probably then I report back here, or maybe the system imploded on me instead. :ROFL:
Cheers!
Yours Rava