Skip to content

Commit

Permalink
Add nix-shell segment (#103)
Browse files Browse the repository at this point in the history
* Sort conf alphabetically

* Add nix-shell segment
  • Loading branch information
SuperSandro2000 authored Oct 9, 2020
1 parent e831479 commit e3195f6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
39 changes: 21 additions & 18 deletions config/colors.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
# Color configuration for the segments.
# See src/colors/*.bash for the color values

SEGMENTS_AWS_COLOR_PRIMARY=${SEGMENTS_AWS_COLOR_PRIMARY:-$color8}
SEGMENTS_AWS_COLOR_SECONDARY=${SEGMENTS_AWS_COLOR_SECONDARY:-$color9}

SEGMENTS_COMMAND_COLOR_PRIMARY=${SEGMENTS_COMMAND_COLOR_PRIMARY:-$color4}
SEGMENTS_COMMAND_COLOR_SECONDARY=${SEGMENTS_COMMAND_COLOR_SECONDARY:-$color1}
SEGMENTS_COMMAND_COLOR_PRIMARY_HIGHLIGHT=${SEGMENTS_COMMAND_COLOR_PRIMARY_HIGHLIGHT:-$color8}
SEGMENTS_COMMAND_COLOR_SECONDARY_HIGHLIGHT=${SEGMENTS_COMMAND_COLOR_SECONDARY_HIGHLIGHT:-$color4}

SEGMENTS_CONDA_COLOR_PRIMARY=${SEGMENTS_CONDA_COLOR_PRIMARY:-$color8}
SEGMENTS_CONDA_COLOR_SECONDARY=${SEGMENTS_CONDA_COLOR_SECONDARY:-$color9}

SEGMENTS_GIT_COLOR_PRIMARY=${SEGMENTS_GIT_COLOR_PRIMARY:-$color10}
SEGMENTS_GIT_COLOR_SECONDARY=${SEGMENTS_GIT_COLOR_SECONDARY:-$color1}

Expand All @@ -16,6 +22,17 @@ SEGMENTS_HOST_COLOR_SECONDARY=${SEGMENTS_HOST_COLOR_SECONDARY:-$color5}
SEGMENTS_HOST_COLOR_PRIMARY_HIGHLIGHT=${SEGMENTS_HOST_COLOR_PRIMARY_HIGHLIGHT:-$color9}
SEGMENTS_HOST_COLOR_SECONDARY_HIGHLIGHT=${SEGMENTS_HOST_COLOR_SECONDARY_HIGHLIGHT:-$color0}

SEGMENTS_K8S_COLOR_PRIMARY=${SEGMENTS_K8S_COLOR_PRIMARY:-$color3}
SEGMENTS_K8S_COLOR_SECONDARY=${SEGMENTS_K8S_COLOR_SECONDARY:-$color7}

SEGMENTS_LOAD_COLOR_PRIMARY=${SEGMENTS_LOAD_COLOR_PRIMARY:-$color9}
SEGMENTS_LOAD_COLOR_SECONDARY=${SEGMENTS_LOAD_COLOR_SECONDARY:-$color1}
SEGMENTS_LOAD_COLOR_PRIMARY_HIGHLIGHT=${SEGMENTS_LOAD_COLOR_PRIMARY_HIGHLIGHT:-$color8}
SEGMENTS_LOAD_COLOR_SECONDARY_HIGHLIGHT=${SEGMENTS_LOAD_COLOR_SECONDARY_HIGHLIGHT:-$color7}

SEGMENTS_NIX_COLOR_PRIMARY=${SEGMENTS_NIX_COLOR_PRIMARY:-$color13}
SEGMENTS_NIX_COLOR_SECONDARY=${SEGMENTS_NIX_COLOR_SECONDARY:-$color7}

SEGMENTS_PATH_COLOR_PRIMARY=${SEGMENTS_PATH_COLOR_PRIMARY:-$color14}
SEGMENTS_PATH_COLOR_SECONDARY=${SEGMENTS_PATH_COLOR_SECONDARY:-$color7}
SEGMENTS_PATH_COLOR_SPLITTER=${SEGMENTS_PATH_COLOR_SPLITTER:-$color4}
Expand All @@ -29,30 +46,16 @@ SEGMENTS_PROMPT_READY_COLOR_SECONDARY=${SEGMENTS_PROMPT_READY_COLOR_SECONDARY:-$
SEGMENTS_PYTHON_ENV_COLOR_PRIMARY=${SEGMENTS_PYTHON_ENV_COLOR_PRIMARY:-$color9}
SEGMENTS_PYTHON_ENV_COLOR_SECONDARY=${SEGMENTS_PYTHON_ENV_COLOR_SECONDARY:-$color15}

SEGMENTS_RESCUETIME_COLOR_PRIMARY=${SEGMENTS_RESCUETIME_COLOR_PRIMARY:-$color11}
SEGMENTS_RESCUETIME_COLOR_SECONDARY=${SEGMENTS_RESCUETIME_COLOR_SECONDARY:-$color4}
SEGMENTS_RESCUETIME_COLOR_SPLITTER=${SEGMENTS_RESCUETIME_COLOR_SPLITTER:-$color7}

SEGMENTS_RETURN_CODE_COLOR_PRIMARY=${SEGMENTS_RETURN_CODE_COLOR_PRIMARY:-$color1}
SEGMENTS_RETURN_CODE_COLOR_SECONDARY=${SEGMENTS_RETURN_CODE_COLOR_SECONDARY:-$color15}

SEGMENTS_TIMESTAMP_COLOR_PRIMARY=${SEGMENTS_TIMESTAMP_COLOR_PRIMARY:-$color2}
SEGMENTS_TIMESTAMP_COLOR_SECONDARY=${SEGMENTS_TIMESTAMP_COLOR_SECONDARY:-$color5}

SEGMENTS_CONDA_COLOR_PRIMARY=${SEGMENTS_CONDA_COLOR_PRIMARY:-$color8}
SEGMENTS_CONDA_COLOR_SECONDARY=${SEGMENTS_CONDA_COLOR_SECONDARY:-$color9}

SEGMENTS_AWS_COLOR_PRIMARY=${SEGMENTS_AWS_COLOR_PRIMARY:-$color8}
SEGMENTS_AWS_COLOR_SECONDARY=${SEGMENTS_AWS_COLOR_SECONDARY:-$color9}

SEGMENTS_K8S_COLOR_PRIMARY=${SEGMENTS_K8S_COLOR_PRIMARY:-$color3}
SEGMENTS_K8S_COLOR_SECONDARY=${SEGMENTS_K8S_COLOR_SECONDARY:-$color7}

SEGMENTS_LOAD_COLOR_PRIMARY=${SEGMENTS_LOAD_COLOR_PRIMARY:-$color9}
SEGMENTS_LOAD_COLOR_SECONDARY=${SEGMENTS_LOAD_COLOR_SECONDARY:-$color1}
SEGMENTS_LOAD_COLOR_PRIMARY_HIGHLIGHT=${SEGMENTS_LOAD_COLOR_PRIMARY_HIGHLIGHT:-$color8}
SEGMENTS_LOAD_COLOR_SECONDARY_HIGHLIGHT=${SEGMENTS_LOAD_COLOR_SECONDARY_HIGHLIGHT:-$color7}

SEGMENTS_RESCUETIME_COLOR_PRIMARY=${SEGMENTS_RESCUETIME_COLOR_PRIMARY:-$color11}
SEGMENTS_RESCUETIME_COLOR_SECONDARY=${SEGMENTS_RESCUETIME_COLOR_SECONDARY:-$color4}
SEGMENTS_RESCUETIME_COLOR_SPLITTER=${SEGMENTS_RESCUETIME_COLOR_SPLITTER:-$color7}

SEGMENTS_WTTR_COLOR_PRIMARY=${SEGMENTS_WTTR_COLOR_PRIMARY:-$color11}
SEGMENTS_WTTR_COLOR_SECONDARY=${SEGMENTS_WTTR_COLOR_SECONDARY:-$color4}
SEGMENTS_WTTR_COLOR_SPLITTER=${SEGMENTS_WTTR_COLOR_SPLITTER:-$color7}
2 changes: 1 addition & 1 deletion config/settings.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [[ "$COLUMNS" -le 120 ]]; then
SBP_THEME_LAYOUT='lines'
SBP_SEGMENTS_LEFT=('path' 'python_env' 'git' 'command')
else
SBP_SEGMENTS_LEFT=('host' 'path' 'python_env' 'k8s' 'git')
SBP_SEGMENTS_LEFT=('host' 'path' 'python_env' 'k8s' 'git' 'nix')
SBP_SEGMENTS_RIGHT=('command' 'timestamp')
SBP_SEGMENTS_LINE_TWO=('prompt_ready')
fi
Expand Down
4 changes: 3 additions & 1 deletion src/segments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ truncation/compacting for that specific segment.
## load
shows the average load of the machine

## nix
shows wether you are in a nix-shell or not

## path
shows the current path

Expand All @@ -85,4 +88,3 @@ truncation/compacting for that specific segment.
Shows the weather based on ´SEGMENTS_WTTR_LOCATION´ and
´SEGMENTS_WTTR_FORMAT´, the default values are ´Oslo´ and ´%p;%t;%w´
respectively.

7 changes: 7 additions & 0 deletions src/segments/nix.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /usr/bin/env bash

segments::nix() {
if [[ -n "$IN_NIX_SHELL" ]]; then
print_themed_segment 'normal' "nix-shell"
fi
}

0 comments on commit e3195f6

Please sign in to comment.