From 406ffb7c191d488bc64f4c9a383daf723b999f6d Mon Sep 17 00:00:00 2001 From: Jonas Kattendick Date: Thu, 16 Nov 2023 21:14:32 +0100 Subject: [PATCH] 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. --- agenda | 6 +----- agenda.1 | 9 +-------- completion.bash | 6 +----- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/agenda b/agenda index 24d054e..cd1941b 100644 --- a/agenda +++ b/agenda @@ -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 diff --git a/agenda.1 b/agenda.1 index 3b4424c..c60f91b 100644 --- a/agenda.1 +++ b/agenda.1 @@ -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\fP diff --git a/completion.bash b/completion.bash index 0ab1957..5b870f5 100644 --- a/completion.bash +++ b/completion.bash @@ -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")