2020-11-22 12:15:01 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
2019-10-19 12:55:35 +02:00
|
|
|
|
2020-11-22 12:15:01 +01:00
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
defaultApps = {
|
|
|
|
text = [ "org.gnome.gedit.desktop" ];
|
|
|
|
image = [ "org.gnome.eog.desktop" ];
|
|
|
|
audio = [ "io.github.celluloid_player.Celluloid.desktop" ];
|
|
|
|
video = [ "io.github.celluloid_player.Celluloid.desktop" ];
|
|
|
|
directory = [ "nautilus.desktop" "org.gnome.Nautilus.desktop" ];
|
2024-03-07 19:55:16 +01:00
|
|
|
mail = [ "mullvad-browser.desktop" ];
|
|
|
|
calendar = [ "mullvad-browser.desktop" ];
|
|
|
|
browser = [ "mullvad-browser.desktop" ];
|
2020-11-22 12:15:01 +01:00
|
|
|
office = [ "libreoffice.desktop" ];
|
2024-03-07 19:55:16 +01:00
|
|
|
pdf = [ "mullvad-browser.desktop" ];
|
2023-02-01 20:32:09 +01:00
|
|
|
ebook = [ "com.github.johnfactotum.Foliate.desktop" ];
|
2020-11-22 12:15:01 +01:00
|
|
|
magnet = [ "transmission-gtk.desktop" ];
|
|
|
|
signal = [ "signal-desktop.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" ];
|
|
|
|
mail = [ "x-scheme-handler/mailto" ];
|
|
|
|
calendar = [ "text/calendar" "x-scheme-handler/webcal" ];
|
|
|
|
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"
|
2023-02-01 20:32:09 +01:00
|
|
|
"application/rtf"
|
2020-11-22 12:15:01 +01:00
|
|
|
];
|
|
|
|
pdf = [ "application/pdf" ];
|
2023-02-01 20:32:09 +01:00
|
|
|
ebook = [ "application/epub+zip" ];
|
2020-11-22 12:15:01 +01:00
|
|
|
magnet = [ "x-scheme-handler/magnet" ];
|
|
|
|
signal = [ "signal-desktop.desktop" ];
|
2019-10-19 12:55:35 +02:00
|
|
|
};
|
2023-02-01 20:32:09 +01:00
|
|
|
|
|
|
|
associations = with lists;
|
|
|
|
listToAttrs (flatten (mapAttrsToList
|
|
|
|
(key: map (type: attrsets.nameValuePair type defaultApps."${key}"))
|
|
|
|
mimeMap));
|
|
|
|
|
|
|
|
noCalibre = let
|
|
|
|
mimeTypes = [
|
|
|
|
"application/pdf"
|
|
|
|
"application/vnd.oasis.opendocument.text"
|
|
|
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
|
|
"text/html"
|
|
|
|
"text/x-markdown"
|
|
|
|
];
|
|
|
|
desktopFiles = [
|
|
|
|
"calibre-ebook-edit.desktop"
|
|
|
|
"calibre-ebook-viewer.desktop"
|
|
|
|
"calibre-gui.desktop"
|
|
|
|
];
|
|
|
|
in lib.zipAttrs (map (d: lib.genAttrs mimeTypes (_: d)) desktopFiles);
|
2020-11-22 12:15:01 +01:00
|
|
|
in {
|
|
|
|
xdg.configFile."mimeapps.list".force = true;
|
|
|
|
xdg.mimeApps.enable = true;
|
2023-02-01 20:32:09 +01:00
|
|
|
xdg.mimeApps.associations.added = associations;
|
|
|
|
xdg.mimeApps.associations.removed = noCalibre;
|
|
|
|
xdg.mimeApps.defaultApplications = associations;
|
2024-03-09 10:49:19 +01:00
|
|
|
|
|
|
|
home.packages = with pkgs; [ junction ];
|
|
|
|
|
|
|
|
home.sessionVariables = {
|
|
|
|
# prevent wine from creating file associations
|
|
|
|
WINEDLLOVERRIDES = "winemenubuilder.exe=d";
|
|
|
|
};
|
2019-10-19 12:55:35 +02:00
|
|
|
}
|