From 0ca609e0cff3b9bbceccd77afda336088c37b019 Mon Sep 17 00:00:00 2001 From: Suraj Sharma <81553118+sudosuraj@users.noreply.github.com> Date: Fri, 11 Jul 2025 16:30:20 +0530 Subject: [PATCH] Add new theme: axira MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add initial version of the Axira Zsh theme. Features: - VPN IP detection with fallback to eth0 - Smart icon: 🔒 for VPN, 🌐 when not connected - Python venv and Git branch shown - Clean multi-line style with Nerd Font symbols --- themes/axira.zsh-theme | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 themes/axira.zsh-theme diff --git a/themes/axira.zsh-theme b/themes/axira.zsh-theme new file mode 100644 index 000000000..2026a68f9 --- /dev/null +++ b/themes/axira.zsh-theme @@ -0,0 +1,47 @@ +# ~/.oh-my-zsh/custom/themes/axira.zsh-theme + +autoload -U colors && colors + +local BLUE="%F{33}" +local GREEN="%F{76}" +local RED="%F{196}" +local YELLOW="%F{226}" +local MAGENTA="%F{201}" +local CYAN="%F{51}" +local RESET="%f%k" + +local PROMPT_CORNER="┌─" +local PROMPT_BOTTOM="└─" +local PROMPT_ARROW="➜" + +get_ip() { + local ip=$(ip -4 addr show tun0 2>/dev/null | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -1) + if [[ -z "$ip" ]]; then + ip=$(ip -4 addr show eth0 2>/dev/null | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -1) + fi + [[ -z "$ip" ]] && ip="NoNet" + echo "$ip" +} + +get_ip_icon() { + ip link show tun0 2>/dev/null | grep -q "state UP" && echo "🔒" || echo "🌐" +} + +git_branch() { + local branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) + [[ -n "$branch" ]] && echo "%{$YELLOW%} $branch%{$RESET%}" +} + +python_venv() { + [[ -n "$VIRTUAL_ENV" ]] && echo "%{$MAGENTA%}[🐍 $(basename $VIRTUAL_ENV)]%{$RESET%}" +} + +exit_status() { + [[ $? -eq 0 ]] && echo "%{$GREEN%}✔%{$RESET%}" || echo "%{$RED%}✗%{$RESET%}" +} + +PROMPT=' +%{$CYAN%}${PROMPT_CORNER}[%{$BLUE%}%~%{$CYAN%}] [%{$CYAN%}$(get_ip_icon) %{$GREEN%}$(get_ip)%{$CYAN%}] $(python_venv) $(git_branch) +%{$CYAN%}${PROMPT_BOTTOM}${PROMPT_ARROW} %{$RESET%}' + +RPROMPT='$(exit_status)'