2024-04-20 09:42:06 -04:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
{
|
2022-04-28 22:43:50 -04:00
|
|
|
|
2022-12-21 14:18:03 -07:00
|
|
|
options = {
|
|
|
|
media = {
|
|
|
|
enable = lib.mkEnableOption {
|
|
|
|
description = "Enable media programs.";
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf (config.gui.enable && config.media.enable) {
|
2023-02-17 18:14:57 -05:00
|
|
|
home-manager.users.${config.user} = {
|
|
|
|
home.packages = with pkgs; [
|
2023-03-19 10:45:52 -04:00
|
|
|
nsxiv # Image viewer
|
2023-02-17 18:14:57 -05:00
|
|
|
mupdf # PDF viewer
|
|
|
|
zathura # PDF viewer
|
|
|
|
];
|
|
|
|
|
2023-03-11 14:14:45 -05:00
|
|
|
# Video player
|
|
|
|
programs.mpv = {
|
|
|
|
enable = true;
|
|
|
|
bindings = { };
|
2023-06-05 23:50:32 -04:00
|
|
|
config = {
|
2023-07-29 23:56:41 -04:00
|
|
|
image-display-duration = 2; # For cycling through images
|
|
|
|
hwdec = "auto-safe"; # Attempt to use GPU decoding for video
|
2023-06-05 23:50:32 -04:00
|
|
|
};
|
2023-03-25 10:51:20 -04:00
|
|
|
scripts = [
|
|
|
|
|
|
|
|
# Automatically load playlist entries before and after current file
|
|
|
|
pkgs.mpvScripts.autoload
|
|
|
|
|
|
|
|
# Delete current file after quitting
|
2023-08-02 11:51:11 -04:00
|
|
|
pkgs.mpvScripts.mpv-delete-file
|
2023-03-25 10:51:20 -04:00
|
|
|
];
|
2023-03-11 14:14:45 -05:00
|
|
|
};
|
|
|
|
|
2023-07-29 23:56:41 -04:00
|
|
|
# Set default programs for opening PDFs and other media
|
2023-03-08 22:58:49 -05:00
|
|
|
xdg.mimeApps = {
|
|
|
|
associations.added = {
|
|
|
|
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
|
2023-04-03 21:54:53 -04:00
|
|
|
"image/jpeg" = [ "nsxiv.desktop" ];
|
2024-02-06 22:12:14 -05:00
|
|
|
"image/png" = [ "nsxiv.desktop" ];
|
2023-03-19 10:45:52 -04:00
|
|
|
"image/*" = [ "nsxiv.desktop" ];
|
2023-03-08 22:58:49 -05:00
|
|
|
};
|
2023-04-03 21:54:53 -04:00
|
|
|
associations.removed = {
|
2024-04-20 09:42:06 -04:00
|
|
|
"application/pdf" = [
|
|
|
|
"mupdf.desktop"
|
|
|
|
"wine-extension-pdf.desktop"
|
|
|
|
];
|
2023-04-03 21:54:53 -04:00
|
|
|
};
|
2023-03-08 22:58:49 -05:00
|
|
|
defaultApplications = {
|
|
|
|
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
|
2023-04-03 21:54:53 -04:00
|
|
|
"image/jpeg" = [ "nsxiv.desktop" ];
|
2024-02-06 22:12:14 -05:00
|
|
|
"image/png" = [ "nsxiv.desktop" ];
|
2023-03-19 10:45:52 -04:00
|
|
|
"image/*" = [ "nsxiv.desktop" ];
|
2023-03-08 22:58:49 -05:00
|
|
|
};
|
|
|
|
};
|
2023-02-17 18:14:57 -05:00
|
|
|
};
|
2022-04-28 22:43:50 -04:00
|
|
|
};
|
|
|
|
}
|