{ pkgs, lib, config, ... }: let darkTheme = pkgs.writeTextFile { name = "kitty-dark"; text = builtins.readFile ./gruvbox_dark.conf; }; lightTheme = pkgs.writeTextFile { name = "kitty-light"; text = builtins.readFile ./gruvbox_light.conf; }; configDir = "~/.config/kitty"; themeConfigFile = "theme.conf"; loadTheme = name: "${pkgs.kitty}/bin/kitty +kitten themes --reload-in=all --config-file-name=${themeConfigFile} '${name}'"; in { programs.kitty = { enable = true; font = { name = "Hack NF FC Ligatured"; package = pkgs.hackNerdLigatures; size = 9; }; settings = { adjust_column_width = 1; adjust_line_height = 1; enable_audio_bell = "no"; #touch_scroll_multiplier = "10.0"; allow_remote_control = "yes"; remember_window_size = false; }; extraConfig = '' include ${themeConfigFile} ''; }; xdg.configFile."kitty/themes/Light.conf".source = lightTheme; xdg.configFile."kitty/themes/Dark.conf".source = darkTheme; services.darkman.scripts."kitty.sh" = { onLight = pkgs.writeScript "kitty-light" '' #!${pkgs.runtimeShell} ${loadTheme "Light"} ''; onDark = pkgs.writeScript "kitty-dark" '' #!${pkgs.runtimeShell} ${loadTheme "Dark"} ''; initialize = pkgs.writeScript "kitty-initialize" '' # Create the folder mkdir -p ${configDir} if [[ ! -e ${configDir}/${themeConfigFile} ]]; then ${loadTheme "Light"} fi ''; }; }