nixos/users/malte/zathura.nix

52 lines
1.2 KiB
Nix
Raw Normal View History

2022-04-17 19:44:06 +02:00
{
pkgs,
2022-05-11 11:44:50 +02:00
lib,
2022-04-17 19:44:06 +02:00
config,
...
}: let
2022-05-11 11:44:50 +02:00
configDir = "~/.config/zathura";
themeConfigFile = "themerc";
linkTheme = theme: ''
2022-10-13 16:58:23 +02:00
${pkgs.coreutils}/bin/ln -sf ${theme} ${configDir}/${themeConfigFile}
2022-05-11 11:44:50 +02:00
'';
2022-06-05 14:16:32 +02:00
lightTheme = config.myLib.mkZathuraTheme config.colorsLight;
darkTheme = config.myLib.mkZathuraTheme config.colorsDark;
2022-04-17 19:44:06 +02:00
in {
home.packages = [pkgs.hackNerdLigatures];
2021-05-23 15:58:16 +02:00
programs.zathura = {
enable = true;
options = {
selection-clipboard = "clipboard";
2022-04-17 19:44:06 +02:00
font = "Hack NF FC Ligatured 9";
2022-05-11 11:44:50 +02:00
render-loading = "true";
recolor = "true";
recolor-keephue = "true";
2021-05-23 15:58:16 +02:00
};
extraConfig = ''
map <Space> navigate next
map <S-Space> navigate previous
2022-05-11 11:44:50 +02:00
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
2021-05-23 15:58:16 +02:00
'';
};
}