dotfiles/modules/common/applications/media.nix

60 lines
1.5 KiB
Nix
Raw Permalink Normal View History

{ 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) {
home-manager.users.${config.user} = {
home.packages = with pkgs; [
2023-03-19 14:45:52 +00:00
nsxiv # Image viewer
mupdf # PDF viewer
zathura # PDF viewer
];
2023-03-11 19:14:45 +00:00
# Video player
programs.mpv = {
enable = true;
bindings = { };
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-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
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
xdg.mimeApps = {
associations.added = {
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
"image/jpeg" = [ "nsxiv.desktop" ];
2023-03-19 14:45:52 +00:00
"image/*" = [ "nsxiv.desktop" ];
};
associations.removed = {
"application/pdf" = [ "mupdf.desktop" "wine-extension-pdf.desktop" ];
};
defaultApplications = {
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
"image/jpeg" = [ "nsxiv.desktop" ];
2023-03-19 14:45:52 +00:00
"image/*" = [ "nsxiv.desktop" ];
};
};
};
2022-04-29 02:43:50 +00:00
};
}