feat(starship): tmux & shpool indicator

This commit is contained in:
2026-02-07 12:09:57 +08:00
parent 42fbf5cee6
commit 2d324de58a
3 changed files with 39 additions and 32 deletions

View File

@@ -11,17 +11,26 @@ in
};
config = lib.mkMerge [
{
my.cli.shell.starship.format = lib.mkOrder 0 [ "$all" ];
}
(lib.mkIf cfg.enable {
my.hm = {
programs.starship = {
enable = true;
settings = lib.recursiveUpdate (with builtins; fromTOML (readFile ./starship-preset.toml)) {
add_newline = false;
command_timeout = 2000;
nix_shell.disabled = true;
format = lib.concatStringsSep "" cfg.format;
format = let
dedupDollar = list: let
result = builtins.foldl' (acc: elem:
if lib.hasPrefix "$" elem then
if builtins.elem elem acc.seen
then acc
else acc // { result = acc.result ++ [elem]; seen = acc.seen ++ [elem]; }
else
acc // { result = acc.result ++ [elem]; }
) { result = []; seen = []; } (lib.reverseList list);
in lib.reverseList result.result;
in "$all" + lib.concatStrings (dedupDollar cfg.format);
};
};
};