There are two variables available to use in the badge field with
\(user.gitBranch) \n \(user.humpDay)
- gitBranch shows the current branch the folder opened in the terminal is
- humpDay shows an icon according to the date
This code goes into ~/.bash_profile
#iTerm setup
function iterm2_print_user_vars() {
iterm2_set_user_var gitBranch $((git branch 2> /dev/null) | grep \* | cut -c3-)
iterm2_set_user_var humpDay $(what_day_is_it)
}
function random_emoji {
# Array with emojis
emojis=("๐น" "๐ " "๐" "๐ฆ" "๐ด" "โญ๏ธ" "๐" "๐ป" "๐" "๐" "๐ฅ" "๐" "๐ช" "๐" "๐ฅ" "๐ฑ" "๐ฃ" "๐ญ" "๐จ" "๐ฌ" "๐ง" "๐ผ" "๐น" "๐ฎ" "๐" "๐ซ" "๐" "๐" "๐บ" "๐ฟ" "๐ฏ" "๐" "๐" "โฉ" "๐" "๐" "๐ผ" "๐ฝ" "๐" "โฐ" "๐ก" "๐" "โ๏ธ" "๐ " "โ๏ธ" "๐ฃ" "โ๏ธ" "๐ฎ" "๐" "๐ญ" "๐ฌ" "๐ณ" "๐ฝ" "๐๐ฝ" "๐" "๐ช" "๐ผ" "๐" "โ๏ธ" "๐" "๐" "๐" "๐ฏ" "๐ถ" "๐" "โ" "๐ฑ" "โ" "โฆ" "โ" "โป๏ธ" "๐
" "๐คฃ" "๐" "๐" "๐ค" "๐" "๐" "๐ณ" "๐ฑ" "๐" "๐ค" "๐พ" "๐" "๐๐ผ" "๐" "๐๐ป" "๐")
# Seed random generator
RANDOM=$$$(date +%s)
# Get random expression...
selectedemoji=${emojis[$RANDOM % ${#emojis[@]}]}
# Write to Shell
echo $selectedemoji
}
function what_day_is_it {
case "$(date +%A)" in
"lunes")
if [[ $(date +%H) > 15 ]]
then
random_emoji
else
echo "๐ฑ"
fi
;;
"miรฉrcoles")
if [[ $(date +%H) < 15 ]]
then
random_emoji
else
echo "๐ช"
fi
;;
"jueves")
echo "๐ณ"
;;
"viernes")
echo "๐ฆ"
;;
"sรกbado" | "domingo")
echo "โ ๏ธ"
;;
*)
random_emoji
;;
esac
}