Xdg-utils

Aus Foxwiki
Version vom 2. Dezember 2022, 11:29 Uhr von Dirkwagner (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „'''topic''' kurze Beschreibung == Beschreibung == == Installation == == Anwendungen == === Fehlerbehebung === == Syntax == === Optionen === === Parameter === === Umgebungsvariablen === === Exit-Status === == Konfiguration == === Dateien === == Sicherheit == == Dokumentation == === RFC === === Man-Pages === === Info-Pages === == Siehe auch == == Links == === Projekt-Homepage === === Weblinks === === Einzelnachweise === <references /> == Testfragen == <div…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)

topic kurze Beschreibung

Beschreibung

Installation

Anwendungen

Fehlerbehebung

Syntax

Optionen

Parameter

Umgebungsvariablen

Exit-Status

Konfiguration

Dateien

Sicherheit

Dokumentation

RFC

Man-Pages

Info-Pages

Siehe auch

Links

Projekt-Homepage

Weblinks

Einzelnachweise

Testfragen

Testfrage 1

Antwort1

Testfrage 2

Antwort2

Testfrage 3

Antwort3

Testfrage 4

Antwort4

Testfrage 5

Antwort5


ArchWiki

Vorlage:Lowercase title ja:Xdg-utils ru:Xdg-utils xdg-utils provides the official utilities for managing XDG MIME Applications.

Installation

Install the Vorlage:Pkg package.

Usage

Environment variables

Vorlage:Note

xdg-utils attempts to integrate with your desktop environment by invoking the specialized programs it provides, where applicable. The evaluation of the current environment is as follows [1]:

  • If the standardized XDG_CURRENT_DESKTOP environment variable is set to a recognized desktop environment, the corresponding value is used.
  • If any classic fallbacks or environment-specific variables, such as KDE's Vorlage:Ic, are present, then the corresponding value is used.
  • If the legacy DESKTOP_SESSION environment variable is set to a recognized desktop environment, the corresponding value is used.

During this process, if any match is found, the DE variable is internally overwritten with the detected desktop environment's normalized value. Hence, Vorlage:Ic is both a legacy environment variable, and an internal state variable for xdg-utils. As an example, if Vorlage:Ic is Vorlage:Ic, xdg-utils will internally set Vorlage:Ic to Vorlage:Ic. If no match is found, then any pre-existing Vorlage:Ic value will be used, in such a way that Vorlage:Ic is equivalent to Vorlage:Ic being unset, and having Vorlage:Ic. This implementation detail is worth noting because it has the consequence that a pre-set Vorlage:Ic is ignored if a desktop environment is otherwise detected.

Values of the variables that xdg-utils recognizes are:

Desktop Environment Vorlage:Ic Vorlage:Ic Vorlage:Ic
Vorlage:- Vorlage:Ic1 Vorlage:Ic Vorlage:-
Cinnamon Vorlage:Ic, Vorlage:Ic Vorlage:Ic Vorlage:-
Deepin Vorlage:Ic, Vorlage:Ic, Vorlage:Ic1 Vorlage:Ic Vorlage:-
Enlightenment Vorlage:Ic1 Vorlage:Ic Vorlage:-
GNOME Vorlage:Ic2 Vorlage:Ic Vorlage:Ic
GNOME Flashback Vorlage:Ic, Vorlage:Ic2 Vorlage:Ic Vorlage:Ic
KDE Plasma Vorlage:Ic Vorlage:Ic Vorlage:-
LXDE Vorlage:Ic Vorlage:Ic Vorlage:Ic
LXQt Vorlage:Ic Vorlage:Ic Vorlage:-
MATE Vorlage:Ic Vorlage:Ic Vorlage:Ic
Xfce Vorlage:Ic Vorlage:Ic Vorlage:Ic, Vorlage:Ic, Vorlage:Ic
  1. This is not an environment registered with freedesktop.org.
  2. GNOME variations, including the GNOME Classic mode, are all regarded as the same by xdg-utils.

Note that this is only a list of what the scripts provided by Vorlage:Pkg are capable of detecting. The scripts will still perform generic, environment-agnostic actions under the following conditions:

  • The generic routine was asked for, via Vorlage:Ic or Vorlage:Ic.
  • Environment detection failed. All relevant environment variables were unrecognized or unset, and the classic fallbacks did not reveal anything.
  • Environment-specific actions were performed, but failed, e.g. due to a missing program.

xdg-mime

Vorlage:Man is a script for directly querying and modifying default MIME applications. It is used within other scripts, such as xdg-open, and is also a useful troubleshooting tool.

Determine a file's MIME type:

$ xdg-mime query filetype photo.jpeg
image/jpeg

Determine the default application for a MIME type:

$ xdg-mime query default image/jpeg
gimp.desktop

Change the default application for a MIME type:

$ xdg-mime default feh.desktop image/jpeg

Debug default application for MIME type:

$ env XDG_UTILS_DEBUG_LEVEL=10  xdg-mime query default text/html
Checking /home/user/.config/mimeapps.list
Checking /home/user/.local/share/applications/defaults.list and /home/user/.local/share/applications/mimeinfo.cache
Checking /usr/local/share/applications/defaults.list and /usr/local/share/applications/mimeinfo.cache
Checking /usr/share/applications/defaults.list and /usr/share/applications/mimeinfo.cache
qutebrowser.desktop

When it is necessary to determine the MIME type of a file, xdg-mime attempts to use the right program for the desktop environment:

Desktop Environment Program Package
Cinnamon Vorlage:Ic Vorlage:Pkg
GNOME
GNOME Flashback
LXDE
MATE
Xfce
Deepin rowspan="3" Vorlage:- rowspan="3" Vorlage:-
Enlightenment
LXQt
KDE Plasma Vorlage:Ic Vorlage:Pkg

In the generic case, xdg-mime will:

xdg-open

Vorlage:Man is a resource opener used by many applications, implementing the XDG MIME Applications standard while integrating with the system's desktop environment as much as possible.

If a desktop environment was detected, its provided handler will be invoked [2]:

Desktop Environment Program Package
Cinnamon Vorlage:Ic Vorlage:Pkg
GNOME
GNOME Flashback
MATE
Deepin Vorlage:Ic Vorlage:Pkg
Enlightenment Vorlage:Ic Vorlage:Pkg
KDE Plasma Vorlage:Ic1 Vorlage:Pkg
LXDE Vorlage:Ic Vorlage:Pkg
LXQt Vorlage:- Vorlage:-
Xfce Vorlage:Ic2 Vorlage:Pkg
  1. If Vorlage:Ic is unset, then Vorlage:Ic from Vorlage:Pkg will be used instead. KDE Plasma should set this variable under any condition, though.
  2. Vorlage:Ic from Vorlage:Pkg will also be tried.

In the generic case, xdg-open will:

Vorlage:Tip

Since xdg-mime relies on Vorlage:Pkg package to implement the XDG MIME Applications standard, if you are not using a desktop environment, you should either install Vorlage:Pkg, or consider a different resource opener.

xdg-settings

See Vorlage:Man.

Shortcut to open all web MIME types with a single application:

$ xdg-settings set default-web-browser firefox.desktop

Shortcut for setting the default application for a URL scheme:

$ xdg-settings set default-url-scheme-handler irc xchat.desktop

Tips and Tricks

URL scheme handlers

To set the default application for a URL scheme you may also need to change the default application for the Vorlage:Ic MIME types:

$ xdg-mime default firefox.desktop x-scheme-handler/https x-scheme-handler/http