From 8a23f451b30e7bba9362a4b98e71bc789b9dd9f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=84min=20Baumeler?= Date: Fri, 20 Jun 2025 10:16:55 +0200 Subject: [PATCH] improvement: fzf simplified, added TZ theme in dayview --- src/main.sh | 28 ++++++++++++++-------------- src/sh/theme.sh | 4 +++- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/main.sh b/src/main.sh index d46dfa0..42ae345 100755 --- a/src/main.sh +++ b/src/main.sh @@ -163,13 +163,13 @@ while true; do --accept-nth='1,2,3,4,5' \ --preview="$0 --preview-event {}" \ --expect="ctrl-n,ctrl-t,ctrl-g,ctrl-alt-d,esc,backspace,q,alt-v,x,c,a" \ - --bind="load:pos(1)+transform( - echo change-border-label:🗓️ \$(date -d {1} +\"%A %e %B %Y\") + --bind='load:pos(1)+transform( + echo change-border-label:🗓️ $(date -d {1} +"%A %e %B %Y") )+transform( - [ -n \"\${TZ:-}\" ] && echo \"change-list-label:\$WHITE\$ITALIC(\$TZ)\$OFF\" + [ -n "${TZ:-}" ] && echo "change-list-label:$STYLE_DV_TZ($TZ)$OFF" )+transform( [ -n {5} ] && echo show-preview - )" \ + )' \ --bind="start:hide-preview" \ --bind="j:down" \ --bind="k:up" \ @@ -243,7 +243,7 @@ while true; do --print-query \ --bind="start:hide-input" \ --bind="ctrl-alt-d:show-input+change-query(ctrl-alt-d)+accept" \ - --bind="load:transform:[ \"\$FZF_TOTAL_COUNT\" -eq 0 ] && echo 'unbind(enter)+unbind(ctrl-alt-d)'" \ + --bind='load:transform:[ "$FZF_TOTAL_COUNT" -eq 0 ] && echo "unbind(enter)+unbind(ctrl-alt-d)"' \ --bind="w:toggle-wrap" \ --bind="j:down" \ --bind="k:up" || @@ -369,19 +369,19 @@ while true; do --info-command="printf \"$(date +"%R %Z")\"; [ -n \"\${TZ:-}\" ] && printf \" (\$TZ)\"" \ --preview-window=up,7,border-bottom \ --preview="$0 --preview-week {}" \ - --bind="load:pos($DISPLAY_POS)" \ + --bind="load:pos($DISPLAY_POS)+unbind(load)" \ --expect="ctrl-n,ctrl-g,ctrl-t" \ --bind="q:abort" \ --bind="j:down" \ --bind="k:up" \ - --bind="l:unbind(load)+reload:$0 --reload-week {2} '+1 week'" \ - --bind="h:unbind(load)+reload:$0 --reload-week {2} '-1 week'" \ - --bind="right:unbind(load)+reload:$0 --reload-week {2} '+1 week'" \ - --bind="left:unbind(load)+reload:$0 --reload-week {2} '-1 week'" \ - --bind="ctrl-l:unbind(load)+reload:$0 --reload-week {2} '+1 month'" \ - --bind="ctrl-h:unbind(load)+reload:$0 --reload-week {2} '-1 month'" \ - --bind="alt-l:unbind(load)+reload:$0 --reload-week {2} '+1 year'" \ - --bind="alt-h:unbind(load)+reload:$0 --reload-week {2} '-1 year'" \ + --bind="l:reload:$0 --reload-week {2} '+1 week'" \ + --bind="h:reload:$0 --reload-week {2} '-1 week'" \ + --bind="right:reload:$0 --reload-week {2} '+1 week'" \ + --bind="left:reload:$0 --reload-week {2} '-1 week'" \ + --bind="ctrl-l:reload:$0 --reload-week {2} '+1 month'" \ + --bind="ctrl-h:reload:$0 --reload-week {2} '-1 month'" \ + --bind="alt-l:reload:$0 --reload-week {2} '+1 year'" \ + --bind="alt-h:reload:$0 --reload-week {2} '-1 year'" \ --bind="ctrl-r:rebind(load)+reload($0 --reload-week today)+show-preview" \ --bind="ctrl-s:execute($SYNC_CMD ; printf 'Press to continue.'; read -r tmp)" \ --bind="/:show-input+unbind(q)+unbind(j)+unbind(k)+unbind(l)+unbind(h)+unbind(ctrl-l)+unbind(ctrl-h)+unbind(alt-l)+unbind(alt-h)+unbind(load)+hide-preview+reload:$0 --reload-all" \ diff --git a/src/sh/theme.sh b/src/sh/theme.sh index 522383b..33cf6d8 100644 --- a/src/sh/theme.sh +++ b/src/sh/theme.sh @@ -10,7 +10,8 @@ ITALIC="\033[3m" FAINT="\033[2m" BOLD="\033[1m" BG="\033[41m" -OFF="\033[m" + +export OFF="\033[m" # Style # Calendar @@ -36,6 +37,7 @@ export STYLE_DV_TENTATIVE="${STYLE_DV_TENTATIVE:-$FAINT$CYAN}" export STYLE_DV_CANCELLED="${STYLE_DV_CANCELLED:-$STRIKE$CYAN}" export STYLE_DV_HOUR="${STYLE_DV_HOUR:-$FAINT}" export STYLE_DV_EMPTYHOUR="${STYLE_DV_EMPTYHOUR:-$FAINT----------------------$OFF}" +export STYLE_DV_TZ="$WHITE$ITALIC" # Event preview export STYLE_EPV_DATETIME="${STYLE_EPV_DATETIME:-$CYAN}"