Default to the default value of $XDG_CACHE_DIR in case $XDG_CACHE_DIR is

not set.

Both the current behavior and this commit are valid according to the XDG
base directory standard, however realistically no one wants dotfiles in
their home directory, and that's what would happen if $XDG_CACHE_DIR
is unset.

Also fix key inconsistency between X and Wayland.
This commit is contained in:
speedie 2023-06-22 00:17:23 +02:00
parent 7389d28be5
commit ca624e1ca6
2 changed files with 3 additions and 3 deletions

View file

@ -259,7 +259,7 @@ void loadimagecache(const char *file, int *width, int *height) {
if (xdg_cache || !strcmp(cachedir, "xdg")) if (xdg_cache || !strcmp(cachedir, "xdg"))
slen = snprintf(NULL, 0, "%s/thumbnails/%s/%s.png", xdg_cache, dsize, md5)+1; slen = snprintf(NULL, 0, "%s/thumbnails/%s/%s.png", xdg_cache, dsize, md5)+1;
else else
slen = snprintf(NULL, 0, "%s/.thumbnails/%s/%s.png", home, dsize, md5)+1; slen = snprintf(NULL, 0, "%s/.cache/thumbnails/%s/%s.png", home, dsize, md5)+1;
} else { } else {
slen = snprintf(NULL, 0, "%s/%s/%s.png", cachedir, dsize, md5)+1; slen = snprintf(NULL, 0, "%s/%s/%s.png", cachedir, dsize, md5)+1;
} }
@ -273,7 +273,7 @@ void loadimagecache(const char *file, int *width, int *height) {
if (xdg_cache) if (xdg_cache)
sprintf(buf, "%s/thumbnails/%s/%s.png", xdg_cache, dsize, md5); sprintf(buf, "%s/thumbnails/%s/%s.png", xdg_cache, dsize, md5);
else else
sprintf(buf, "%s/.thumbnails/%s/%s.png", home, dsize, md5); sprintf(buf, "%s/.cache/thumbnails/%s/%s.png", home, dsize, md5);
} else { } else {
sprintf(buf, "%s/%s/%s.png", cachedir, dsize, md5); sprintf(buf, "%s/%s/%s.png", cachedir, dsize, md5);
} }

View file

@ -22,4 +22,4 @@ static void grabkeyboard_x11(void);
static void getcapsstate(void); static void getcapsstate(void);
static Key ckeys[256]; static Key ckeys[256];
static Key hkeys[1] = { { -1, Ctrl|Alt|Shift, XK_Delete, quit, {0} } }; static Key hkeys[1] = { { -1, Ctrl|Alt, XK_Delete, quit, {0} } };