diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-03-07 13:31:48 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-03-07 13:31:48 +0100 |
commit | d3261948b866f7e7b60024f2dd6e82502b2dbea1 (patch) | |
tree | 543e4e8188c02b4266da61ee78a059f9e2bf46b2 /.config/khal | |
parent | 91b44861f53237169859de186e38cc076635a9b0 (diff) |
add khal + vdirsyncer config
Diffstat (limited to '.config/khal')
-rw-r--r-- | .config/khal/base | 14 | ||||
l--------- | .config/khal/config.sh | 1 | ||||
-rwxr-xr-x | .config/khal/config_gen | 56 |
3 files changed, 71 insertions, 0 deletions
diff --git a/.config/khal/base b/.config/khal/base new file mode 100644 index 0000000..2a8238d --- /dev/null +++ b/.config/khal/base @@ -0,0 +1,14 @@ +# vim:ft=dosini + +[locale] +timeformat = %H:%M +dateformat = %m月%d日 (%a) +longdateformat = %A %Y年%m月%d日 +datetimeformat = %c +longdatetimeformat = %c + +[view] +agenda_day_format = "{bold}{date-long}{reset}" +agenda_event_format = " {cancelled}{repeat-symbol}{alarm-symbol}{start-end-time-style} -- {calendar-color}{title}{reset}" +blank_line_before_day = True + diff --git a/.config/khal/config.sh b/.config/khal/config.sh new file mode 120000 index 0000000..ecf2581 --- /dev/null +++ b/.config/khal/config.sh @@ -0,0 +1 @@ +../vdirsyncer/config.sh
\ No newline at end of file diff --git a/.config/khal/config_gen b/.config/khal/config_gen new file mode 100755 index 0000000..da59fa5 --- /dev/null +++ b/.config/khal/config_gen @@ -0,0 +1,56 @@ +#!/bin/sh +. "$XDG_CONFIG_HOME/vdirsyncer/config_gen" lib + +cat << EOF +[calendars] + +EOF + +_sync() { + yes | vdirsyncer discover 1> /dev/null 2> /dev/null + vdirsyncer sync 1> /dev/null 2> /dev/null + vdirsyncer metasync 1> /dev/null 2> /dev/null +} + +_color_quantize() { + INPUT_HEX="$(echo $1 | grep -o '#[0-9a-fA-F]\{6\}')" + + echo "$INPUT_HEX" +} + +_cfg_caldav() { + jq --raw-output '.collections[][0]' "$VDIRSYNCER_STATUS_PATH/$ID.collections" | while read -r collection ; do + collection_path="$XDG_DATA_HOME/vdirsyncer/$ID/$collection" + color_path="$collection_path/color" + displayname_path="$collection_path/displayname" + [ ! -d "$collection_path" ] && _sync + [ ! -f "$color_path" ] && _sync + [ ! -f "$displayname_path" ] && _sync + COLOR="$(cat "$color_path")" + NAME="$(cat "$displayname_path")" + [ -n "$COLOR" ] && [ -n "$QUANTIZE_COLOR" ] && COLOR="$(_color_quantize "$COLOR")" + cat << EOF +[[$NAME]] +path = "$collection_path" +EOF + [ -n "$COLOR" ] && echo "color = \"$COLOR\"" + echo + done +} + +_cfg_ical() { + collection_path="$XDG_DATA_HOME/vdirsyncer/$ID" + [ ! -d "$collection_path" ] && _sync + cat << EOF +[[$NAME]] +path = "$collection_path" +readonly = True +EOF + [ -n "$COLOR" ] && echo "color = \"$COLOR\"" + + echo +} + +. "$CONFIG_FILE" + +printf '# %s:%s=%s\n' vim ft dosini |