Last Updated: February 25, 2016
ยท
787
ยท cristian

emoji terminal prompt experiment

example

Small experiment to show the current time in the prompt using emoji:

function prompt_char {
    if [ $UID -eq 0 ]; then echo "#"; else echo ฮป; fi
}

clock_array=(๐Ÿ•  ๐Ÿ•œ  ๐Ÿ•‘  ๐Ÿ•  ๐Ÿ•’  ๐Ÿ•ž  ๐Ÿ•“  ๐Ÿ•Ÿ  ๐Ÿ•”  ๐Ÿ•   ๐Ÿ••  ๐Ÿ•ก  ๐Ÿ•–  ๐Ÿ•ข  ๐Ÿ•—  ๐Ÿ•ฃ  ๐Ÿ•˜  ๐Ÿ•ค  ๐Ÿ•™  ๐Ÿ•ฅ  ๐Ÿ•š  ๐Ÿ•ฆ  ๐Ÿ•›  ๐Ÿ•ง )

function check_hour {
    hour_24=`date "+%H"`
    hour=`echo "$hour_24 % 12" | bc`

    if [ "$hour" -eq 0 ]; then
        hour=12
    fi

    minute=`date "+%M"`

    if [ "$minute" -ge 45 -o "$minute" -le 15 ]; then
        clock_array_shift=-1
        if [ "$minute" -le 59 -a "$minute" -ge 45 ]; then
            hour=`echo "$hour + 1" | bc`
        fi
    else
        clock_array_shift=0
    fi

    clock_index=`echo "(($hour * 2) + $clock_array_shift) % 24" | bc`
    clock=${clock_array[$clock_index]}

    echo " $clock "
}

PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%})$(check_hour) %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%_$(prompt_char)%{$reset_color%} '

ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=") "

Written by Cristian

Recommend
Say Thanks
Update Notifications Off
Respond