From 4b857925f7170309e69d75a34594b2918b8616e0 Mon Sep 17 00:00:00 2001 From: BarbUk Date: Wed, 9 Mar 2022 11:37:19 +0100 Subject: [PATCH 1/3] Fix dynamic clock icon --- lib/command_duration.bash | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/command_duration.bash b/lib/command_duration.bash index bc0cca8e0a..ffa6d5f16d 100644 --- a/lib/command_duration.bash +++ b/lib/command_duration.bash @@ -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. + clock_hand=$(printf '%x' $(((${1:-${SECONDS}} % 12) + 144))) printf -v 'COMMAND_DURATION_ICON' '%b' "\xf0\x9f\x95\x$clock_hand" } From 0468b2d918e5c5e880d509205676d15ffae90e05 Mon Sep 17 00:00:00 2001 From: BarbUk Date: Wed, 9 Mar 2022 21:04:54 +0100 Subject: [PATCH 2/3] Use printf variable scope --- lib/command_duration.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/command_duration.bash b/lib/command_duration.bash index ffa6d5f16d..aaccb48be1 100644 --- a/lib/command_duration.bash +++ b/lib/command_duration.bash @@ -14,7 +14,7 @@ function _dynamic_clock_icon { local clock_hand # clock hand value is between 90 and 9b in hexadecimal. # so between 144 and 155 in base 10. - clock_hand=$(printf '%x' $(((${1:-${SECONDS}} % 12) + 144))) + printf -v clock_hand '%x' $(( (${1:-${SECONDS}} % 12) + 144 )) printf -v 'COMMAND_DURATION_ICON' '%b' "\xf0\x9f\x95\x$clock_hand" } From 134902be73f973da5e335ca276ebfb073532f927 Mon Sep 17 00:00:00 2001 From: BarbUk Date: Wed, 9 Mar 2022 21:10:49 +0100 Subject: [PATCH 3/3] shfmt do not like spaces --- lib/command_duration.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/command_duration.bash b/lib/command_duration.bash index aaccb48be1..686267fb6d 100644 --- a/lib/command_duration.bash +++ b/lib/command_duration.bash @@ -14,7 +14,7 @@ function _dynamic_clock_icon { 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 clock_hand '%x' $(((${1:-${SECONDS}} % 12) + 144)) printf -v 'COMMAND_DURATION_ICON' '%b' "\xf0\x9f\x95\x$clock_hand" }