feat(home): Xdg profile
This commit is contained in:
parent
377e5a37d2
commit
3f76d39eb7
2 changed files with 75 additions and 60 deletions
75
modules/home/base/xdg/default.nix
Normal file
75
modules/home/base/xdg/default.nix
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
namespace,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib) mkMerge mkIf;
|
||||||
|
inherit (config.${namespace}) isDesktop;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
home.preferXdgDirectories = true;
|
||||||
|
|
||||||
|
xdg =
|
||||||
|
let
|
||||||
|
homeDir = config.home.homeDirectory;
|
||||||
|
in
|
||||||
|
mkMerge [
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
cacheHome = "${homeDir}/.cache";
|
||||||
|
configHome = "${homeDir}/.config";
|
||||||
|
dataHome = "${homeDir}/.local/share";
|
||||||
|
stateHome = "${homeDir}/.local/state";
|
||||||
|
}
|
||||||
|
(mkIf isDesktop {
|
||||||
|
userDirs = {
|
||||||
|
enable = true;
|
||||||
|
createDirectories = true;
|
||||||
|
|
||||||
|
desktop = "${homeDir}/desktop";
|
||||||
|
documents = null;
|
||||||
|
download = "${homeDir}/downloads";
|
||||||
|
music = null;
|
||||||
|
pictures = "${homeDir}/pictures";
|
||||||
|
templates = null;
|
||||||
|
videos = "${homeDir}/videos";
|
||||||
|
};
|
||||||
|
|
||||||
|
portal = {
|
||||||
|
enable = true;
|
||||||
|
xdgOpenUsePortal = true;
|
||||||
|
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
|
||||||
|
config.common.default = [ "gtk" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
mimeApps = rec {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
associations.added = {
|
||||||
|
"application/json" = [ "nvim.desktop" ];
|
||||||
|
"application/pdf" = [ "org.pwmt.zathura-pdf-mupdf.desktop" ];
|
||||||
|
"application/xhtml+xml" = [ "zen-alpha.desktop" ];
|
||||||
|
"application/x-extension-htm" = [ "zen-alpha.desktop" ];
|
||||||
|
"application/x-extension-html" = [ "zen-alpha.desktop" ];
|
||||||
|
"application/x-extension-shtml" = [ "zen-alpha.desktop" ];
|
||||||
|
"application/x-extension-xhtml" = [ "zen-alpha.desktop" ];
|
||||||
|
"application/x-extension-xht" = [ "zen-alpha.desktop" ];
|
||||||
|
"image/png" = [ "feh.desktop" ];
|
||||||
|
"text/html" = [ "zen-alpha.desktop" ];
|
||||||
|
"text/plain" = [ "nvim.desktop" ];
|
||||||
|
"x-scheme-handler/chrome" = [ "zen-alpha.desktop" ];
|
||||||
|
"x-scheme-handler/http" = [ "zen-alpha.desktop" ];
|
||||||
|
"x-scheme-handler/https" = [ "zen-alpha.desktop" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultApplications = associations.added;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,60 +0,0 @@
|
||||||
{ config, pkgs, ... }:
|
|
||||||
{
|
|
||||||
home.preferXdgDirectories = true;
|
|
||||||
|
|
||||||
xdg =
|
|
||||||
let
|
|
||||||
homeDir = config.home.homeDirectory;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
cacheHome = "${homeDir}/.cache";
|
|
||||||
configHome = "${homeDir}/.config";
|
|
||||||
dataHome = "${homeDir}/.local/share";
|
|
||||||
stateHome = "${homeDir}/.local/state";
|
|
||||||
|
|
||||||
userDirs = {
|
|
||||||
enable = true;
|
|
||||||
createDirectories = true;
|
|
||||||
|
|
||||||
desktop = "${homeDir}/desktop";
|
|
||||||
documents = null;
|
|
||||||
download = "${homeDir}/downloads";
|
|
||||||
music = null;
|
|
||||||
pictures = "${homeDir}/pictures";
|
|
||||||
templates = null;
|
|
||||||
videos = "${homeDir}/videos";
|
|
||||||
};
|
|
||||||
|
|
||||||
portal = {
|
|
||||||
enable = true;
|
|
||||||
xdgOpenUsePortal = true;
|
|
||||||
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
|
|
||||||
config.common.default = [ "gtk" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
mimeApps = rec {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
associations.added = {
|
|
||||||
"application/json" = [ "nvim.desktop" ];
|
|
||||||
"application/pdf" = [ "org.pwmt.zathura-pdf-mupdf.desktop" ];
|
|
||||||
"application/xhtml+xml" = [ "zen-alpha.desktop" ];
|
|
||||||
"application/x-extension-htm" = [ "zen-alpha.desktop" ];
|
|
||||||
"application/x-extension-html" = [ "zen-alpha.desktop" ];
|
|
||||||
"application/x-extension-shtml" = [ "zen-alpha.desktop" ];
|
|
||||||
"application/x-extension-xhtml" = [ "zen-alpha.desktop" ];
|
|
||||||
"application/x-extension-xht" = [ "zen-alpha.desktop" ];
|
|
||||||
"image/png" = [ "feh.desktop" ];
|
|
||||||
"text/html" = [ "zen-alpha.desktop" ];
|
|
||||||
"text/plain" = [ "nvim.desktop" ];
|
|
||||||
"x-scheme-handler/chrome" = [ "zen-alpha.desktop" ];
|
|
||||||
"x-scheme-handler/http" = [ "zen-alpha.desktop" ];
|
|
||||||
"x-scheme-handler/https" = [ "zen-alpha.desktop" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultApplications = associations.added;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Reference in a new issue