From 85169642ca004c75464aa4f803bc0df11bb151cf Mon Sep 17 00:00:00 2001 From: John D Pell Date: Sun, 8 Aug 2021 09:36:22 +0200 Subject: [PATCH] WMaker: Store history in $XDG_STATE_HOME if defined The FreeDesktop XDG standard suggests storing history in the directory pointed by $XDG_STATE_HOME; so if we find it is defined we prefer to use it over the default path. If undefined, keep the old behaviour. This may introduce a loss of history for users that had some in the legacy place but have the variable, we consider this very unlikely to be a problem but if user complains we can suggest them to move the legacy file over the empty new one. --- src/dialog.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dialog.c b/src/dialog.c index 2d5a6d7b..9bab902c 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -182,8 +182,12 @@ static char *HistoryFileName(const char *name) { char *filename = NULL; - filename = wstrdup(wusergnusteppath()); - filename = wstrappend(filename, "/.AppInfo/WindowMaker/History"); + filename = getenv("XDG_STATE_HOME"); + if (filename) + filename = wstrappend(wexpandpath(filename), "/" PACKAGE_TARNAME "/History"); + else + filename = wstrconcat(wusergnusteppath(), "/.AppInfo/" PACKAGE_TARNAME "/History"); + if (name && strlen(name)) { filename = wstrappend(filename, "."); filename = wstrappend(filename, name);