Rotate seasonal sunrise/work emojis
- Add per-season emoji sets and daily rotation
This commit is contained in:
@@ -90,6 +90,32 @@ _ps1_season() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Time-based emoji with seasonal accents (Europe/Oslo)
|
# Time-based emoji with seasonal accents (Europe/Oslo)
|
||||||
|
_ps1_pick_icon() {
|
||||||
|
local list_name="$1"
|
||||||
|
local season="$2"
|
||||||
|
local day
|
||||||
|
local -a list
|
||||||
|
local idx
|
||||||
|
local offset=0
|
||||||
|
|
||||||
|
day=$(TZ=Europe/Oslo date +%j)
|
||||||
|
case "$season" in
|
||||||
|
spring) offset=11 ;;
|
||||||
|
summer) offset=23 ;;
|
||||||
|
autumn) offset=37 ;;
|
||||||
|
*) offset=0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
eval "list=(\"\${${list_name}[@]}\")"
|
||||||
|
if ((${#list[@]} == 0)); then
|
||||||
|
echo ""
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
idx=$(( (10#$day + offset) % ${#list[@]} ))
|
||||||
|
echo "${list[$idx]}"
|
||||||
|
}
|
||||||
|
|
||||||
_ps1_symbol() {
|
_ps1_symbol() {
|
||||||
local hh mm h m
|
local hh mm h m
|
||||||
hh=$(TZ=Europe/Oslo date +%H); mm=$(TZ=Europe/Oslo date +%M)
|
hh=$(TZ=Europe/Oslo date +%H); mm=$(TZ=Europe/Oslo date +%M)
|
||||||
@@ -97,22 +123,34 @@ _ps1_symbol() {
|
|||||||
|
|
||||||
local season="${__PS1_SEASON:-winter}"
|
local season="${__PS1_SEASON:-winter}"
|
||||||
local sunrise coffee work evening night
|
local sunrise coffee work evening night
|
||||||
|
local -a sunrise_list work_list
|
||||||
|
|
||||||
case "$season" in
|
case "$season" in
|
||||||
spring)
|
spring)
|
||||||
sunrise="🌷"; coffee="☕"; work="🌿"; evening="🌤"; night="🌙"
|
sunrise_list=( "🌷" "🌱" "🐣" "🌤" )
|
||||||
|
work_list=( "🌿" "🪴" "🐝" "🌼" )
|
||||||
|
coffee="☕"; evening="🌤"; night="🌙"
|
||||||
;;
|
;;
|
||||||
summer)
|
summer)
|
||||||
sunrise="🌞"; coffee="🧃"; work="🪴"; evening="🌇"; night="🌙"
|
sunrise_list=( "🌞" "🏖️" "🌅" "🌤" )
|
||||||
|
work_list=( "🏄" "🏖️" "🚤" "🌴" )
|
||||||
|
coffee="🧃"; evening="🌇"; night="🌙"
|
||||||
;;
|
;;
|
||||||
autumn)
|
autumn)
|
||||||
sunrise="🍁"; coffee="☕"; work="🍂"; evening="🌆"; night="🌙"
|
sunrise_list=( "🍁" "🍂" "🌫️" "🌦️" )
|
||||||
|
work_list=( "🍂" "🍄" "🎃" "🪵" )
|
||||||
|
coffee="☕"; evening="🌆"; night="🌙"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
sunrise="🏔️"; coffee="☕"; work="❄️"; evening="🌆"; night="🌙"
|
sunrise_list=( "🏔️" "🌨️" "❄️" "🌌" )
|
||||||
|
work_list=( "🎿" "⛷️" "🏂" "🧊" )
|
||||||
|
coffee="☕"; evening="🌆"; night="🌙"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
sunrise="$(_ps1_pick_icon sunrise_list "$season")"
|
||||||
|
work="$(_ps1_pick_icon work_list "$season")"
|
||||||
|
|
||||||
if (( h >= 5 && h <= 8 )); then echo "$sunrise"
|
if (( h >= 5 && h <= 8 )); then echo "$sunrise"
|
||||||
elif (( h >= 9 && h <= 10 )); then echo "$coffee"
|
elif (( h >= 9 && h <= 10 )); then echo "$coffee"
|
||||||
elif (( h == 11 && m < 30 )); then echo "🥪"
|
elif (( h == 11 && m < 30 )); then echo "🥪"
|
||||||
@@ -216,9 +254,9 @@ ${Z2_BG}${Z2_FG} @\\h ${PATH_FG}${__PS1_PATH}${RST}${Z2_BG}${Z2_FG}${right}${RST
|
|||||||
|
|
||||||
_ps1_update() {
|
_ps1_update() {
|
||||||
__PS1_STATUS=$?
|
__PS1_STATUS=$?
|
||||||
|
__PS1_SEASON="$(_ps1_season)"
|
||||||
__PS1_SYM="$(_ps1_symbol)"
|
__PS1_SYM="$(_ps1_symbol)"
|
||||||
__PS1_PATH="$(_ps1_path)"
|
__PS1_PATH="$(_ps1_path)"
|
||||||
__PS1_SEASON="$(_ps1_season)"
|
|
||||||
if _ps1_has_nf; then __PS1_USE_NF=1; else __PS1_USE_NF=0; fi
|
if _ps1_has_nf; then __PS1_USE_NF=1; else __PS1_USE_NF=0; fi
|
||||||
_ps1_set_prompt
|
_ps1_set_prompt
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user