From cde6108d7bf4ad96347660d27cab673597f2aea8 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Sun, 30 Aug 2020 08:43:38 -0300 Subject: [PATCH 1/2] Display screen session if you set theme_display_screen to yes Signed-off-by: Paulo Flabiano Smorigo --- fish_prompt.fish | 14 ++++++++++++++ functions/__bobthefish_colors.fish | 15 +++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/fish_prompt.fish b/fish_prompt.fish index 4c47f7f..bde6c49 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -35,6 +35,7 @@ # set -g theme_display_ruby no # set -g theme_display_user ssh # set -g theme_display_hostname ssh +# set -g theme_display_screen no # set -g theme_display_sudo_user yes # set -g theme_display_vi no # set -g theme_display_nvm yes @@ -911,6 +912,18 @@ function __bobthefish_prompt_hg -S -a hg_root_dir -a real_pwd -d 'Display the ac end end +function __bobthefish_prompt_screen -S -d 'Display the screen name' + [ "$theme_display_screen" != 'yes' ] + and return + + [ -z "$STY" ] + and return + + __bobthefish_start_segment $color_screen + echo -ns (command echo $STY | cut -d. -f2) ' ' + set_color normal +end + function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the actual git state' set -l dirty '' if [ "$theme_display_git_dirty" != 'no' ] @@ -1064,6 +1077,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome' # User / hostname info __bobthefish_prompt_user + __bobthefish_prompt_screen # Containers and VMs __bobthefish_prompt_vagrant diff --git a/functions/__bobthefish_colors.fish b/functions/__bobthefish_colors.fish index 93be762..e87eeca 100644 --- a/functions/__bobthefish_colors.fish +++ b/functions/__bobthefish_colors.fish @@ -29,6 +29,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s magenta white --bold set -x color_username white black --bold set -x color_hostname white black + set -x color_screen brgreen $colorfg set -x color_rvm brmagenta $colorfg --bold set -x color_nvm brgreen $colorfg --bold set -x color_virtualfish brblue $colorfg --bold @@ -61,6 +62,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s magenta white --bold set -x color_username black white --bold set -x color_hostname black white + set -x color_screen brgreen $colorfg set -x color_rvm brmagenta $colorfg --bold set -x color_nvm brgreen $colorfg --bold set -x color_virtualfish brblue $colorfg --bold @@ -93,6 +95,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s magenta white --bold set -x color_username brgrey white --bold set -x color_hostname brgrey white + set -x color_screen brgreen $colorfg set -x color_rvm brmagenta $colorfg --bold set -x color_nvm brgreen $colorfg --bold set -x color_virtualfish brblue $colorfg --bold @@ -125,6 +128,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s magenta white --bold set -x color_username grey black --bold set -x color_hostname grey black + set -x color_screen brgreen $colorfg set -x color_rvm brmagenta $colorfg --bold set -x color_nvm brgreen $colorfg --bold set -x color_virtualfish brblue $colorfg --bold @@ -163,6 +167,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green $white --bold set -x color_username $grey $blue --bold set -x color_hostname $grey $blue + set -x color_screen $green $grey set -x color_rvm $red $grey --bold set -x color_nvm $green $white --bold set -x color_virtualfish $blue $grey --bold @@ -212,6 +217,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $base06 $colorfg --bold set -x color_username $base02 $base0D --bold set -x color_hostname $base02 $base0D + set -x color_screen $base06 $colorfg set -x color_rvm $base08 $colorfg --bold set -x color_nvm $base0B $colorfg --bold set -x color_virtualfish $base0D $colorfg --bold @@ -261,6 +267,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $base0B $colorfg --bold set -x color_username $base02 $base0D --bold set -x color_hostname $base02 $base0D + set -x color_screen $base0B $colorfg set -x color_rvm $base08 $colorfg --bold set -x color_nvm $base0B $colorfg --bold set -x color_virtualfish $base0D $colorfg --bold @@ -310,6 +317,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green $colorfg --bold set -x color_username $base2 $blue --bold set -x color_hostname $base2 $blue + set -x color_screen $green $colorfg set -x color_rvm $red $colorfg --bold set -x color_nvm $green $colorfg --bold set -x color_virtualfish $cyan $colorfg --bold @@ -359,6 +367,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green $colorfg --bold set -x color_username $base02 $blue --bold set -x color_hostname $base02 $blue + set -x color_screen $green $colorfg set -x color_rvm $red $colorfg --bold set -x color_nvm $green $colorfg --bold set -x color_virtualfish $cyan $colorfg --bold @@ -401,6 +410,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green[1] $colorfg --bold set -x color_username $grey[1] $blue[3] --bold set -x color_hostname $grey[1] $blue[3] + set -x color_screen $green[1] $colorfg set -x color_rvm $ruby_red $grey[1] --bold set -x color_nvm $green $grey[1] --bold set -x color_virtualfish $blue[2] $grey[1] --bold @@ -442,6 +452,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green[2] $fg[2] --bold set -x color_username $fg[3] $blue[2] --bold set -x color_hostname $fg[3] $blue[2] + set -x color_screen $green[1] $fg[2] set -x color_rvm $red[2] $fg[2] --bold set -x color_nvm $green[1] $fg[2] --bold set -x color_virtualfish $blue[2] $fg[2] --bold @@ -485,6 +496,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green $fg --bold set -x color_username $selection $cyan --bold set -x color_hostname $selection $cyan + set -x color_screen $green $fg set -x color_rvm $red $bg --bold set -x color_nvm $green $bg --bold set -x color_virtualfish $comment $bg --bold @@ -534,6 +546,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $base02 $colorfg --bold set -x color_username $base02 $base0D --bold set -x color_hostname $base02 $base0D + set -x color_screen $base02 $colorfg set -x color_rvm $base09 $colorfg --bold set -x color_nvm $base09 $colorfg --bold set -x color_virtualfish $base09 $colorfg --bold @@ -576,6 +589,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green[2] $white --bold set -x color_username $grey[1] $blue[3] --bold set -x color_hostname $grey[1] $blue[3] + set -x color_screen $green[1] $white set -x color_rvm $ruby_red $grey[1] --bold set -x color_nvm $green[1] $white --bold set -x color_virtualfish $blue[2] $grey[1] --bold @@ -640,6 +654,7 @@ function __bobthefish_user_color_scheme_deprecated set -x color_vagrant $__color_vagrant set -x color_username $__color_username set -x color_hostname $__color_hostname + set -x color_screen $__color_screen set -x color_rvm $__color_rvm set -x color_virtualfish $__color_virtualfish set -x color_virtualgo $__color_virtualgo From 30b289cd5aea9f435d1fd043143bb56c9646f0a0 Mon Sep 17 00:00:00 2001 From: Paulo Flabiano Smorigo Date: Thu, 3 Sep 2020 06:27:41 -0300 Subject: [PATCH 2/2] screen: making it opt-in (verbose off), example and using string command Signed-off-by: Paulo Flabiano Smorigo --- fish_prompt.fish | 11 +++++++--- functions/__bobthefish_colors.fish | 28 ++++++++++++------------ functions/bobthefish_display_colors.fish | 4 ++++ 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/fish_prompt.fish b/fish_prompt.fish index bde6c49..2fbc6bd 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -35,7 +35,8 @@ # set -g theme_display_ruby no # set -g theme_display_user ssh # set -g theme_display_hostname ssh -# set -g theme_display_screen no +# set -g theme_display_screen yes +# set -g theme_display_screen_verbose no # set -g theme_display_sudo_user yes # set -g theme_display_vi no # set -g theme_display_nvm yes @@ -913,14 +914,16 @@ function __bobthefish_prompt_hg -S -a hg_root_dir -a real_pwd -d 'Display the ac end function __bobthefish_prompt_screen -S -d 'Display the screen name' - [ "$theme_display_screen" != 'yes' ] + [ "$theme_display_screen" = 'no' ] and return [ -z "$STY" ] and return __bobthefish_start_segment $color_screen - echo -ns (command echo $STY | cut -d. -f2) ' ' + [ "$theme_display_screen_verbose" = "yes" ] + and echo -ns (string split "." -- $STY)[2] + echo -ns ' ' set_color normal end @@ -1077,6 +1080,8 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome' # User / hostname info __bobthefish_prompt_user + + # Screen __bobthefish_prompt_screen # Containers and VMs diff --git a/functions/__bobthefish_colors.fish b/functions/__bobthefish_colors.fish index e87eeca..a2a2b55 100644 --- a/functions/__bobthefish_colors.fish +++ b/functions/__bobthefish_colors.fish @@ -29,7 +29,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s magenta white --bold set -x color_username white black --bold set -x color_hostname white black - set -x color_screen brgreen $colorfg + set -x color_screen brgreen $colorfg --bold set -x color_rvm brmagenta $colorfg --bold set -x color_nvm brgreen $colorfg --bold set -x color_virtualfish brblue $colorfg --bold @@ -62,7 +62,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s magenta white --bold set -x color_username black white --bold set -x color_hostname black white - set -x color_screen brgreen $colorfg + set -x color_screen brgreen $colorfg --bold set -x color_rvm brmagenta $colorfg --bold set -x color_nvm brgreen $colorfg --bold set -x color_virtualfish brblue $colorfg --bold @@ -95,7 +95,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s magenta white --bold set -x color_username brgrey white --bold set -x color_hostname brgrey white - set -x color_screen brgreen $colorfg + set -x color_screen brgreen $colorfg --bold set -x color_rvm brmagenta $colorfg --bold set -x color_nvm brgreen $colorfg --bold set -x color_virtualfish brblue $colorfg --bold @@ -128,7 +128,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s magenta white --bold set -x color_username grey black --bold set -x color_hostname grey black - set -x color_screen brgreen $colorfg + set -x color_screen brgreen $colorfg --bold set -x color_rvm brmagenta $colorfg --bold set -x color_nvm brgreen $colorfg --bold set -x color_virtualfish brblue $colorfg --bold @@ -167,7 +167,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green $white --bold set -x color_username $grey $blue --bold set -x color_hostname $grey $blue - set -x color_screen $green $grey + set -x color_screen $green $grey --bold set -x color_rvm $red $grey --bold set -x color_nvm $green $white --bold set -x color_virtualfish $blue $grey --bold @@ -217,7 +217,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $base06 $colorfg --bold set -x color_username $base02 $base0D --bold set -x color_hostname $base02 $base0D - set -x color_screen $base06 $colorfg + set -x color_screen $base06 $colorfg --bold set -x color_rvm $base08 $colorfg --bold set -x color_nvm $base0B $colorfg --bold set -x color_virtualfish $base0D $colorfg --bold @@ -267,7 +267,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $base0B $colorfg --bold set -x color_username $base02 $base0D --bold set -x color_hostname $base02 $base0D - set -x color_screen $base0B $colorfg + set -x color_screen $base0B $colorfg --bold set -x color_rvm $base08 $colorfg --bold set -x color_nvm $base0B $colorfg --bold set -x color_virtualfish $base0D $colorfg --bold @@ -317,7 +317,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green $colorfg --bold set -x color_username $base2 $blue --bold set -x color_hostname $base2 $blue - set -x color_screen $green $colorfg + set -x color_screen $green $colorfg --bold set -x color_rvm $red $colorfg --bold set -x color_nvm $green $colorfg --bold set -x color_virtualfish $cyan $colorfg --bold @@ -367,7 +367,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green $colorfg --bold set -x color_username $base02 $blue --bold set -x color_hostname $base02 $blue - set -x color_screen $green $colorfg + set -x color_screen $green $colorfg --bold set -x color_rvm $red $colorfg --bold set -x color_nvm $green $colorfg --bold set -x color_virtualfish $cyan $colorfg --bold @@ -410,7 +410,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green[1] $colorfg --bold set -x color_username $grey[1] $blue[3] --bold set -x color_hostname $grey[1] $blue[3] - set -x color_screen $green[1] $colorfg + set -x color_screen $green[1] $colorfg --bold set -x color_rvm $ruby_red $grey[1] --bold set -x color_nvm $green $grey[1] --bold set -x color_virtualfish $blue[2] $grey[1] --bold @@ -452,7 +452,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green[2] $fg[2] --bold set -x color_username $fg[3] $blue[2] --bold set -x color_hostname $fg[3] $blue[2] - set -x color_screen $green[1] $fg[2] + set -x color_screen $green[1] $fg[2] --bold set -x color_rvm $red[2] $fg[2] --bold set -x color_nvm $green[1] $fg[2] --bold set -x color_virtualfish $blue[2] $fg[2] --bold @@ -496,7 +496,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green $fg --bold set -x color_username $selection $cyan --bold set -x color_hostname $selection $cyan - set -x color_screen $green $fg + set -x color_screen $green $bg --bold set -x color_rvm $red $bg --bold set -x color_nvm $green $bg --bold set -x color_virtualfish $comment $bg --bold @@ -546,7 +546,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $base02 $colorfg --bold set -x color_username $base02 $base0D --bold set -x color_hostname $base02 $base0D - set -x color_screen $base02 $colorfg + set -x color_screen $base02 $colorfg --bold set -x color_rvm $base09 $colorfg --bold set -x color_nvm $base09 $colorfg --bold set -x color_virtualfish $base09 $colorfg --bold @@ -589,7 +589,7 @@ function __bobthefish_colors -S -a color_scheme -d 'Define colors used by bobthe set -x color_k8s $green[2] $white --bold set -x color_username $grey[1] $blue[3] --bold set -x color_hostname $grey[1] $blue[3] - set -x color_screen $green[1] $white + set -x color_screen $green[1] $white --bold set -x color_rvm $ruby_red $grey[1] --bold set -x color_nvm $green[1] $white --bold set -x color_virtualfish $blue[2] $grey[1] --bold diff --git a/functions/bobthefish_display_colors.fish b/functions/bobthefish_display_colors.fish index b889449..4904fe4 100644 --- a/functions/bobthefish_display_colors.fish +++ b/functions/bobthefish_display_colors.fish @@ -123,6 +123,10 @@ function bobthefish_display_colors -a color_scheme -d 'Print example prompt colo __bobthefish_finish_segments echo + __bobthefish_start_segment $color_screen + echo -ns 'screen ' + __bobthefish_finish_segments + __bobthefish_start_segment $color_rvm echo -ns $ruby_glyph rvm ' ' __bobthefish_finish_segments