From e2aa1f598674aa9c06f28f5db60b89f37f1e961b Mon Sep 17 00:00:00 2001 From: Nelson Alex Jeppesen <50854675+NelsonJeppesen@users.noreply.github.com> Date: Tue, 8 Feb 2022 10:54:24 -0800 Subject: [PATCH] kitty: add option `theme` (#2710) Add Kitty option to install kitty-themes and configure Kitty to use one of those themes --- modules/programs/kitty.nix | 19 +++++++++++++++++++ .../kitty/example-settings-expected.conf | 2 ++ 2 files changed, 21 insertions(+) diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix index b39b58d0b..5ebdf05ea 100644 --- a/modules/programs/kitty.nix +++ b/modules/programs/kitty.nix @@ -72,6 +72,18 @@ in { ''; }; + theme = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Apply a Kitty color theme. This option takes the friendly name of + any theme given by the command kitty +kitten themes. + See + for more details. + ''; + example = "Space Gray Eighties"; + }; + font = mkOption { type = types.nullOr hm.types.fontType; default = null; @@ -130,6 +142,13 @@ in { "font_size ${toString cfg.font.size}"} ''} + ${optionalString (cfg.theme != null) '' + include ${pkgs.kitty-themes}/${ + (head (filter (x: x.name == cfg.theme) (builtins.fromJSON + (builtins.readFile "${pkgs.kitty-themes}/themes.json")))).file + } + ''} + ${toKittyConfig cfg.settings} ${toKittyKeybindings cfg.keybindings} diff --git a/tests/modules/programs/kitty/example-settings-expected.conf b/tests/modules/programs/kitty/example-settings-expected.conf index 0afd7a9a0..8d0fbd14a 100644 --- a/tests/modules/programs/kitty/example-settings-expected.conf +++ b/tests/modules/programs/kitty/example-settings-expected.conf @@ -5,6 +5,8 @@ font_family DejaVu Sans font_size 8 + + enable_audio_bell no scrollback_lines 10000 update_check_interval 0