docs: XDG mime types

This commit is contained in:
Daniel Langbein 2024-02-23 13:54:03 +01:00
parent f64043f67d
commit 47db71fe3e
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
2 changed files with 55 additions and 4 deletions

View File

@ -31,6 +31,7 @@ This document contains general notes about NixOS that are independent of my NixO
* [Run AppImages](#run-appimages) * [Run AppImages](#run-appimages)
* [Audio troubleshooting - Realtek ALC898 Audio Codec on ASRock Z77 Extreme 4](#audio-troubleshooting---realtek-alc898-audio-codec-on-asrock-z77-extreme-4) * [Audio troubleshooting - Realtek ALC898 Audio Codec on ASRock Z77 Extreme 4](#audio-troubleshooting---realtek-alc898-audio-codec-on-asrock-z77-extreme-4)
* [Graphic drivers](#graphic-drivers) * [Graphic drivers](#graphic-drivers)
* [XDG mimes, desktop files](#xdg-mimes-desktop-files)
* [Additional resources](#additional-resources) * [Additional resources](#additional-resources)
* [Nix Pills](#nix-pills) * [Nix Pills](#nix-pills)
* [Papers](#papers) * [Papers](#papers)
@ -791,6 +792,60 @@ Configuration example to disable integrated GUP: See [./hosts/yodaGaming/configu
Configuration example for an AMD GPU (https://github.com/tolgaerok/nixos-kde/blob/main/core/gpu/amd/default.nix): See [./modules/gpu-amd.nix](./modules/gpu-amd.nix) Configuration example for an AMD GPU (https://github.com/tolgaerok/nixos-kde/blob/main/core/gpu/amd/default.nix): See [./modules/gpu-amd.nix](./modules/gpu-amd.nix)
## XDG mimes, desktop files
Desktop files:
- `/run/current-system/sw/share/applications`
- `/etc/profiles/per-user/yoda/share/applications/`
Both above sub-paths are part of the `XDG_DATA_DIRS` variable:
- `echo $XDG_DATA_DIRS | grep /run/current-system/sw/share`
- `echo $XDG_DATA_DIRS | grep /etc/profiles/per-user/yoda/share`
List default apps and the associated handlers:
```shell
handlr list
```
```console
┌────────────────────────────────┬─────────────────────────────────────────┐
│ application/octet-stream │ thunderbird.desktop │
│ ... │ │
│ x-scheme-handler/sgnl │ signal-desktop.desktop │
└────────────────────────────────┴─────────────────────────────────────────┘
```
Set default handler for mime/extension:
```shell
handlr set text/html re.sonny.Junction.desktop
```
Open any URI with `handlr`:
```shell
handlr open https://wikipedia.org
```
Open any URI with `gio`, part of `glib`:
```shell
gio open https://wikipedia.org
```
- Note: `gio open` does not follow the XDG spec. https://discourse.nixos.org/t/configure-how-xdg-open-opens-html-files/6419/23
Further examples:
```shell
xdg-settings get default-web-browser
#=> re.sonny.Junction.desktop
xdg-mime query default x-scheme-handler/http and x-scheme-handler/https
#=> re.sonny.Junction.desktop
xdg-mime query default text/html
#=> firefox.desktop
```
## Additional resources ## Additional resources
* Simple NixOS flake template for NixOS with HomeManager. https://github.com/Misterio77/nix-starter-configs#readme * Simple NixOS flake template for NixOS with HomeManager. https://github.com/Misterio77/nix-starter-configs#readme

View File

@ -3,10 +3,6 @@
# See also: # See also:
# Temporary workaround until https://github.com/nix-community/home-manager/issues/3447 is merged. # Temporary workaround until https://github.com/nix-community/home-manager/issues/3447 is merged.
# Desktop files:
# /run/current-system/sw/share/applications
# /etc/profiles/per-user/yoda/share/applications/
home-manager.users.yoda = { osConfig, config, pkgs, ... }: { home-manager.users.yoda = { osConfig, config, pkgs, ... }: {
home.file."keepassxc" = { home.file."keepassxc" = {
target = ".config/autostart/org.keepassxc.KeePassXC.desktop"; target = ".config/autostart/org.keepassxc.KeePassXC.desktop";