feat: theme
This commit is contained in:
20
README.md
20
README.md
@@ -70,6 +70,8 @@ item_types = ["VJOURNAL", "VTODO"]
|
||||
...
|
||||
```
|
||||
|
||||
You may also specify the location of the configuration file with the environment `CONFIGFILE`.
|
||||
|
||||
Usage
|
||||
-----
|
||||
Use the default `fzf` keys to navigate your notes, e.g., `ctrl-j` and `ctrl-k` for going down/up in the list.
|
||||
@@ -96,6 +98,24 @@ Git support
|
||||
-----------
|
||||
You can track your entries with `git` by simply running `fzf-vjour --git-init`.
|
||||
|
||||
Extended configuration / Theming
|
||||
--------------------------------
|
||||
You may override any of the following parameters (shown with default values) in
|
||||
the configuration file:
|
||||
```sh
|
||||
FLAG_OPEN=🔲
|
||||
FLAG_COMPLETED=✅
|
||||
FLAG_JOURNAL=📘
|
||||
FLAG_NOTE=🗒️
|
||||
FLAG_PRIORITY=❗
|
||||
|
||||
STYLE_COLLECTION="$FAINT$WHITE"
|
||||
STYLE_DATE="$CYAN"
|
||||
STYLE_SUMMARY="$GREEN"
|
||||
STYLE_EXPIRED="$RED"
|
||||
STYLE_CATEGORY="$WHITE"
|
||||
```
|
||||
|
||||
Limitations
|
||||
-----------
|
||||
Here is a list of some currently present limitations.
|
||||
|
||||
@@ -49,6 +49,12 @@ BEGIN {
|
||||
# flag_completed: symbol for completed to-dos
|
||||
# flag_journal: symbol for journal entries
|
||||
# flag_note: symbol for note entries
|
||||
# flag_priority symbol for prior. task
|
||||
# style_collection
|
||||
# style_date
|
||||
# style_summary
|
||||
# style_expired
|
||||
# style_category
|
||||
|
||||
FS = "[:;]";
|
||||
# Collections
|
||||
@@ -59,10 +65,6 @@ BEGIN {
|
||||
collection2label[m[1]] = m[2];
|
||||
}
|
||||
# Colors
|
||||
GREEN = "\033[1;32m";
|
||||
RED = "\033[1;31m";
|
||||
WHITE = "\033[1;97m";
|
||||
CYAN = "\033[1;36m";
|
||||
OFF = "\033[m";
|
||||
|
||||
# For date comparision
|
||||
@@ -112,7 +114,7 @@ ENDFILE {
|
||||
"-",
|
||||
type,
|
||||
"-",
|
||||
RED "ERROR: file '" fpath "' contains whitespaces!" OFF
|
||||
style_expired "ERROR: file '" fpath "' contains whitespaces!" OFF
|
||||
exit
|
||||
}
|
||||
# Collection name
|
||||
@@ -145,7 +147,7 @@ ENDFILE {
|
||||
priotext = ""
|
||||
if (pri > 0)
|
||||
{
|
||||
priotext = "❗(" pri ") "
|
||||
priotext = flag_priority "(" pri ") "
|
||||
psort = 10 - pri
|
||||
}
|
||||
|
||||
@@ -158,8 +160,8 @@ ENDFILE {
|
||||
|
||||
# Date field. For VTODO entries, we show the due date, for journal entries,
|
||||
# the associated date.
|
||||
datecolor = CYAN;
|
||||
summarycolor = GREEN;
|
||||
datecolor = style_date
|
||||
summarycolor = style_summary
|
||||
|
||||
if (type == "VTODO")
|
||||
{
|
||||
@@ -167,8 +169,8 @@ ENDFILE {
|
||||
d = due ? due : (dur ? dts " for " dur : "");
|
||||
if (d && d <= today && sta != "COMPLETED")
|
||||
{
|
||||
datecolor = RED;
|
||||
summarycolor = RED;
|
||||
datecolor = style_expired;
|
||||
summarycolor = style_expired;
|
||||
}
|
||||
} else {
|
||||
d = dts
|
||||
@@ -202,5 +204,5 @@ ENDFILE {
|
||||
datecolor d OFF,
|
||||
flag,
|
||||
priotext summarycolor summary OFF,
|
||||
WHITE categories OFF;
|
||||
style_category categories OFF;
|
||||
}
|
||||
|
||||
17
src/main.sh
17
src/main.sh
@@ -5,6 +5,9 @@ set -eu
|
||||
# Helper functions
|
||||
. "sh/helper.sh"
|
||||
|
||||
# Read theme
|
||||
. "sh/theme.sh"
|
||||
|
||||
# Read configuration
|
||||
. "sh/config.sh"
|
||||
|
||||
@@ -15,10 +18,16 @@ __lines() {
|
||||
find "$ROOT" -type f -name '*.ics' -print0 | xargs -0 -P 0 \
|
||||
awk \
|
||||
-v collection_labels="$COLLECTION_LABELS" \
|
||||
-v flag_open="🔲" \
|
||||
-v flag_completed="✅" \
|
||||
-v flag_journal="📘" \
|
||||
-v flag_note="🗒️" \
|
||||
-v flag_open="$FLAG_OPEN" \
|
||||
-v flag_completed="$FLAG_COMPLETED" \
|
||||
-v flag_journal="$FLAG_JOURNAL" \
|
||||
-v flag_note="$FLAG_NOTE" \
|
||||
-v flag_priority="$FLAG_PRIORITY" \
|
||||
-v style_collection="$STYLE_COLLECTION" \
|
||||
-v style_date="$STYLE_DATE" \
|
||||
-v style_summary="$STYLE_SUMMARY" \
|
||||
-v style_expired="$STYLE_EXPIRED" \
|
||||
-v style_category="$STYLE_CATEGORY" \
|
||||
"$AWK_LIST" |
|
||||
sort -g -r
|
||||
}
|
||||
|
||||
@@ -36,43 +36,43 @@ while [ -n "${1:-}" ]; do
|
||||
case "${1:-}" in
|
||||
"--completed")
|
||||
shift
|
||||
cliquery="${cliquery:-} ✅"
|
||||
cliquery="${cliquery:-} $FLAG_COMPLETED"
|
||||
;;
|
||||
"--no-completed")
|
||||
shift
|
||||
cliquery="${cliquery:-} !✅"
|
||||
cliquery="${cliquery:-} !$FLAG_COMPLETED"
|
||||
;;
|
||||
"--open")
|
||||
shift
|
||||
cliquery="${cliquery:-} 🔲"
|
||||
cliquery="${cliquery:-} $FLAG_OPEN"
|
||||
;;
|
||||
"--no-open")
|
||||
shift
|
||||
cliquery="${cliquery:-} !🔲"
|
||||
cliquery="${cliquery:-} !$FLAG_OPEN"
|
||||
;;
|
||||
"--tasks")
|
||||
shift
|
||||
cliquery="${cliquery:-} ✅ | 🔲"
|
||||
cliquery="${cliquery:-} $FLAG_OPEN | $FLAG_COMPLETED"
|
||||
;;
|
||||
"--no-tasks")
|
||||
shift
|
||||
cliquery="${cliquery:-} !✅ !🔲"
|
||||
cliquery="${cliquery:-} !$FLAG_COMPLETED !$FLAG_OPEN"
|
||||
;;
|
||||
"--notes")
|
||||
shift
|
||||
cliquery="${cliquery:-} 🗒️"
|
||||
cliquery="${cliquery:-} $FLAG_NOTE"
|
||||
;;
|
||||
"--no-notes")
|
||||
shift
|
||||
cliquery="${cliquery:-} !🗒️"
|
||||
cliquery="${cliquery:-} !$FLAG_NOTE"
|
||||
;;
|
||||
"--journal")
|
||||
shift
|
||||
cliquery="${cliquery:-} 📘"
|
||||
cliquery="${cliquery:-} $FLAG_JOURNAL"
|
||||
;;
|
||||
"--no-journal")
|
||||
shift
|
||||
cliquery="${cliquery:-} !📘"
|
||||
cliquery="${cliquery:-} !$FLAG_JOURNAL"
|
||||
;;
|
||||
"--filter")
|
||||
shift
|
||||
@@ -90,5 +90,5 @@ while [ -n "${1:-}" ]; do
|
||||
;;
|
||||
esac
|
||||
done
|
||||
query=${cliquery:-!✅}
|
||||
query=${cliquery:-!$FLAG_COMPLETED}
|
||||
export query
|
||||
|
||||
@@ -27,7 +27,7 @@ if [ "${1:-}" = "--reload" ]; then
|
||||
shift
|
||||
fname="$1"
|
||||
shift
|
||||
__change_priority "$delta" "$fname" >>/tmp/foo
|
||||
__change_priority "$delta" "$fname" >/dev/null
|
||||
;;
|
||||
esac
|
||||
__lines
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CONFIGFILE="$HOME/.config/fzf-vjour/config"
|
||||
CONFIGFILE="${CONFIGFILE:-$HOME/.config/fzf-vjour/config}"
|
||||
if [ ! -f "$CONFIGFILE" ]; then
|
||||
err "Configuration '$CONFIGFILE' not found."
|
||||
exit 1
|
||||
@@ -41,5 +41,5 @@ export CAT
|
||||
|
||||
if command -v "git" >/dev/null && [ -d "$ROOT/.git" ]; then
|
||||
GIT="git -C $ROOT"
|
||||
export GIT
|
||||
fi
|
||||
export GIT
|
||||
|
||||
@@ -25,12 +25,9 @@ __change_priority() {
|
||||
shift
|
||||
fname="$1"
|
||||
shift
|
||||
echo "call to __change_priority with delta=$delta and fname=$fname" >>/tmp/foo
|
||||
file="$ROOT/$fname"
|
||||
tmpfile=$(mktemp)
|
||||
echo " tmpfile=$tmpfile" >>/tmp/foo
|
||||
awk -v delta="$delta" "$AWK_ALTERTODO" "$file" >"$tmpfile"
|
||||
echo " lines=$(wc -l tmpfile)" >>/tmp/foo
|
||||
mv "$tmpfile" "$file"
|
||||
if [ -n "${GIT:-}" ]; then
|
||||
$GIT add "$file"
|
||||
|
||||
20
src/sh/theme.sh
Normal file
20
src/sh/theme.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
# Colors
|
||||
GREEN="\033[1;32m"
|
||||
RED="\033[1;31m"
|
||||
WHITE="\033[1;97m"
|
||||
CYAN="\033[1;36m"
|
||||
FAINT="\033[2m"
|
||||
|
||||
# Flags
|
||||
export FLAG_OPEN="${FLAG_OPEN:-🔲}"
|
||||
export FLAG_COMPLETED="${FLAG_COMPLETED:-✅}"
|
||||
export FLAG_JOURNAL="${FLAG_JOURNAL:-📘}"
|
||||
export FLAG_NOTE="${FLAG_NOTE:-🗒️}"
|
||||
export FLAG_PRIORITY="${FLAG_PRIORITY:-❗}"
|
||||
|
||||
# Style
|
||||
export STYLE_COLLECTION="${STYLE_COLLECTION:-$FAINT$WHITE}"
|
||||
export STYLE_DATE="${STYLE_DATE:-$CYAN}"
|
||||
export STYLE_SUMMARY="${STYLE_SUMMARY:-$GREEN}"
|
||||
export STYLE_EXPIRED="${STYLE_EXPIRED:-$RED}"
|
||||
export STYLE_CATEGORY="${STYLE_CATEGORY:-$WHITE}"
|
||||
Reference in New Issue
Block a user