Add xdg settings

This commit is contained in:
ItsDrike 2024-04-04 23:17:11 +02:00
parent a89f7f7576
commit 3ada18683e
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
4 changed files with 79 additions and 0 deletions

View file

@ -2,5 +2,6 @@ _: {
imports = [ imports = [
./graphical ./graphical
./terminal ./terminal
./xdg
]; ];
} }

View file

@ -0,0 +1,14 @@
{config, ...}: {
imports = [
./mime-apps.nix
./user-dirs.nix
];
xdg = {
enable = true;
cacheHome = "${config.home.homeDirectory}/.cache";
configHome = "${config.home.homeDirectory}/.config";
dataHome = "${config.home.homeDirectory}/.local/share";
stateHome = "${config.home.homeDirectory}/.local/state";
};
}

View file

@ -0,0 +1,42 @@
# Manage $XDG_CONFIG_HOME/mimeapps.list
{
xdg.mimeApps = {
enable = true;
associations.added = let
browser = "firefox.desktop";
textEditor = browser; # nvim doesn't work properly with xdg-open, just use the browser
fileManager = "pcmanfm-qt.desktop";
archiveManager = "org.gnome.FileRoller.desktop";
imageViewer = "org.nomacs.ImageLounge.desktop";
videoPlayer = "mpv.desktop";
audioPlayer = "mpv.desktop";
in {
"text/html" = [browser];
"x-scheme-handler/http" = [browser];
"x-scheme-handler/https" = [browser];
"x-scheme-handler/about" = [browser];
"x-scheme-handler/unknown" = [browser];
"application/x-extension-htm" = [browser];
"application/x-extension-html" = [browser];
"application/x-extension-shtml" = [browser];
"application/xhtml+xml" = [browser];
"application/x-extension-xhtml" = [browser];
"application/x-extension-xht" = [browser];
"inode/directory" = [fileManager];
"application/zip" = [archiveManager];
"application/x-xz-compressed-tar" = [archiveManager];
"image/*" = [imageViewer];
"audio/*" = [audioPlayer];
"video/*" = [videoPlayer];
"text/plain" = [textEditor];
"application/json" = [textEditor];
"x-scheme-handler/spotify" = ["spotify.desktop"];
"x-scheme-handler/tg" = ["telegramdesktop.desktop"];
"x-scheme-handler/msteams" = ["teams.desktop"]; # I need it for school, don't judge me
};
};
}

View file

@ -0,0 +1,22 @@
# Manage $XDG_CONFIG_HOME/user-dirs.dirs
{ config, ... }: {
xdg.userDirs = {
enable = true;
createDirectories = true;
desktop = null;
documents = null;
download = "${config.home.homeDirectory}/Downloads";
publicShare = "${config.home.homeDirectory}/.local/share/public";
templates = "${config.home.homeDirectory}/.local/share/templates";
music = "${config.home.homeDirectory}/Media/Music";
pictures = "${config.home.homeDirectory}/Media/Pictures";
videos = "${config.home.homeDirectory}/Media/Videos";
extraConfig = {
XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots";
};
};
}