diff --git a/flake.lock b/flake.lock index c5719f5..be60bcb 100644 --- a/flake.lock +++ b/flake.lock @@ -636,11 +636,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1718978185, - "narHash": "sha256-J5DjUiFsl+3Yb3xKUZLx2uORMpYlcy87SElModRrz40=", + "lastModified": 1718990734, + "narHash": "sha256-sSW+JRtbKYCtu0ljj0UPXHSYEZdmfS9y22Zy+qprRm8=", "ref": "refs/heads/main", - "rev": "19081bb66637f3a6302a25a6a10cb86cc9bbb505", - "revCount": 4871, + "rev": "4a8b13ea4f8e5111390471c9212d10d4d032e837", + "revCount": 4872, "submodules": true, "type": "git", "url": "https://github.com/hyprwm/Hyprland" diff --git a/modules/home/apps/tools/starship/default.nix b/modules/home/apps/tools/starship/default.nix index ae29393..d8c861c 100644 --- a/modules/home/apps/tools/starship/default.nix +++ b/modules/home/apps/tools/starship/default.nix @@ -14,20 +14,68 @@ in { }; config = mkIf cfg.enable { + home.packages = [ + pkgs.custom.getgithost + ]; + programs.starship = { enable = true; enableZshIntegration = config.programs.zsh.enable; settings = { add_newline = false; command_timeout = 1000; - scan_timeout = 3; + scan_timeout = 10; + format = '' + $username$shlvl$kubernetes''${custom.dir}''${custom.home_dir}$directory''${custom.git_host}$git_branch$git_commit$git_state$git_status$hg_branch$docker_context$package$cmake$dart$dotnet$elixir$elm$erlang$golang$helm$java$julia$kotlin$nim$nodejs$ocaml$perl$php$purescript$python$ruby$rust$swift$terraform$vagrant$zig$nix_shell$conda$aws$gcloud$openstack$env_var$crystal$custom$cmd_duration$lua$line_break$jobs$status$character + ''; character = { - error_symbol = "[󰘧](bold red)"; - success_symbol = "[󰘧](bold green)"; - vicmd_symbol = "[󰘧](bold yellow)"; - format = "$symbol [|](bold bright-black) "; + success_symbol = "[>](#5BCEFA)[>](#FFFFFF)[>](#F5A9B8)"; + error_symbol = "[>>>](red)"; + }; + directory = { + truncation_length = 1; + format = "[ $path ]($style)[$read_only]($read_only_style) "; + style = "fg:white bg:black bold"; + read_only = "  "; + read_only_style = "fg:black bg:red"; }; git_commit = {commit_hash_length = 7;}; + git_branch = {format = ":[$symbol$branch]($style) ";}; + git_status = { + conflicted = "[<](white)=[$count](bright-white bold)[>](white)"; + ahead = "[<](white)⇡[$count](bright-white bold)[>](white)"; + behind = "[<](white)⇣[$count](bright-white bold)[>](white)"; + diverged = "[<](white)⇕⇡[$ahead_count](bright-white bold)⇣[$behind_count](bright-white)[>](white)"; + untracked = "[<](white)?[$count](bright-white bold)[>](white)"; + stashed = "[<](white)$[$count](bright-white bold)[>](white)"; + modified = "[<](white)![$count](bright-white bold)[>](white)"; + staged = "[<](white)+[$count](bright-white bold)[>](white)"; + renamed = "[<](white)»[$count](bright-white bold)[>](white)"; + deleted = "[<](white)✗[$count](bright-white bold)[>](white)"; + }; + custom = { + home_dir = { + command = "echo  "; + when = "[ \"$PWD\" == \"$HOME\" ]"; + shell = "[\"bash\",\"--norc\",\"--noprofile\"]"; + style = "fg:bright-white bg:bright-black"; + format = "[ $output ]($style)"; + }; + dir = { + command = "echo  "; + when = "[ \"$PWD\" != \"$HOME\" ]"; + shell = "[\"bash\",\"--norc\",\"--noprofile\"]"; + style = "fg:blue bg:bright-black"; + format = "[ $output ]($style)"; + }; + git_host = { + command = "getgithost"; + when = "git rev-parse --is-inside-work-tree 2> /dev/null"; + shell = "[\"bash\",\"--norc\",\"--noprofile\"]"; + style = "bright-yellow bold"; + format = "at [$output]($style)"; + }; + }; line_break.disabled = false; lua.symbol = "[](blue) "; python.symbol = "[](blue) "; diff --git a/packages/getgithost/default.nix b/packages/getgithost/default.nix new file mode 100644 index 0000000..8f932c5 --- /dev/null +++ b/packages/getgithost/default.nix @@ -0,0 +1,21 @@ +{writeShellScriptBin, ...}: +writeShellScriptBin "getgithost" '' + IFS="/" + GIT_REMOTE=$(command git ls-remote --get-url 2> /dev/null) + read -ra GIT_HOST <<< "$GIT_REMOTE" + + if [[ "$GIT_REMOTE" =~ "github" ]]; then + GIT_REMOTE_SYMBOL=" " + elif [[ "$GIT_REMOTE" =~ "gitlab" ]]; then + GIT_REMOTE_SYMBOL=" " + elif [[ "$GIT_REMOTE" =~ "bitbucket" ]]; then + GIT_REMOTE_SYMBOL=" " + elif [[ "$GIT_REMOTE" =~ "git" ]]; then + GIT_REMOTE_SYMBOL=" " + else + GIT_REMOTE_SYMBOL=" localhost" + fi + + echo "$GIT_REMOTE_SYMBOL''${GIT_HOST [2]}" + IFS=" " +''