From 81652d4e48f3cc8bdd59df4fbd0c0a5e7a2e7990 Mon Sep 17 00:00:00 2001 From: Himadri Bhattacharjee <107522312+lavafroth@users.noreply.github.com> Date: Thu, 17 Jul 2025 09:12:09 +0530 Subject: [PATCH] feat: custom stylix module for konsole --- hosts/default/home/default.nix | 1 + hosts/default/home/konsole-stylix.nix | 86 +++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 hosts/default/home/konsole-stylix.nix diff --git a/hosts/default/home/default.nix b/hosts/default/home/default.nix index 7e57716..a63524f 100644 --- a/hosts/default/home/default.nix +++ b/hosts/default/home/default.nix @@ -23,6 +23,7 @@ ./video-editing.nix ./media-playback.nix ./mpv.nix + ./konsole-stylix.nix ]; home = { diff --git a/hosts/default/home/konsole-stylix.nix b/hosts/default/home/konsole-stylix.nix new file mode 100644 index 0000000..72f611d --- /dev/null +++ b/hosts/default/home/konsole-stylix.nix @@ -0,0 +1,86 @@ +{ + config, + pkgs, + lib, + ... +}: +{ + home.activation.konsolerc = lib.hm.dag.entryAfter [ "stylixLookAndFeel" ] '' + PATH="${config.home.path}/bin:$PATH:${pkgs.jq}" + palette=$HOME/.config/stylix/palette.json + scheme=$HOME/.local/share/konsole/Stylix.colorscheme + profile=$HOME/.local/share/konsole/Stylix.profile + + if ! [ -f $palette ]; then + echo "Palette doesn't exist" + else + json=$( cat $palette ) + + hex_to_rgb() { + hex=$1 + r=$((16#''${hex:0:2})) + g=$((16#''${hex:2:2})) + b=$((16#''${hex:4:2})) + echo "$r,$g,$b" + } + + for base in base00 base01 base02 base03 base04 base05 base06 base07 base08 base09 base0A base0B base0C base0D base0E base0F; do + hex=$(echo "$json" | jq -r ".$base") + rgb=$(hex_to_rgb "$hex") + declare "''${base}_rgb=$rgb" + done + + echo " + [Background] + Color=$base00_rgb + [BackgroundIntense] + Color=$base03_rgb + [Color0] + Color=$base00_rgb + [Color0Intense] + Color=$base03_rgb + [Color1] + Color=$base08_rgb + [Color1Intense] + Color=$base08_rgb + [Color2] + Color=$base0B_rgb + [Color2Intense] + Color=$base0B_rgb + [Color3] + Color=$base0A_rgb + [Color3Intense] + Color=$base0A_rgb + [Color4] + Color=$base0D_rgb + [Color4Intense] + Color=$base0D_rgb + [Color5] + Color=$base0E_rgb + [Color5Intense] + Color=$base0E_rgb + [Color6] + Color=$base0C_rgb + [Color6Intense] + Color=$base0C_rgb + [Color7] + Color=$base05_rgb + [Color7Intense] + Color=$base07_rgb + [Foreground] + Color=$base05_rgb + [ForegroundIntense] + Color=$base07_rgb + [General] + Description=Stylix + Wallpaper= + " > $scheme + + echo " + [Appearance] + ColorScheme=Stylix + " > $profile + fi + + ''; +}