Add mime type module and refactor options
This commit is contained in:
parent
3a2266d44f
commit
69fb898087
25 changed files with 641 additions and 478 deletions
|
|
@ -29,7 +29,6 @@
|
|||
imports =
|
||||
[
|
||||
./common.nix
|
||||
./xdg.nix
|
||||
./themes
|
||||
./sync.nix
|
||||
]
|
||||
|
|
|
|||
86
home/xdg.nix
86
home/xdg.nix
|
|
@ -1,86 +0,0 @@
|
|||
# Copyright (c) 2020-2021 Mihai Fufezan
|
||||
# credits to fufexan https://github.com/fufexan/dotfiles/blob/main/home/terminal/programs/xdg.nix
|
||||
{ config, ... }:
|
||||
let
|
||||
browser = [ "firefox" ];
|
||||
imageViewer = [ "imv" ];
|
||||
videoPlayer = [ "mpv" ];
|
||||
audioPlayer = [ "io.bassi.Amberol" ];
|
||||
|
||||
xdgAssociations =
|
||||
type: program: list:
|
||||
builtins.listToAttrs (
|
||||
map (e: {
|
||||
name = "${type}/${e}";
|
||||
value = program;
|
||||
}) list
|
||||
);
|
||||
|
||||
image = xdgAssociations "image" imageViewer [
|
||||
"png"
|
||||
"svg"
|
||||
"jpeg"
|
||||
"gif"
|
||||
];
|
||||
video = xdgAssociations "video" videoPlayer [
|
||||
"mp4"
|
||||
"avi"
|
||||
"mkv"
|
||||
];
|
||||
audio = xdgAssociations "audio" audioPlayer [
|
||||
"mp3"
|
||||
"flac"
|
||||
"wav"
|
||||
"aac"
|
||||
];
|
||||
browserTypes =
|
||||
(xdgAssociations "application" browser [
|
||||
"json"
|
||||
"x-extension-htm"
|
||||
"x-extension-html"
|
||||
"x-extension-shtml"
|
||||
"x-extension-xht"
|
||||
"x-extension-xhtml"
|
||||
])
|
||||
// (xdgAssociations "x-scheme-handler" browser [
|
||||
"about"
|
||||
"ftp"
|
||||
"http"
|
||||
"https"
|
||||
"unknown"
|
||||
]);
|
||||
|
||||
# XDG MIME types
|
||||
associations = builtins.mapAttrs (_: v: (map (e: "${e}.desktop") v)) (
|
||||
{
|
||||
"application/pdf" = [ "org.pwmt.zathura-pdf-mupdf" ];
|
||||
"text/html" = browser;
|
||||
"text/plain" = [ "neovide" ];
|
||||
"x-scheme-handler/chrome" = [ "com.brave.browser" ];
|
||||
"inode/directory" = [ "yazi" ];
|
||||
}
|
||||
// image
|
||||
// video
|
||||
// audio
|
||||
// browserTypes
|
||||
);
|
||||
in
|
||||
{
|
||||
xdg = {
|
||||
enable = true;
|
||||
cacheHome = config.home.homeDirectory + "/.local/cache";
|
||||
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
defaultApplications = associations;
|
||||
};
|
||||
|
||||
userDirs = {
|
||||
enable = true;
|
||||
createDirectories = true;
|
||||
extraConfig = {
|
||||
XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue