From 66f31d957b9660f1ac26f5d215801cd0ae4ab8d9 Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Sun, 17 Feb 2019 16:41:02 +0530 Subject: [PATCH] Add python_venv plugin. Update path plugin. Add icon for non-writable directories. --- plugins/path.sh | 8 +++++++- plugins/python_venv.sh | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 plugins/python_venv.sh diff --git a/plugins/path.sh b/plugins/path.sh index 94f8cab..8e3329d 100644 --- a/plugins/path.sh +++ b/plugins/path.sh @@ -9,8 +9,14 @@ function wish_path_end() { function wish_path_set_colors() { WISH_PATH_FG=${WISH_PATH_FG:-$WISH_DEFAULT_FG} WISH_PATH_BG=${WISH_PATH_BG:-$WISH_DEFAULT_BG} + WISH_PATH_NO_WRITE_SUFFIX=${WISH_PATH_NO_WRITE_SUFFIX:- } } function wish_path_main() { - wish_append $WISH_PATH_BG $WISH_PATH_FG " \w " + if [[ -w $PWD ]]; then + local path=" \w " + else + local path=" \w$WISH_PATH_NO_WRITE_SUFFIX " + fi + wish_append $WISH_PATH_BG $WISH_PATH_FG "$path" } diff --git a/plugins/python_venv.sh b/plugins/python_venv.sh new file mode 100644 index 0000000..c57e9bc --- /dev/null +++ b/plugins/python_venv.sh @@ -0,0 +1,21 @@ +function wish_python_venv_start() { + return 0 +} + +function wish_python_venv_end() { + return 0 +} + +function wish_python_venv_set_colors() { + WISH_PYTHON_VENV_FG=${WISH_PYTHON_VENV_FG:-$WISH_DEFAULT_FG} + WISH_PYTHON_VENV_BG=${WISH_PYTHON_VENV_BG:-$WISH_DEFAULT_BG} +} + +function wish_python_venv_main() { + if [[ -v VIRTUAL_ENV ]]; then + local venv=$(echo $VIRTUAL_ENV | sed 's|.*/||') + wish_append $WISH_PYTHON_VENV_BG $WISH_PYTHON_VENV_FG " $venv " + else + wish_append $WISH_PYTHON_VENV_BG $WISH_PYTHON_VENV_FG "" + fi +}