nixos/users/malte/zathura.nix

52 lines
1.2 KiB
Nix

{
pkgs,
lib,
config,
...
}: let
configDir = "~/.config/zathura";
themeConfigFile = "themerc";
linkTheme = theme: ''
${pkgs.coreutils}/bin/ln -sf ${theme} ${configDir}/${themeConfigFile}
'';
lightTheme = config.myLib.mkZathuraTheme config.colorsLight;
darkTheme = config.myLib.mkZathuraTheme config.colorsDark;
in {
home.packages = [pkgs.hackNerdLigatures];
programs.zathura = {
enable = true;
options = {
selection-clipboard = "clipboard";
font = "Hack NF FC Ligatured 9";
render-loading = "true";
recolor = "true";
recolor-keephue = "true";
};
extraConfig = ''
map <Space> navigate next
map <S-Space> navigate previous
include ${themeConfigFile}
'';
};
services.darkman.scripts."zathura.sh" = {
onLight = pkgs.writeScript "zathura-light" ''
#!${pkgs.runtimeShell}
${linkTheme lightTheme}
'';
onDark = pkgs.writeScript "zathura-dark" ''
#!${pkgs.runtimeShell}
${linkTheme darkTheme}
'';
initialize = pkgs.writeScript "zathura-initialize" ''
# Create the folder
mkdir -p ${configDir}
if [[ ! -e ${configDir}/${themeConfigFile} ]]; then
${linkTheme lightTheme}
fi
'';
};
}