From 7e4d44f070bf5ea6f67ff839114403c9d969c6f8 Mon Sep 17 00:00:00 2001 From: Bryan Ramos Date: Tue, 1 Oct 2024 17:12:32 -0400 Subject: [PATCH] ps1 change --- src/user/modules/bash/config/prompt.nix | 65 +++++++++++++------------ 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/src/user/modules/bash/config/prompt.nix b/src/user/modules/bash/config/prompt.nix index b9f14cf..6396b0e 100644 --- a/src/user/modules/bash/config/prompt.nix +++ b/src/user/modules/bash/config/prompt.nix @@ -9,42 +9,42 @@ in '' check_ssh() { if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then - ssh_PS1="\n\[\033[01;37m\]\u@\h:\[\033[00m\]" + ssh_PS1="\n\[\033[01;37m\]\u@\h:\[\033[00m\]\n" return 0 fi } ${optionalString git.enable '' -add_icon() { - local icon=$1 - if [[ ! $venv_icons =~ $icon ]]; then - venv_icons+="$icon " - fi -} - -remove_icon() { - local icon=$1 - venv_icons=''${venv_icons//$icon/} -} - -py="py" -js="js" -nix="nix" - -${if gui.enable then '' -if [ -n "$DISPLAY" ]; then - py="" - js="󰌞" - nix="" -fi -'' else '' -''} - -python_icon="\[\033[01;33m\]$py\[\033[00m\]" -node_icon="\[\033[01;93m\]$js\[\033[00m\]" -nix_icon="\[\033[01;34m\]$nix\[\033[00m\]" - check_venv() { + add_icon() { + local icon=$1 + if [[ ! $venv_icons =~ $icon ]]; then + venv_icons+="$icon " + fi + } + + remove_icon() { + local icon=$1 + venv_icons=''${venv_icons//$icon/} + } + + py="py" + js="js" + nix="nix" + + ${if gui.enable then '' + if [ -n "$DISPLAY" ]; then + py="" + js="󰌞" + nix="" + fi + '' else '' + ''} + + python_icon="\[\033[01;33m\]$py\[\033[00m\]" + node_icon="\[\033[01;93m\]$js\[\033[00m\]" + nix_icon="\[\033[01;34m\]$nix\[\033[00m\]" + if [ -n "$IN_NIX_SHELL" ]; then add_icon "$nix_icon" else @@ -125,6 +125,7 @@ check_project() { fi } ''} + function set_prompt() { local green_arrow="\[\033[01;32m\]>> " local white_text="\[\033[00m\]" @@ -143,9 +144,9 @@ function set_prompt() { ${if git.enable then - ''PS1="$ssh_PS1\n$working_dir\n$venv_icons$green_arrow$git_branch_PS1$white_text"'' + ''PS1="$ssh_PS1$working_dir\n$venv_icons$green_arrow$git_branch_PS1$white_text"'' else - ''PS1="$ssh_PS1\n$working_dir\n$green_arrow$white_text"'' + ''PS1="$ssh_PS1$working_dir\n$green_arrow$white_text"'' } return 0 }