[opensuse] REgistering file/mime type system wide
Hello, we have a filetype with ending "fsp" ,which should be opened with a special application. I created a xml-file and registered the type "application/x-fsp" with "xdg-mime install" I also created a Desktop-file /usr/share/applications/mmview.desktop , which has an entry "MimeType=application/x-fsp" When I call "xdg-mime query default application/x-fsp" as my user, I get "which: no mmviews in (/usr/uti)" If I call it as root, I get "mmview.desktop". How do I configure a mime type for alle users under opensuse Leap? Regards Daniel -- Daniel Spannbauer Systemadministration marco Systemanalyse und Entwicklung GmbH Tel +49 8333 9233-27 Fax -11 Rechbergstr. 4-6, D 87727 Babenhausen Mobil +49 171 4033220 http://www.marco.de/ Email ds@marco.de Geschäftsführer Martin Reuter HRB 171775 Amtsgericht München
30.11.2020 18:42, Daniel Spannbauer пишет:
Hello,
we have a filetype with ending "fsp" ,which should be opened with a special application.
I created a xml-file and registered the type "application/x-fsp" with "xdg-mime install"
I also created a Desktop-file /usr/share/applications/mmview.desktop , which has an entry "MimeType=application/x-fsp"
You did not tell Leap version, you did not tell desktop environment you are using, you did not show xml file, xdm-mime invocation or mmview.desktop file. Basically, zero data to make any guess about what could go wrong.
When I call "xdg-mime query default application/x-fsp" as my user, I get "which: no mmviews in (/usr/uti)"
If this is really full and complete error message it implies your user has PATH set to /usr/uti, at least during xdg-mime invocation. In any case, message means xdg-mime failed to locate binary specified in desktop file.
If I call it as root, I get "mmview.desktop".
May be root and your user have different PATH.
How do I configure a mime type for alle users under opensuse Leap?
xdg-mime should do it when invoked as root.
Am 11/30/20 um 6:48 PM schrieb Andrei Borzenkov:
30.11.2020 18:42, Daniel Spannbauer пишет:
Hello,
we have a filetype with ending "fsp" ,which should be opened with a special application.
I created a xml-file and registered the type "application/x-fsp" with "xdg-mime install"
I also created a Desktop-file /usr/share/applications/mmview.desktop , which has an entry "MimeType=application/x-fsp"
You did not tell Leap version, you did not tell desktop environment you are using, you did not show xml file, xdm-mime invocation or mmview.desktop file. Basically, zero data to make any guess about what could go wrong.
Ok?...did this Cahnge between the Leap versions? Or why is the Leap version important? We use EVERY Leap version, from 42.3 -> 15.2 atm. xml: <?xml version="1.0"?> <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> <mime-type type="application/x-fsp"> <comment>marco functional specification</comment> <glob pattern="*.fsp"/> </mime-type> </mime-info> mmview.desktop: [Desktop Entry] Comment=marco functional specification Hidden=false Icon= MimeType=application/x-fsp Patterns=*.fsp Type=MimeType Name=mmview Exec=/usr/uti/mmview %F Icon=/usr/share/icons/marco/marco.png Type=Application Terminal=false Categories=Utility; X-KDE-StartupNotify=false Path as root: /usr/uti/sys:/usr/uti:/usr/arch/bin:/usr/stl:/usr/cad:/usr/tools:/usr/mae:/bin:/usr/bin:/usr/X11/bin:/opt/kde3/bin:/usr/uti/pm2:/etc:/usr/etc:/sbin:/usr/sbin Path as User: /mnt/home/ds/uti::/usr/uti/sys:/usr/uti:/usr/arch/bin:/usr/stl:/usr/cad:/usr/tools:/usr/mae:/bin:/usr/bin:/usr/X11/bin:/opt/kde3/bin:/usr/uti/pm2:/mnt/home/ds/Zeit: xml is installed via: "xdg-mime install --mode system ~ds/x-fsp.xml" Desktop-ENv shouldn't matter here, cause this all these path as indipendent from the desktop-env, but we use mainly KDE3 and XFCE, some also mate. Regards Daniel -- Daniel Spannbauer Systemadministration marco Systemanalyse und Entwicklung GmbH Tel +49 8333 9233-27 Fax -11 Rechbergstr. 4-6, D 87727 Babenhausen Mobil +49 171 4033220 http://www.marco.de/ Email ds@marco.de Geschäftsführer Martin Reuter HRB 171775 Amtsgericht München
01.12.2020 11:41, Daniel Spannbauer пишет:
Am 11/30/20 um 6:48 PM schrieb Andrei Borzenkov:
30.11.2020 18:42, Daniel Spannbauer пишет:
Hello,
we have a filetype with ending "fsp" ,which should be opened with a special application.
I created a xml-file and registered the type "application/x-fsp" with "xdg-mime install"
I also created a Desktop-file /usr/share/applications/mmview.desktop , which has an entry "MimeType=application/x-fsp"
You did not tell Leap version, you did not tell desktop environment you are using, you did not show xml file, xdm-mime invocation or mmview.desktop file. Basically, zero data to make any guess about what could go wrong.
Ok?...did this Cahnge between the Leap versions? Or why is the Leap version important?
I do not pretend to know each and every change and bug fix between each individual release, so I want to know environment where to test it and to be sure environment where I test it is as close to yours as possible. If you do know exact differences between each version, you probably should be answering questions, not asking them.
We use EVERY Leap version, from 42.3 -> 15.2 atm.
xml:
<?xml version="1.0"?> <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> <mime-type type="application/x-fsp"> <comment>marco functional specification</comment> <glob pattern="*.fsp"/> </mime-type> </mime-info>
mmview.desktop:
[Desktop Entry] Comment=marco functional specification Hidden=false Icon= MimeType=application/x-fsp Patterns=*.fsp Type=MimeType Name=mmview Exec=/usr/uti/mmview %F
Your error message in original post says "mmviews", not "mmview". Which is why exact details are important. And yes, "which /usr/uti/mmviews" will return error message you posted earlier if this file does not exist.
Icon=/usr/share/icons/marco/marco.png Type=Application Terminal=false Categories=Utility; X-KDE-StartupNotify=false
Path as root: /usr/uti/sys:/usr/uti:/usr/arch/bin:/usr/stl:/usr/cad:/usr/tools:/usr/mae:/bin:/usr/bin:/usr/X11/bin:/opt/kde3/bin:/usr/uti/pm2:/etc:/usr/etc:/sbin:/usr/sbin
Path as User: /mnt/home/ds/uti::/usr/uti/sys:/usr/uti:/usr/arch/bin:/usr/stl:/usr/cad:/usr/tools:/usr/mae:/bin:/usr/bin:/usr/X11/bin:/opt/kde3/bin:/usr/uti/pm2:/mnt/home/ds/Zeit:
xml is installed via: "xdg-mime install --mode system ~ds/x-fsp.xml"
This command installs information about new MIME type. This command does *not* update information which applications can handle this MIME type.
Desktop-ENv shouldn't matter here, cause this all these path as indipendent from the desktop-env, but we use mainly KDE3 and XFCE, some also mate.
Desktop environment absolutely matters because XDG utils take different code paths depending on DE where they are invoked or they act on different files. Anyway, what happens - "xdg-mime install" updates information about MIME type. It does not update information which application (desktop file) can handle this MIME type - "xdg-mime query default" queries information about default applications for the given MIME type. Default applications are stored in various *mimeapps.list files which *are* DE dependent. System-wide files are normally installed by packages and represent packager choice of default applications. User specific files are stored usually inside user home directory and represent user configuration. All these locations have some defaults and may be overridden by setting XDG_DATA_DIRS and XDG_DATA_HOME environment variables. - if given MIME type is not found in one of *mimeapps.list (i.e. no default application is explicitly set for it), "xdg-mime query" checks desktop entry cache (*mimeinfo.cache) which map MIME types to applications. Same comments about location of these files apply. These cache files are updated at run time, usually when packages are installed or removed. Now in your case system-wide default files are not touched and you do not refresh system-wide desktop entry cache so xdg-mime query does not find your application when run as root. Apparently your user *does* have set default handler for this MIME type, but desktop file for this handler (probably also in local user directory) contains error and specifies /usr/uti/mmviews instead of /usr/uti/mmview. If you run update-desktop-database, "xdg-mime query" should return correct information under root, but it will most likely still return the same error under user because user specific configuration has priority over system-wide.
01.12.2020 23:12, Andrei Borzenkov пишет:
Now in your case system-wide default files are not touched and you do not refresh system-wide desktop entry cache so xdg-mime query does not find your application when run as root.
Apologies, I somehow remembered that command returned nothing for root. Just realized I was wrong. But still answer is the same - under root you get system-wide configuration and under user you get user-specific configuration.
Apparently your user *does* have set default handler for this MIME type, but desktop file for this handler (probably also in local user directory) contains error and specifies /usr/uti/mmviews instead of /usr/uti/mmview.
If you run update-desktop-database, "xdg-mime query" should return correct information under root, but it will most likely still return the same error under user because user specific configuration has priority over system-wide.
So to answer your question in original post:
how do I configure a mime type for alle users under opensuse Leap?
You already did it, but each user is free to override system-wide default configuration and you as system administrator have no control over it that I am aware of (short of making user's home directory read-only). It is
how do I configure a mime type for alle users under opensuse Leap? You already did it, but each user is free to override system-wide default configuration and you as system administrator have no control over it that I am aware of (short of making user's home directory read-only).
First of all: Thanks for your explanations. I know, that users can have their own mime definitions, but I want to give them a "default". If they destroy them later... Now, it ssems to work also for the user users. Don't know why it did not on Monday. Regards Daniel -- Daniel Spannbauer Systemadministration marco Systemanalyse und Entwicklung GmbH Tel +49 8333 9233-27 Fax -11 Rechbergstr. 4-6, D 87727 Babenhausen Mobil +49 171 4033220 http://www.marco.de/ Email ds@marco.de Geschäftsführer Martin Reuter HRB 171775 Amtsgericht München
participants (2)
-
Andrei Borzenkov
-
Daniel Spannbauer