mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
Add new theme: axira
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
This commit is contained in:
parent
7dcabbe682
commit
0ca609e0cf
1 changed files with 47 additions and 0 deletions
47
themes/axira.zsh-theme
Normal file
47
themes/axira.zsh-theme
Normal file
|
|
@ -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)'
|
||||
Loading…
Add table
Add a link
Reference in a new issue