Freedesktop

Utilities

xdg-settings — get various settings from the desktop environment

xdg-settings get default-web-browser

https://portland.freedesktop.org/doc/xdg-settings.html

xdg-mime – command line tool for querying information about file type handling and adding descriptions for new file types

xdg-mime query default inode/directory

Unsorted

Desktop files

Directories

global/usr/share/applications
user$HOME/.local/share/applications
flatpak global/var/lib/flatpak/exports/share/applications
flatpak user$HOME/.local/share/flatpak/exports/share/applications

Run a .desktop file from terminal

gtk-launch <file>

Where <file> is the name of the .desktop file with or without the .desktop part. The name must not include the full path.

https://askubuntu.com/questions/5172/running-a-desktop-file-in-the-terminal

Set a variable in a desktop file

Exec=env GDK_SCALE=2 mediathekview

https://askubuntu.com/questions/144968/set-variable-in-desktop-file

XDG user directories

xdg-user-dirs is a tool to help manage “well known” user directories like the desktop folder and the music folder. It also handles localization (i.e. translation) of the filenames.

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"