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, ... }:
let
c = config.lib.stylix.colors;
# Truecolor swatch for one base16 slot. `` stays a literal JSON escape
# here — fastfetch's JSONC parser turns it into a real ESC byte.
# Foreground blocks, not background-coloured spaces: a coloured space is
# One dot per base16 slot. The literal \u001b in the format string stays a
# JSON escape here — fastfetch's JSONC parser turns it into a real ESC byte.
# Foreground glyph, not a background-coloured space: a coloured space is
# 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";
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
{
# Install fastfetch
@ -50,42 +56,29 @@ in
"uptime",
"memory",
"break",
"de",
"wm",
"theme",
"icons",
"cursor",
"font",
"display",
"wm",${lib.optionalString isDesktop ''
{
"type": "custom",
"key": "Shell",
"keyIcon": "󰕮",
"format": "Quickshell ${pkgs.quickshell.version} (bar, launcher, lock)"
},''}
"shell",
"terminal",
"terminalfont",
"display",
"break",
{
"type": "custom",
"key": "Scheme",
"keyIcon": "󰉦",
"format": "base16, generated by stylix from wallpaper.png (${config.stylix.polarity})"
"key": "Theme",
"keyIcon": "󰉼",
"format": "${themeLine}"
},
{
"type": "custom",
"key": "Base",
"key": "Palette",
"keyIcon": "󰸌",
"format": "${paletteRow [ "base00" "base01" "base02" "base03" "base04" "base05" "base06" "base07" ]}"
},
{
"type": "custom",
"key": "Accent",
"keyIcon": "󰸌",
"format": "${paletteRow [ "base08" "base09" "base0A" "base0B" "base0C" "base0D" "base0E" "base0F" ]}"
},
{
"type": "colors",
"key": "Term",
"symbol": "block",
"block": {
"width": 2
}
"format": "${paletteRow [ "base00" "base01" "base02" "base03" "base04" "base05" "base06" "base07" "base08" "base09" "base0A" "base0B" "base0C" "base0D" "base0E" "base0F" ]}"
}
]
}