2024-03-09 11:11:47 +01:00
|
|
|
{ pkgs, lib, ... }:
|
2019-10-19 12:55:35 +02:00
|
|
|
|
2020-11-22 12:15:01 +01:00
|
|
|
with lib;
|
|
|
|
let
|
2024-03-09 11:11:47 +01:00
|
|
|
browsers = [
|
|
|
|
"mullvad-browser.desktop"
|
|
|
|
"mullvad-browser-work.desktop"
|
|
|
|
"firefox.desktop"
|
|
|
|
"firefox-work.desktop"
|
|
|
|
"tor-browser.desktop"
|
|
|
|
];
|
|
|
|
|
2020-11-22 12:15:01 +01:00
|
|
|
defaultApps = {
|
|
|
|
text = [ "org.gnome.gedit.desktop" ];
|
2024-03-09 11:11:47 +01:00
|
|
|
image = [ "org.gnome.Loupe.desktop" ];
|
2020-11-22 12:15:01 +01:00
|
|
|
audio = [ "io.github.celluloid_player.Celluloid.desktop" ];
|
|
|
|
video = [ "io.github.celluloid_player.Celluloid.desktop" ];
|
2024-05-26 16:45:38 +02:00
|
|
|
directory = [
|
|
|
|
"nautilus.desktop"
|
|
|
|
"org.gnome.Nautilus.desktop"
|
|
|
|
];
|
2024-03-09 11:11:47 +01:00
|
|
|
mail = [ "re.sonny.Junction.desktop" ] ++ browsers;
|
|
|
|
calendar = [ "re.sonny.Junction.desktop" ] ++ browsers;
|
|
|
|
browser = [ "re.sonny.Junction.desktop" ] ++ browsers;
|
2020-11-22 12:15:01 +01:00
|
|
|
office = [ "libreoffice.desktop" ];
|
2024-03-09 11:11:47 +01:00
|
|
|
pdf = [ "re.sonny.Junction.desktop" ] ++ browsers;
|
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" ];
|
2024-05-26 16:45:38 +02:00
|
|
|
calendar = [
|
|
|
|
"text/calendar"
|
|
|
|
"x-scheme-handler/webcal"
|
|
|
|
];
|
2020-11-22 12:15:01 +01:00
|
|
|
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
|
|
|
|
2024-05-26 16:45:38 +02:00
|
|
|
associations =
|
|
|
|
with lists;
|
|
|
|
listToAttrs (
|
|
|
|
flatten (mapAttrsToList (key: map (type: attrsets.nameValuePair type defaultApps."${key}")) mimeMap)
|
|
|
|
);
|
2023-02-01 20:32:09 +01:00
|
|
|
|
2024-05-26 16:45:38 +02:00
|
|
|
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);
|
|
|
|
in
|
|
|
|
{
|
2020-11-22 12:15:01 +01:00
|
|
|
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
|
|
|
}
|