From 595fbd07a28306268602af2ffdf9e4dac800dacd Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Thu, 11 Nov 2021 23:43:21 -0700 Subject: Make changes to make this work with Photon. --- 00-prompt.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to '00-prompt.zsh') diff --git a/00-prompt.zsh b/00-prompt.zsh index 439a25d..d32b576 100644 --- a/00-prompt.zsh +++ b/00-prompt.zsh @@ -1,2 +1,4 @@ -source "$HOME/.zshrc.d/prompts/$(hostname).zsh" 2>/dev/null || \ - source "$HOME/.zshrc.d/local/prompts/$(hostname).zsh" 2>/dev/null +hostname=$( which hostname &>/dev/null && hostname || cat /etc/hostname ) + +source "$HOME/.zshrc.d/prompts/${hostname}.zsh" 2>/dev/null || \ + source "$HOME/.zshrc.d/local/prompts/${hostname}.zsh" 2>/dev/null -- cgit From adfea9ea025d481fab4743d9bd2a60c956833ae3 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Thu, 11 Nov 2021 23:46:25 -0700 Subject: Change the cursor to always be a vertical bar. --- 00-prompt.zsh | 2 ++ 1 file changed, 2 insertions(+) (limited to '00-prompt.zsh') diff --git a/00-prompt.zsh b/00-prompt.zsh index d32b576..21f6c95 100644 --- a/00-prompt.zsh +++ b/00-prompt.zsh @@ -2,3 +2,5 @@ hostname=$( which hostname &>/dev/null && hostname || cat /etc/hostname ) source "$HOME/.zshrc.d/prompts/${hostname}.zsh" 2>/dev/null || \ source "$HOME/.zshrc.d/local/prompts/${hostname}.zsh" 2>/dev/null + +PROMPT='[5 q'"$PROMPT" -- cgit From 8492e58a8886c848b9dd6310dc6d2f4345a4a0c5 Mon Sep 17 00:00:00 2001 From: Joshua Rahm Date: Sun, 14 Nov 2021 22:36:46 -0700 Subject: Add some more changes to the prompt. Now displays a logo for various Linux's. Adds lepton prompt. Created a "simple prompt which is a qucik way to create a nice generic prompt. --- 00-prompt.zsh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to '00-prompt.zsh') diff --git a/00-prompt.zsh b/00-prompt.zsh index 21f6c95..b27691f 100644 --- a/00-prompt.zsh +++ b/00-prompt.zsh @@ -1,5 +1,53 @@ hostname=$( which hostname &>/dev/null && hostname || cat /etc/hostname ) +# Creates simple prompts for my many machines. # +# The first argument to the prompts is the primary color +# second argument is secondary color. + +GREEN="%{\x1b[01;32m%}" +RED="%{\x1b[01;31m%}" +RESET="%{\x1b[00m%}" + +function distro_logo { + case "$(uname -a)" in + *-arch*) echo "%{\033[01;38;2;21;118;167m%}$RESET" ;; + *Debian*) echo "%{\033[01;38;2;170;6;64m%}$RESET" ;; + *Ubuntu*) echo "%{\033[01;38;2;172;61;24m%}$RESET" ;; + *fc*) echo "%{\033[01;38;2;21;118;167m%}$RESET" ;; + *gentoo*) echo "%{\033[01;38;2;126;126;183m%}$RESET" ;; + *Linux*) echo "%{\033[01;37m%}$RESET" ;; + *BSD*) echo "%{\033[01;31m%}$RESET" ;; + esac +} + +function simple_prompt { + ec=$? + preamble="" + + default="${2}" + if [ "$ec" -eq "0" ] ; then + code="${GREEN}--${default}" + else + code="${RED}$(printf '%02x' $ec)${default}" + fi + + name="${1}%n@${default}" + host="${1}%m${default}" + directory="${2}%2~${default}" + + echo " ${default}$(distro_logo) ${code} ${name}${host} ${directory} · %{\x1b[00m%}" +} + +function simple_rprompt { + default="${2}" + time="${1}%*${default}" + echo "${default}← ${time} ${RESET}" +} + +setopt prompt_subst + +# Source the actual prompt file corresponding to this host. + source "$HOME/.zshrc.d/prompts/${hostname}.zsh" 2>/dev/null || \ source "$HOME/.zshrc.d/local/prompts/${hostname}.zsh" 2>/dev/null -- cgit