Fix dynamic clock icon (#2120)

* Fix dynamic clock icon

* Use printf variable scope

* shfmt do not like spaces
pull/2122/head
BarbUk 2022-03-09 21:59:48 +01:00 committed by GitHub
parent a6fd93076d
commit e1ddf6e311
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -11,7 +11,10 @@ function _command_duration_pre_exec() {
}
function _dynamic_clock_icon {
local -i clock_hand=$(((${1:-${SECONDS}} % 12) + 90))
local clock_hand
# clock hand value is between 90 and 9b in hexadecimal.
# so between 144 and 155 in base 10.
printf -v clock_hand '%x' $(((${1:-${SECONDS}} % 12) + 144))
printf -v 'COMMAND_DURATION_ICON' '%b' "\xf0\x9f\x95\x$clock_hand"
}