feat!: use XDG_DATA_HOME as AGENDA_DIR fallback

I first decided against this, but the old `~/.app-trash` is no more
fitting than the XDG_DATA_HOME location.

The xdg-user-dir DOCUMENTS fallback is too presumptuous and removing it
makes things even simpler.
This commit is contained in:
2023-11-16 21:14:32 +01:00
parent 8b1ac934b1
commit 406ffb7c19
3 changed files with 3 additions and 18 deletions

6
agenda
View File

@@ -57,11 +57,7 @@ __main() {
esac
if [ -z "$AGENDA_DIR" ]; then
if type xdg-user-dir >/dev/null 2>&1; then
AGENDA_DIR="$(xdg-user-dir DOCUMENTS)/agenda"
else
AGENDA_DIR="$HOME/.agenda"
fi
AGENDA_DIR="${XDG_DATA_HOME:-"$HOME/.local/share"}/agenda"
fi
# Subcommand

View File

@@ -107,9 +107,7 @@ The editor process has access to certain environment variables.
\fBAGENDA_DIR\fP
.RS 4
The home of all agenda note files read and written by agenda. If this is empty
agenda will attempt to find the \fIxdg-user-dir DOCUMENTS\fP directory if
\fBxdg-user-dir(1)\fP is found in \fBPATH\fP. Otherwise `$HOME/.agenda` will be
used.
`${XDG_DATA_HOME:-"$HOME/.local/share"}/agenda` will be used.
.PP
.RE
\#
@@ -192,11 +190,6 @@ The last agenda file. Can be empty if no previous agenda note exists.
.RE
\#=============================================================================
.SH "SEE ALSO"
\fBxdg-user-dir(1)\fP
.RS 4
Used to find the default \fBAGENDA_DIR\fP.
.PP
.RE
\fBdate(1)\fP
.RS 4
Your installation of date determines which date formats for the \fI<date>\fP

View File

@@ -5,11 +5,7 @@
# TODO: Maybe its easier to add an api to the agenda script to query for the
# available -t option values?
if [ -z "$AGENDA_DIR" ]; then
if type xdg-user-dir >/dev/null 2>&1; then
AGENDA_DIR="$(xdg-user-dir DOCUMENTS)/agenda"
else
AGENDA_DIR="$HOME/.agenda"
fi
AGENDA_DIR="${XDG_DATA_HOME:-"$HOME/.local/share"}/agenda"
fi
AGENDA_COMP_DATE_MOD=("next" "last")