fastfetch: compact layout, palette dots, quickshell line

This commit is contained in:
rope 2026-07-28 22:39:09 +01:00
parent 2d5c385ec1
commit 311e5b8e25

View file

@ -1,12 +1,18 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
c = config.lib.stylix.colors; c = config.lib.stylix.colors;
# Truecolor swatch for one base16 slot. `` stays a literal JSON escape # One dot per base16 slot. The literal \u001b in the format string stays a
# here — fastfetch's JSONC parser turns it into a real ESC byte. # JSON escape here — fastfetch's JSONC parser turns it into a real ESC byte.
# Foreground blocks, not background-coloured spaces: a coloured space is # Foreground glyph, not a background-coloured space: a coloured space is
# invisible anywhere the colour is stripped (copy/paste, piped output). # invisible anywhere the colour is stripped (copy/paste, piped output).
swatch = n: "\\u001b[38;2;${c."${n}-rgb-r"};${c."${n}-rgb-g"};${c."${n}-rgb-b"}m"; swatch = n: "\\u001b[38;2;${c."${n}-rgb-r"};${c."${n}-rgb-g"};${c."${n}-rgb-b"}m ";
paletteRow = names: lib.concatMapStrings swatch names + "\\u001b[0m"; paletteRow = names: lib.concatMapStrings swatch names + "\\u001b[0m";
isDesktop = lib.elem config.networking.hostName [ "FredOS-Gaming" "FredOS-Macbook" ];
# Headless hosts leave gtk.iconTheme unset, so this stays null there.
iconTheme = config.home-manager.users.fred.gtk.iconTheme or null;
themeLine = "stylix base16 (${config.stylix.polarity})"
+ lib.optionalString (iconTheme != null) " · ${iconTheme.name} icons"
+ " · ${config.stylix.cursor.name} cursor";
in in
{ {
# Install fastfetch # Install fastfetch
@ -50,42 +56,29 @@ in
"uptime", "uptime",
"memory", "memory",
"break", "break",
"de", "wm",${lib.optionalString isDesktop ''
"wm",
"theme", {
"icons", "type": "custom",
"cursor", "key": "Shell",
"font", "keyIcon": "󰕮",
"display", "format": "Quickshell ${pkgs.quickshell.version} (bar, launcher, lock)"
},''}
"shell", "shell",
"terminal", "terminal",
"terminalfont", "display",
"break", "break",
{ {
"type": "custom", "type": "custom",
"key": "Scheme", "key": "Theme",
"keyIcon": "󰉦", "keyIcon": "󰉼",
"format": "base16, generated by stylix from wallpaper.png (${config.stylix.polarity})" "format": "${themeLine}"
}, },
{ {
"type": "custom", "type": "custom",
"key": "Base", "key": "Palette",
"keyIcon": "󰸌", "keyIcon": "󰸌",
"format": "${paletteRow [ "base00" "base01" "base02" "base03" "base04" "base05" "base06" "base07" ]}" "format": "${paletteRow [ "base00" "base01" "base02" "base03" "base04" "base05" "base06" "base07" "base08" "base09" "base0A" "base0B" "base0C" "base0D" "base0E" "base0F" ]}"
},
{
"type": "custom",
"key": "Accent",
"keyIcon": "󰸌",
"format": "${paletteRow [ "base08" "base09" "base0A" "base0B" "base0C" "base0D" "base0E" "base0F" ]}"
},
{
"type": "colors",
"key": "Term",
"symbol": "block",
"block": {
"width": 2
}
} }
] ]
} }