feat: fix kitty theme switching via auto.conf, add catppuccin mocha theme

This commit is contained in:
2026-03-04 22:21:12 +01:00
parent 3cc73f77bb
commit 0d2d04ede1
3 changed files with 102 additions and 53 deletions
+40 -33
View File
@@ -1,63 +1,55 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
c = config.theme.colors; c = config.theme.colors;
colorConf = ''
background ${c.bg}
foreground ${c.fg}
selection_background ${c.bg2}
selection_foreground ${c.fg}
cursor ${c.fg}
cursor_text_color ${c.bg}
url_color ${c.blue_b}
color0 ${c.bg1}
color8 ${c.bg2}
color1 ${c.red}
color9 ${c.red_b}
color2 ${c.green}
color10 ${c.green_b}
color3 ${c.yellow}
color11 ${c.yellow_b}
color4 ${c.blue}
color12 ${c.blue_b}
color5 ${c.purple}
color13 ${c.purple_b}
color6 ${c.aqua}
color14 ${c.aqua_b}
color7 ${c.fg4}
color15 ${c.fg1}
'';
in in
{ {
programs.kitty = { programs.kitty = {
enable = true; enable = true;
package = pkgs.emptyDirectory; package = pkgs.emptyDirectory;
font = { font = {
name = "JetBrainsMono Nerd Font"; name = "JetBrainsMono Nerd Font";
size = 12; size = 12;
}; };
settings = { settings = {
shell = "zsh --login"; shell = "zsh --login";
# Colors
background = c.bg;
foreground = c.fg;
selection_background = c.bg2;
selection_foreground = c.fg;
cursor = c.fg;
cursor_text_color = c.bg;
url_color = c.blue_b;
color0 = c.bg1; color8 = c.bg2;
color1 = c.red; color9 = c.red_b;
color2 = c.green; color10 = c.green_b;
color3 = c.yellow; color11 = c.yellow_b;
color4 = c.blue; color12 = c.blue_b;
color5 = c.purple; color13 = c.purple_b;
color6 = c.aqua; color14 = c.aqua_b;
color7 = c.fg4; color15 = c.fg1;
# Window
window_padding_width = 12; window_padding_width = 12;
background_opacity = "1.0"; background_opacity = "1.0";
hide_window_decorations = "yes"; hide_window_decorations = "yes";
# Cursor
cursor_shape = "block"; cursor_shape = "block";
cursor_blink_interval = 1; cursor_blink_interval = 1;
# Scrollback
scrollback_lines = 3000; scrollback_lines = 3000;
# Selection
copy_on_select = "yes"; copy_on_select = "yes";
strip_trailing_spaces = "smart"; strip_trailing_spaces = "smart";
# Tab bar
tab_bar_style = "powerline"; tab_bar_style = "powerline";
tab_bar_align = "left"; tab_bar_align = "left";
tab_bar_edge = "top"; tab_bar_edge = "top";
# Shell integration
shell_integration = "enabled"; shell_integration = "enabled";
}; };
keybindings = { keybindings = {
"ctrl+shift+n" = "new_window"; "ctrl+shift+n" = "new_window";
"ctrl+t" = "new_tab"; "ctrl+t" = "new_tab";
@@ -66,4 +58,19 @@ in
"ctrl+0" = "change_font_size all 0"; "ctrl+0" = "change_font_size all 0";
}; };
}; };
# Write theme colors into the auto conf files so they take effect
# regardless of OS dark/light mode setting
home.file.".config/kitty/dark-theme.auto.conf" = {
force = true;
text = colorConf;
};
home.file.".config/kitty/light-theme.auto.conf" = {
force = true;
text = colorConf;
};
home.file.".config/kitty/no-preference-theme.auto.conf" = {
force = true;
text = colorConf;
};
} }
+49 -8
View File
@@ -1,11 +1,7 @@
{ lib, ... }: { lib, config, ... }:
let
{ themes = {
options.theme.colors = lib.mkOption { gruvboxDarkMedium = {
type = lib.types.attrsOf lib.types.str;
description = "Named color palette";
default = {
# Gruvbox Dark Medium
bg = "#282828"; bg = "#282828";
bg0_h = "#1d2021"; bg0_h = "#1d2021";
bg0_s = "#32302f"; bg0_s = "#32302f";
@@ -34,5 +30,50 @@
orange_b = "#fe8019"; orange_b = "#fe8019";
gray = "#928374"; gray = "#928374";
}; };
catppuccinMocha = {
bg = "#1e1e2e";
bg0_h = "#11111b";
bg0_s = "#181825";
bg1 = "#313244";
bg2 = "#45475a";
bg3 = "#585b70";
bg4 = "#6c7086";
fg = "#cdd6f4";
fg1 = "#cdd6f4";
fg2 = "#bac2de";
fg3 = "#a6adc8";
fg4 = "#9399b2";
red = "#d20f39";
red_b = "#f38ba8";
green = "#40a02b";
green_b = "#a6e3a1";
yellow = "#df8e1d";
yellow_b = "#f9e2af";
blue = "#1e66f5";
blue_b = "#89b4fa";
purple = "#8839ef";
purple_b = "#cba6f7";
aqua = "#179299";
aqua_b = "#94e2d5";
orange = "#fe640b";
orange_b = "#fab387";
gray = "#7f849c";
}; };
};
in
{
options.theme = {
name = lib.mkOption {
type = lib.types.enum (builtins.attrNames themes);
default = "gruvboxDarkMedium";
description = "Theme name to use";
};
colors = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
description = "Named color palette";
default = themes.gruvboxDarkMedium;
};
};
config.theme.colors = themes.${config.theme.name};
} }
+1
View File
@@ -9,6 +9,7 @@
myConfig.wayland.enable = true; myConfig.wayland.enable = true;
myConfig.niri.defaultColumnProportion = 1.0; myConfig.niri.defaultColumnProportion = 1.0;
myConfig.niri.presetColumnWidths = [ 0.5 1.0 ]; myConfig.niri.presetColumnWidths = [ 0.5 1.0 ];
# theme.name = "catppuccinMocha";
home.packages = with pkgs; [ home.packages = with pkgs; [
powertop powertop
acpi acpi