Last active
January 31, 2020 06:19
-
-
Save AmreeshTyagi/0cd0836946e8aa9a743289a05211ac8c to your computer and use it in GitHub Desktop.
Geek like mac & linux terminal using zsh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Output of following zsh configuration https://ibb.co/Yb2YM4C | |
# Step1: Install zsh using | |
# brew install zsh | |
# Step2: nano ~/.zshrc | |
# Step3: Paste following configuration | |
# For further steps to install fonts & color scheme click on following | |
# https://www.freecodecamp.org/news/how-to-configure-your-macos-terminal-with-zsh-like-a-pro-c0ab3f3c1156/ | |
# Enjoy new terminal theme like a pro... :) | |
#export LSCOLORS=ExGxBxDxCxEgEdxbxgxcxd | |
unset LSCOLORS | |
export TERM="xterm-256color" | |
export CLICOLOR=1 | |
export CLICOLOR_FORCE=1 | |
export LSCOLORS=ExGxabDxCxEgEdxbxgFaBa | |
#zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} | |
source ~/system/powerlevel9k/powerlevel9k.zsh-theme | |
POWERLEVEL9K_MODE='nerdfont-complete' | |
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL="zsh_wifi_signal" | |
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_BACKGROUND="white" | |
POWERLEVEL9K_CUSTOM_WIFI_SIGNAL_FOREGROUND="black" | |
# zsh wifi signal Linux | |
zsh_wifi_signal(){ | |
local speed=$(nmcli device wifi | grep "*" | awk '{print $5}') | |
local strength=$(nmcli device wifi | grep "*" | awk '{print $7}') | |
local strength_bar=$(nmcli device wifi | grep "*" | awk '{print $8}') | |
local color='%F{white}' | |
local strength_color='%F{white}' | |
[[ $speed -gt 100 ]] && color='%F{green}' | |
[[ $speed -lt 50 ]] && color='%F{red}' | |
[[ $strength -gt 59 ]] && strength_color='%F{green}' | |
[[ $strength -gt 49 && $strength -lt 60 ]] && strength_color='%F{yellow}' | |
[[ $strength -lt 50 ]] && strength_color='%F{red}' | |
# echo -n "%{$color%}\uf1eb $speed Mbps%{%f%}" # \uf230 is | |
echo -n "%{$strength_color%} $strength_bar $strength %{$color%} $speed Mbps%{%f%}" # \uf230 is | |
} | |
# zsh wifi singal Mac | |
zsh_wifi_signal_mac(){ | |
local output=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I) | |
local airport=$(echo $output | grep 'AirPort' | awk -F': ' '{print $2}') | |
if [ "$airport" = "Off" ]; then | |
local color='%F{black}' | |
echo -n "%{$color%}Wifi Off" | |
else | |
local ssid=$(echo $output | grep ' SSID' | awk -F': ' '{print $2}') | |
local speed=$(echo $output | grep 'lastTxRate' | awk -F': ' '{print $2}') | |
local color='%F{black}' | |
[[ $speed -gt 100 ]] && color='%F{black}' | |
[[ $speed -lt 50 ]] && color='%F{red}' | |
echo -n "%{$color%}$speed Mbps \uf1eb%{%f%}" # removed char not in my PowerLine font | |
fi | |
} | |
POWERLEVEL9K_CONTEXT_TEMPLATE='%n' | |
POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND='yellow' | |
POWERLEVEL9K_BATTERY_CHARGING='yellow' | |
POWERLEVEL9K_BATTERY_CHARGED='green' | |
POWERLEVEL9K_BATTERY_DISCONNECTED='$DEFAULT_COLOR' | |
POWERLEVEL9K_BATTERY_LOW_THRESHOLD='10' | |
POWERLEVEL9K_BATTERY_LOW_COLOR='red' | |
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='' | |
POWERLEVEL9K_BATTERY_ICON='\uf1e6 ' | |
POWERLEVEL9K_PROMPT_ON_NEWLINE=true | |
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{014}\u2570%F{cyan}\uF460%F{073}\uF460%F{109}\uF460%f " | |
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow' | |
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow' | |
POWERLEVEL9K_VCS_UNTRACKED_ICON='?' | |
POWERLEVEL9K_VCS_UNTRACKED_ICON='\u25CF' | |
POWERLEVEL9K_VCS_UNSTAGED_ICON='\u00b1' | |
POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='\u2193' | |
POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='\u2191' | |
POWERLEVEL9K_VCS_COMMIT_ICON="\uf417" | |
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0 | |
POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND='245' | |
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND='black' | |
#POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND='clear' | |
#POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND='magenta' | |
#POWERLEVEL_OS_ICON="\ue712" | |
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon user battery dir vcs) | |
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time dir_writable ip custom_wifi_signal ram load background_jobs) | |
#POWERLEVEL9K_SHORTEN_DIR_LENGTH=0 | |
POWERLEVEL9K_TIME_FORMAT="%D{\uf017 %H:%M \uf073 %d/%m/%y}" | |
POWERLEVEL9K_TIME_BACKGROUND='white' | |
#POWERLEVEL9K_TIME_FOREGROUND="white" | |
POWERLEVEL9K_RAM_BACKGROUND='magenta' | |
POWERLEVEL9K_LOAD_CRITICAL_BACKGROUND="white" | |
POWERLEVEL9K_LOAD_WARNING_BACKGROUND="white" | |
POWERLEVEL9K_LOAD_NORMAL_BACKGROUND="white" | |
POWERLEVEL9K_LOAD_CRITICAL_FOREGROUND="red" | |
POWERLEVEL9K_LOAD_WARNING_FOREGROUND="yellow" | |
POWERLEVEL9K_LOAD_NORMAL_FOREGROUND="black" | |
POWERLEVEL9K_LOAD_CRITICAL_VISUAL_IDENTIFIER_COLOR="red" | |
POWERLEVEL9K_LOAD_WARNING_VISUAL_IDENTIFIER_COLOR="yellow" | |
POWERLEVEL9K_LOAD_NORMAL_VISUAL_IDENTIFIER_COLOR="green" | |
POWERLEVEL9K_HOME_ICON='\uF015' | |
POWERLEVEL9K_HOME_SUB_ICON='\uF07C' | |
POWERLEVEL9K_FOLDER_ICON='' | |
POWERLEVEL9K_STATUS_VERBOSE=true | |
POWERLEVEL9K_STATUS_CROSS=true | |
POWERLEVEL9K_NVM_BACKGROUND="238" | |
POWERLEVEL9K_NVM_FOREGROUND="green" | |
POWERLEVEL9K_USER_ICON="\uF415" | |
POWERLEVEL9K_ROOT_ICON="\uF09C" | |
POWERLEVEL9K_VCS_GIT_GITHUB_ICON='\uF408' | |
OS_ICON='\uE271' | |
alias ls='ls --color=auto' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment