bugfix: allday event display, and more exports

This commit is contained in:
Ämin Baumeler 2025-06-18 16:58:14 +02:00
parent 8a6c11b6b5
commit 5b2a524301
4 changed files with 16 additions and 24 deletions

View File

@ -48,7 +48,7 @@ function color_from_status(status) {
# @return: Single-line string
function allday(collection, desc, status, color) {
color = color_from_status(status)
return collection " " style_allday
return collection " " style_allday color desc OFF
}
# Return line for multi-day event, or event that starts at midnight, which ends today.

View File

@ -68,22 +68,6 @@ fi
### Start
__refresh_data
### Exports
# The preview calls run in subprocesses. These require the following variables:
# The reload commands also run in subprocesses, and use in addition
# as well as the following variables that will be dynamically specified. So, we
# export them in the main loop using the following function.
# __export()
# Re-export dynamical variables to subshells.
__export() {
DISPLAY_DATE=$(date -R -d "$DISPLAY_DATE")
export DISPLAY_DATE WEEKLY_DATA_FILE APPROX_DATA_FILE
if [ -n "${TZ:-}" ]; then
export TZ
fi
}
###
### Main loop with the command-line argument
### --today

View File

@ -28,15 +28,14 @@ __load_weeks() {
# file `$APPROX_DATA_FILE` and the output of `__load_weeks` in the temporary
# file `@WEEKLY_DATA_FILE`.
__refresh_data() {
if [ -n "${APPROX_DATA_FILE:-}" ]; then
rm -f "$APPROX_DATA_FILE"
if [ -z "${APPROX_DATA_FILE:-}" ]; then
APPROX_DATA_FILE=$(mktemp)
trap 'rm -f "$APPROX_DATA_FILE"' EXIT INT
fi
if [ -n "${WEEKLY_DATA_FILE:-}" ]; then
rm -f "$WEEKLY_DATA_FILE"
if [ -z "${WEEKLY_DATA_FILE:-}" ]; then
WEEKLY_DATA_FILE=$(mktemp)
trap 'rm -f "$WEEKLY_DATA_FILE"' EXIT INT
fi
APPROX_DATA_FILE=$(mktemp)
__load_approx_data >"$APPROX_DATA_FILE"
WEEKLY_DATA_FILE=$(mktemp)
__load_weeks >"$WEEKLY_DATA_FILE"
trap 'rm -f "$APPROX_DATA_FILE" "$WEEKLY_DATA_FILE"' EXIT INT
}

View File

@ -25,3 +25,12 @@ __datetime_human_machine() {
__summary_for_commit() {
awk -v field="SUMMARY" "$AWK_GET" "$1" | tr -c -d "[:alnum:][:blank:]" | head -c 15
}
# Re-export dynamical variables to subshells.
__export() {
DISPLAY_DATE=$(date -R -d "$DISPLAY_DATE")
export DISPLAY_DATE
if [ -n "${TZ:-}" ]; then
export TZ
fi
}