diff --git a/docs/docs.md b/docs/docs.md index 63c6977..fdb824c 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -49,6 +49,9 @@ You may use long, descriptive arguments or the shorter arguments. `-ngc, --no-generate-cache ` : Don't generate image cache +`-mc, --max-cache size ` +: Set max image cache size to size + `-rw, --relative-width ` : Enable relative input width diff --git a/docs/example.Xresources b/docs/example.Xresources index 50ccd54..5808b51 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -93,6 +93,8 @@ spmenu.imageheight: 86 spmenu.imagegaps: 0 spmenu.imageposition: 0 spmenu.generatecache: 1 +spmenu.maxcache: 512 + !! Mode options spmenu.mode: 0 diff --git a/libs/argv.c b/libs/argv.c index af23a0a..d25a3a0 100644 --- a/libs/argv.c +++ b/libs/argv.c @@ -159,7 +159,9 @@ readargs(int argc, char *argv[]) } else if (!strcmp(argv[i], "-g") || (!strcmp(argv[i], "--columns"))) { // number of columns in grid columns = atoi(argv[++i]); if (lines == 0) lines = 1; - } else if (!strcmp(argv[i], "-Ps") || (!strcmp(argv[i], "--password-symbol"))) { // password symbol + } else if (!strcmp(argv[i], "-mc") || (!strcmp(argv[i], "--max-cache"))) { // max cache + maxcache = atoi(argv[++i]); + } else if (!strcmp(argv[i], "-") || (!strcmp(argv[i], "--password-symbol"))) { // password symbol password = argv[++i]; } else if (!strcmp(argv[i], "-l") || (!strcmp(argv[i], "--lines"))) { // number of lines in grid lines = atoi(argv[++i]); @@ -345,6 +347,7 @@ usage(void) "spmenu -g, --columns Set the number of grids to \n" "spmenu -gc, --generate-cache Generate image cache\n" "spmenu -ngc, --no-generate-cache Don't generate image cache\n" + "spmenu -mc --max-cache Set max image cache size to \n" "spmenu -rw, --relative-width Enable relative input width\n" "spmenu -nrw, --no-relative-width Disable relative input width\n" "spmenu -f, --fast Grabs keyboard before reading stdin\n" diff --git a/libs/img-c.c b/libs/img-c.c index 28060c1..5b05527 100644 --- a/libs/img-c.c +++ b/libs/img-c.c @@ -220,7 +220,7 @@ loadimagecache(const char *file, int *width, int *height) struct passwd *pw = NULL; // just load and don't store or try cache - if (longestedge > 256) { + if (longestedge > maxcache) { loadimage(file, width, height); if (image) scaleimage(width, height); diff --git a/libs/xresources.h b/libs/xresources.h index 3facefb..2f2bb61 100644 --- a/libs/xresources.h +++ b/libs/xresources.h @@ -129,6 +129,7 @@ ResourcePref resources[] = { { "imagegaps", INTEGER, &imagegaps }, { "imageposition", INTEGER, &imageposition }, { "generatecache", INTEGER, &generatecache }, + { "maxcache", INTEGER, &maxcache }, { "mode", INTEGER, &mode }, { "fast", INTEGER, &fast }, { "managed", INTEGER, &managed }, diff --git a/options.h b/options.h index e7fce53..5bfbb51 100644 --- a/options.h +++ b/options.h @@ -24,6 +24,7 @@ static int imageheight = 86; /* Default image height */ static int imagegaps = 0; /* Image gaps */ static int imageposition = 0; /* Image position (0: Top, 1: Bottom, 2: Center, 3: Top center) */ static int generatecache = 1; /* Generate image cache by default */ +static int maxcache = 512; /* Max image size to cache */ /* Mode options */ static int mode = 0; /* Mode to start speedwm in (0: Normal mode, 1: Insert mode) */ diff --git a/spmenu.1 b/spmenu.1 index f7703b4..fa2f3a2 100644 --- a/spmenu.1 +++ b/spmenu.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pandoc 3.0.1 +.\" Automatically generated by Pandoc 3.1 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. @@ -65,6 +65,9 @@ Generate image cache \f[V]-ngc, --no-generate-cache\f[R] Don\[cq]t generate image cache .TP +\f[V]-mc, --max-cache size\f[R] +Set max image cache size to size +.TP \f[V]-rw, --relative-width\f[R] Enable relative input width .TP @@ -174,6 +177,9 @@ Hide right arrow \f[V]-hpr, --hide-prompt\f[R] Hide prompt .TP +\f[V]-hpl, --hide-powerline\f[R] +Hide powerline +.TP \f[V]-hc, --hide-cursor\f[R] Hide cursor .TP @@ -198,6 +204,9 @@ Show right arrow \f[V]-spr, --show-prompt\f[R] Show prompt .TP +\f[V]-spl, --show-powerline\f[R] +Show powerline +.TP \f[V]-sc, --show-cursor\f[R] Show cursor .TP