From e9952833638a4e86c76053732dc28f561e1315bf Mon Sep 17 00:00:00 2001 From: Emma Thorpe Date: Tue, 16 Jun 2026 11:12:44 +0100 Subject: [PATCH] feat(shell.nix): configure htop settings and meters Flesh out programs.htop: tree view, sensible highlights, hidden kernel threads, left CPU/Memory/Swap bar meters and right Tasks/LoadAverage/Uptime text meters. color_scheme = 0 inherits the terminal's Catppuccin Mocha palette, as htop has no custom-theme support of its own. Drop the explicit pkgs.htop: programs.htop.enable already installs it. --- lyrathorpe/home/shell.nix | 51 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/lyrathorpe/home/shell.nix b/lyrathorpe/home/shell.nix index a00770f..cfb2d32 100644 --- a/lyrathorpe/home/shell.nix +++ b/lyrathorpe/home/shell.nix @@ -26,7 +26,6 @@ in pkgs.tea pkgs.hyperfine # command-line benchmarking pkgs.sd # saner find-and-replace than sed - pkgs.htop # ensure there's a system monitor ]; # Resource monitor, themed Catppuccin Mocha to match the rest of the desktop. @@ -346,8 +345,58 @@ in # enables this in the work module; both being true merges cleanly. services.ssh-agent.enable = lib.mkIf pkgs.stdenv.hostPlatform.isLinux true; + # Classic process viewer (complements btop). htop has no custom-theme support + # -- only a handful of built-in color schemes -- so it can't be hex-themed like + # btop/bat/fzf. color_scheme = 0 (Default) draws from the terminal's ANSI + # palette, which is Catppuccin Mocha (foot/iTerm2), so it matches by deferring + # to the terminal rather than vendoring a theme. programs.htop = { enable = true; + settings = { + color_scheme = 0; # Default -> uses the terminal's Catppuccin palette + delay = 15; # refresh every 1.5s + cpu_count_from_one = 1; + show_cpu_frequency = 1; + show_cpu_usage = 1; # per-core usage shown in the CPU bars + highlight_base_name = 1; # highlight the program name within the path + highlight_megabytes = 1; + highlight_threads = 1; + hide_kernel_threads = 1; + show_program_path = 0; # show just the command, not the full path + tree_view = 1; # start in process-tree mode + tree_view_always_by_pid = 0; + account_guest_in_cpu_meter = 0; + fields = with config.lib.htop.fields; [ + PID + USER + PRIORITY + NICE + M_SIZE + M_RESIDENT + M_SHARE + STATE + PERCENT_CPU + PERCENT_MEM + TIME + COMM + ]; + } + // ( + with config.lib.htop; + leftMeters [ + (bar "AllCPUs2") + (bar "Memory") + (bar "Swap") + ] + ) + // ( + with config.lib.htop; + rightMeters [ + (text "Tasks") + (text "LoadAverage") + (text "Uptime") + ] + ); }; # Drop the zsh completion dump on every activation. A stale .zcompdump caches