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