nixdots/home/programs/xdg/mime-apps.nix

76 lines
2.5 KiB
Nix
Raw Permalink Normal View History

2024-04-04 21:17:11 +00:00
# Manage $XDG_CONFIG_HOME/mimeapps.list
{
2024-06-23 09:25:52 +00:00
osConfig,
...
}: let
cfg = osConfig.myOptions.home-manager.programs;
in {
2024-06-21 11:58:42 +00:00
xdg.mimeApps = let
2024-04-04 21:17:11 +00:00
browser = "firefox.desktop";
textEditor = browser; # nvim doesn't work properly with xdg-open, just use the browser
2024-06-21 11:58:42 +00:00
emailClient = browser;
pdfViewer = browser; # TODO: consider zathura (org.pwmt.zathura.desktop.desktop)
fileManager = "pcmanfm-qt.desktop"; # TODO: change
archiveManager = "org.kde.ark.desktop";
2024-06-23 09:25:52 +00:00
imageViewer =
if cfg.applications.qimgv.enable
then "qimgv.desktop"
else if cfg.applications.nomacs.enable
then "org.nomacs.ImageLounge.desktop"
else browser;
2024-04-04 21:17:11 +00:00
videoPlayer = "mpv.desktop";
audioPlayer = "mpv.desktop";
2024-06-21 11:58:42 +00:00
associations = {
"text/html" = [browser];
"x-scheme-handler/http" = [browser];
"x-scheme-handler/https" = [browser];
"x-scheme-handler/about" = [browser];
"x-scheme-handler/unknown" = [browser];
"application/x-extension-htm" = [browser];
"application/x-extension-html" = [browser];
"application/x-extension-shtml" = [browser];
"application/xhtml+xml" = [browser];
"application/x-extension-xhtml" = [browser];
"application/x-extension-xht" = [browser];
"application/pdf" = [pdfViewer];
"x-scheme-handler/mailto" = [emailClient];
"inode/directory" = [fileManager];
"application/zip" = [archiveManager];
"application/x-xz-compressed-tar" = [archiveManager];
"image/*" = [imageViewer];
"audio/*" = [audioPlayer];
"video/*" = [videoPlayer];
# The wildcard associations don't work everywhere, so we
# still need specific ones
"image/jpeg" = [imageViewer];
"image/png" = [imageViewer];
"image/svg+xml" = [imageViewer];
"image/gif" = [imageViewer];
"video/mp4" = [videoPlayer];
"text/plain" = [textEditor];
"application/json" = [textEditor];
"x-scheme-handler/spotify" = ["spotify.desktop"];
"x-scheme-handler/tg" = ["telegramdesktop.desktop"];
"x-scheme-handler/discord" = ["vesktop.desktop"];
"x-scheme-handler/msteams" = ["teams.desktop"]; # I need it for school, don't judge me
};
in {
enable = true;
associations.added = associations;
defaultApplications = associations;
2024-04-04 21:17:11 +00:00
};
2024-06-20 21:53:26 +00:00
home.sessionVariables = {
BROWSER = "firefox";
DEFAULT_BROWSER = "firefox";
2024-06-23 09:53:06 +00:00
TERMINAL = "kitty";
2024-06-20 21:53:26 +00:00
};
2024-04-04 21:17:11 +00:00
}