Add kitty theming

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-06-23 20:46:43 +03:00
parent 3d503fd1c2
commit bedf27aa5f
9 changed files with 271 additions and 56 deletions

View File

@@ -105,12 +105,15 @@ in
fi
'';
home = {
sessionVariables.NIXOS_OZONE_WL = "1";
theme.extraConfig = let name = "reload-hyprland"; in
"${pkgs.writeShellApplication {
inherit name;
runtimeInputs = with pkgs; [ hyprland ];
text = ''
hyprctl reload
'';
}}/bin/${name} &";
packages = with pkgs; [
pavucontrol
];
};
home.sessionVariables.NIXOS_OZONE_WL = "1";
};
}

View File

@@ -1,4 +1,4 @@
{ user ? throw "user argument is required" }: { config, ... }:
{ user ? throw "user argument is required" }: { config, pkgs, ... }:
let
hmConfig = config.home-manager.users."${user.name}";
@@ -9,9 +9,26 @@ in
enable = true;
extraConfig = ''
confirm_os_window_close 0
include theme.conf
'';
};
programs.matugen.settings.templates = {
kitty = {
input_path = ./theme.conf;
output_path = "${hmConfig.xdg.configHome}/kitty/theme.conf";
};
};
theme.extraConfig = let name = "reload-kitty"; in
"${pkgs.writeShellApplication {
inherit name;
runtimeInputs = with pkgs; [ procps ];
text = ''
pkill kitty -SIGUSR1
'';
}}/bin/${name} &";
home.persistence."/cache${user.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/kitty" ];
};
}

View File

@@ -0,0 +1,29 @@
background_tint 0.0
background_opacity {{custom.opacity}}
background {{colors.surface.default.hex}}
foreground {{colors.on_surface.default.hex}}
selection_background {{colors.primary.default.hex}}
selection_foreground {{colors.on_primary.default.hex}}
url_color {{colors.tertiary.default.hex}}
cursor {{colors.on_surface.default.hex}}
color0 {{colors.surface.default.hex}}
color1 {{colors.red.default.hex}}
color2 {{colors.green.default.hex}}
color3 {{colors.yellow.default.hex}}
color4 {{colors.blue.default.hex}}
color5 {{colors.magenta.default.hex}}
color6 {{colors.cyan.default.hex}}
color7 {{colors.on_surface.default.hex}}
color8 {{colors.outline_variant.default.hex}}
color9 {{colors.red.default.hex}}
color10 {{colors.green.default.hex}}
color11 {{colors.yellow.default.hex}}
color12 {{colors.blue.default.hex}}
color13 {{colors.magenta.default.hex}}
color14 {{colors.cyan.default.hex}}
color15 {{colors.on_surface_variant.default.hex}}

View File

@@ -1,4 +1,4 @@
{ user ? throw "user argument is required" }: { config, ... }:
{ user ? throw "user argument is required" }: { config, lib, pkgs, ... }:
let
hmConfig = config.home-manager.users."${user.name}";
@@ -44,6 +44,7 @@ in
flavour = hmConfig.theme.flavour;
contrast = builtins.toString hmConfig.theme.contrast;
opacity = builtins.toString hmConfig.theme.opacity;
transparency = builtins.toString (1 - hmConfig.theme.opacity);
radius = builtins.toString hmConfig.theme.radius;
padding = builtins.toString hmConfig.theme.padding;
double_padding = builtins.toString (hmConfig.theme.padding * 2);
@@ -54,5 +55,17 @@ in
templates = { };
};
};
theme.extraConfig = let name = "theme-matugen"; in
lib.mkBefore "${pkgs.writeShellApplication {
inherit name;
runtimeInputs = with pkgs; [ matugen ];
text = ''
matugen image "${hmConfig.theme.configDir}/wallpaper" \
--type scheme-${hmConfig.theme.flavour} \
--mode "$(cat "${hmConfig.theme.configDir}/mode")" \
--contrast ${builtins.toString hmConfig.theme.contrast}
'';
}}/bin/${name}";
};
}

View File

@@ -1,4 +1,4 @@
{ user ? throw "user argument is required" }: { config, pkgs, ... }:
{ user ? throw "user argument is required" }: { config, lib, pkgs, ... }:
let
hmConfig = config.home-manager.users."${user.name}";
@@ -10,24 +10,30 @@ in
persistence."/cache${user.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/swww" ];
};
theme.extraConfig = let name = "theme-swww"; in
wayland.windowManager.hyprland.initExtraConfig = let name = "init-swww"; in
"${pkgs.writeShellApplication {
inherit name;
runtimeInputs = with pkgs; [
coreutils-full
swww
];
text = ''
if ! pgrep -x "swww-daemon" > /dev/null; then
swww-daemon &> /tmp/swww.log &
fi
inherit name;
runtimeInputs = with pkgs; [ swww ];
text = ''
swww-daemon &> /tmp/swww.log
'';
}}/bin/${name} &";
while ! swww query &> /dev/null; do
sleep 0.1
done
theme.extraConfig = let name = "theme-swww"; in
lib.mkAfter "${pkgs.writeShellApplication {
inherit name;
runtimeInputs = with pkgs; [
coreutils-full
procps
swww
];
text = ''
while ! swww query &> /dev/null; do
sleep 0.1
done
swww img "${hmConfig.theme.configDir}/wallpaper"
'';
}}/bin/${name}";
swww img "${hmConfig.theme.configDir}/wallpaper"
'';
}}/bin/${name} &";
};
}

View File

@@ -6,6 +6,7 @@ in
{
home-manager.users."${user.name}" = {
theme.enable = true;
wayland.windowManager.hyprland.initExtraConfig = "${hmConfig.theme.pkg}/bin/theme &";
home.persistence."/persist${user.home}".directories = [ "${hmConfig.xdg.relativeConfigHome}/theme" ];
};
}