Skip to content

Commit

Permalink
Fix dynamic clock icon (#2120)
Browse files Browse the repository at this point in the history
* Fix dynamic clock icon

* Use printf variable scope

* shfmt do not like spaces
  • Loading branch information
BarbUk committed Mar 9, 2022
1 parent a6fd930 commit e1ddf6e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/command_duration.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down

0 comments on commit e1ddf6e

Please sign in to comment.