diff --git a/users/modules/shell/starship.nix b/users/modules/shell/starship.nix index ba61e84..5df7248 100644 --- a/users/modules/shell/starship.nix +++ b/users/modules/shell/starship.nix @@ -19,30 +19,58 @@ in { inherit (cfg) enable; enableTransience = true; settings = mkIf cfg.jjIntegration { - custom.jj = { - description = "The current jj status"; - detect_folders = [".jj"]; - symbol = "πŸ₯‹ "; - command = '' - jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template ' - separate(" ", - change_id.shortest(4), - bookmarks, - "|", - concat( - if(conflict, "πŸ’₯"), - if(divergent, "🚧"), - if(hidden, "πŸ‘»"), - if(immutable, "πŸ”’"), - ), - raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"), - raw_escape_sequence("\x1b[1;32m") ++ coalesce( - truncate_end(29, description.first_line(), "…"), - "(no description set)", - ) ++ raw_escape_sequence("\x1b[0m"), - ) - ' - ''; + # Disabling these so they can be enabled conditionally + # See https://github.com/jj-vcs/jj/wiki/Starship + git_status.disabled = true; + git_commit.disabled = true; + git_metrics.disabled = true; + git_branch.disabled = true; + custom = let + when = "! jj --ignore-working-copy-root"; + description = "Only show if we’re not in a jj repository"; + style = ""; + in { + git_status = { + inherit when description style; + command = "starship module git_status"; + }; + git_commit = { + inherit when description style; + command = "starship module git_commit"; + }; + git_metrics = { + inherit when description style; + command = "starship module git_metrics"; + }; + git_branch = { + inherit when description style; + command = "starship module git_branch"; + }; + jj = { + description = "The current jj status"; + detect_folders = [".jj"]; + symbol = "πŸ₯‹ "; + command = '' + jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template ' + separate(" ", + change_id.shortest(4), + bookmarks, + "|", + concat( + if(conflict, "πŸ’₯"), + if(divergent, "🚧"), + if(hidden, "πŸ‘»"), + if(immutable, "πŸ”’"), + ), + raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"), + raw_escape_sequence("\x1b[1;32m") ++ coalesce( + truncate_end(29, description.first_line(), "…"), + "(no description set)", + ) ++ raw_escape_sequence("\x1b[0m"), + ) + ' + ''; + }; }; }; };