mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-04-02 11:12:09 +02:00
change mime
This commit is contained in:
@@ -1,50 +1,93 @@
|
||||
# Mime allows us to configure the default applications for each file type
|
||||
{
|
||||
{ pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
defaultApps = {
|
||||
browser = [ "zen-beta.desktop" ];
|
||||
text = [ "org.gnome.TextEditor.desktop" ];
|
||||
image = [ "imv-dir.desktop" ];
|
||||
audio = [ "mpv.desktop" ];
|
||||
video = [ "mpv.desktop" ];
|
||||
directory = [ "thunar.desktop" ];
|
||||
office = [ "libreoffice.desktop" ];
|
||||
pdf = [ "zathura.desktop" ];
|
||||
terminal = [ "kitty.desktop" ];
|
||||
discord = [ "discord.desktop" ];
|
||||
};
|
||||
|
||||
mimeMap = {
|
||||
text = [ "text/plain" ];
|
||||
image = [
|
||||
"image/bmp"
|
||||
"image/gif"
|
||||
"image/jpeg"
|
||||
"image/jpg"
|
||||
"image/png"
|
||||
"image/svg+xml"
|
||||
"image/tiff"
|
||||
"image/vnd.microsoft.icon"
|
||||
"image/webp"
|
||||
];
|
||||
audio = [
|
||||
"audio/aac"
|
||||
"audio/mpeg"
|
||||
"audio/ogg"
|
||||
"audio/opus"
|
||||
"audio/wav"
|
||||
"audio/webm"
|
||||
"audio/x-matroska"
|
||||
];
|
||||
video = [
|
||||
"video/mp2t"
|
||||
"video/mp4"
|
||||
"video/mpeg"
|
||||
"video/ogg"
|
||||
"video/webm"
|
||||
"video/x-flv"
|
||||
"video/x-matroska"
|
||||
"video/x-msvideo"
|
||||
];
|
||||
directory = [ "inode/directory" ];
|
||||
browser = [
|
||||
"text/html"
|
||||
"x-scheme-handler/about"
|
||||
"x-scheme-handler/http"
|
||||
"x-scheme-handler/https"
|
||||
"x-scheme-handler/unknown"
|
||||
];
|
||||
office = [
|
||||
"application/vnd.oasis.opendocument.text"
|
||||
"application/vnd.oasis.opendocument.spreadsheet"
|
||||
"application/vnd.oasis.opendocument.presentation"
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
||||
"application/msword"
|
||||
"application/vnd.ms-excel"
|
||||
"application/vnd.ms-powerpoint"
|
||||
"application/rtf"
|
||||
];
|
||||
pdf = [ "application/pdf" ];
|
||||
terminal = [ "terminal" ];
|
||||
# archive = [
|
||||
# "application/zip"
|
||||
# "application/rar"
|
||||
# "application/7z"
|
||||
# "application/*tar"
|
||||
# ];
|
||||
discord = [ "x-scheme-handler/discord" ];
|
||||
};
|
||||
|
||||
associations = with lists;
|
||||
listToAttrs (flatten (mapAttrsToList
|
||||
(key: map (type: attrsets.nameValuePair type defaultApps."${key}"))
|
||||
mimeMap));
|
||||
in {
|
||||
xdg = {
|
||||
enable = true;
|
||||
mime.enable = true;
|
||||
userDirs.enable = true;
|
||||
portal.xdgOpenUsePortal = true;
|
||||
configFile."mimeapps.list".force =
|
||||
true; # don't error when mimeapps.list is replaced, it gets replaced often
|
||||
configFile."mimeapps.list".force = true;
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
defaultApplications = {
|
||||
"text/markdown" = "nvim.desktop";
|
||||
"text/plain" = "nvim.desktop";
|
||||
"text/x-shellscript" = "nvim.desktop";
|
||||
"text/x-python" = "nvim.desktop";
|
||||
"text/x-go" = "nvim.desktop";
|
||||
"text/css" = "nvim.desktop";
|
||||
"text/javascript" = "nvim.desktop";
|
||||
"text/x-c" = "nvim.desktop";
|
||||
"text/x-c++" = "nvim.desktop";
|
||||
"text/x-java" = "nvim.desktop";
|
||||
"text/x-rust" = "nvim.desktop";
|
||||
"text/x-yaml" = "nvim.desktop";
|
||||
"text/x-toml" = "nvim.desktop";
|
||||
"text/x-dockerfile" = "nvim.desktop";
|
||||
"text/x-xml" = "nvim.desktop";
|
||||
"text/x-php" = "nvim.desktop";
|
||||
"image/jpeg" = "imv.desktop";
|
||||
"image/jpg" = "imv.desktop";
|
||||
"image/webp" = "imv.desktop";
|
||||
"inode/directory" = "thunar.desktop";
|
||||
"application/pdf" = "zathura.desktop";
|
||||
"image/png" = "imv-dir.desktop";
|
||||
|
||||
"image/gif" = "zen-beta.desktop";
|
||||
"x-scheme-handler/http" = "zen-beta.desktop";
|
||||
"x-scheme-handler/https" = "zen-beta.desktop";
|
||||
"x-scheme-handler/chrome" = "zen-beta.desktop";
|
||||
"text/html" = "zen-beta.desktop";
|
||||
"application/x-extension-htm" = "zen-beta.desktop";
|
||||
"application/x-extension-html" = "zen-beta.desktop";
|
||||
"application/x-extension-shtml" = "zen-beta.desktop";
|
||||
"application/xhtml+xml" = "zen-beta.desktop";
|
||||
"application/x-extension-xhtml" = "zen-beta.desktop";
|
||||
"application/x-extension-xht" = "zen-beta.desktop";
|
||||
};
|
||||
associations.added = associations;
|
||||
defaultApplications = associations;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user