forked from speedie/spmenu
allow adjusting max image size
This commit is contained in:
parent
eb70a49512
commit
5c8fe8fe10
|
@ -49,6 +49,9 @@ You may use long, descriptive arguments or the shorter arguments.
|
||||||
`-ngc, --no-generate-cache `
|
`-ngc, --no-generate-cache `
|
||||||
: Don't generate image cache
|
: Don't generate image cache
|
||||||
|
|
||||||
|
`-mc, --max-cache size `
|
||||||
|
: Set max image cache size to size
|
||||||
|
|
||||||
`-rw, --relative-width `
|
`-rw, --relative-width `
|
||||||
: Enable relative input width
|
: Enable relative input width
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,8 @@ spmenu.imageheight: 86
|
||||||
spmenu.imagegaps: 0
|
spmenu.imagegaps: 0
|
||||||
spmenu.imageposition: 0
|
spmenu.imageposition: 0
|
||||||
spmenu.generatecache: 1
|
spmenu.generatecache: 1
|
||||||
|
spmenu.maxcache: 512
|
||||||
|
|
||||||
|
|
||||||
!! Mode options
|
!! Mode options
|
||||||
spmenu.mode: 0
|
spmenu.mode: 0
|
||||||
|
|
|
@ -159,7 +159,9 @@ readargs(int argc, char *argv[])
|
||||||
} else if (!strcmp(argv[i], "-g") || (!strcmp(argv[i], "--columns"))) { // number of columns in grid
|
} else if (!strcmp(argv[i], "-g") || (!strcmp(argv[i], "--columns"))) { // number of columns in grid
|
||||||
columns = atoi(argv[++i]);
|
columns = atoi(argv[++i]);
|
||||||
if (lines == 0) lines = 1;
|
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];
|
password = argv[++i];
|
||||||
} else if (!strcmp(argv[i], "-l") || (!strcmp(argv[i], "--lines"))) { // number of lines in grid
|
} else if (!strcmp(argv[i], "-l") || (!strcmp(argv[i], "--lines"))) { // number of lines in grid
|
||||||
lines = atoi(argv[++i]);
|
lines = atoi(argv[++i]);
|
||||||
|
@ -345,6 +347,7 @@ usage(void)
|
||||||
"spmenu -g, --columns <grid> Set the number of grids to <grid>\n"
|
"spmenu -g, --columns <grid> Set the number of grids to <grid>\n"
|
||||||
"spmenu -gc, --generate-cache Generate image cache\n"
|
"spmenu -gc, --generate-cache Generate image cache\n"
|
||||||
"spmenu -ngc, --no-generate-cache Don't generate image cache\n"
|
"spmenu -ngc, --no-generate-cache Don't generate image cache\n"
|
||||||
|
"spmenu -mc --max-cache <size> Set max image cache size to <size>\n"
|
||||||
"spmenu -rw, --relative-width Enable relative input width\n"
|
"spmenu -rw, --relative-width Enable relative input width\n"
|
||||||
"spmenu -nrw, --no-relative-width Disable relative input width\n"
|
"spmenu -nrw, --no-relative-width Disable relative input width\n"
|
||||||
"spmenu -f, --fast Grabs keyboard before reading stdin\n"
|
"spmenu -f, --fast Grabs keyboard before reading stdin\n"
|
||||||
|
|
|
@ -220,7 +220,7 @@ loadimagecache(const char *file, int *width, int *height)
|
||||||
struct passwd *pw = NULL;
|
struct passwd *pw = NULL;
|
||||||
|
|
||||||
// just load and don't store or try cache
|
// just load and don't store or try cache
|
||||||
if (longestedge > 256) {
|
if (longestedge > maxcache) {
|
||||||
loadimage(file, width, height);
|
loadimage(file, width, height);
|
||||||
if (image)
|
if (image)
|
||||||
scaleimage(width, height);
|
scaleimage(width, height);
|
||||||
|
|
|
@ -129,6 +129,7 @@ ResourcePref resources[] = {
|
||||||
{ "imagegaps", INTEGER, &imagegaps },
|
{ "imagegaps", INTEGER, &imagegaps },
|
||||||
{ "imageposition", INTEGER, &imageposition },
|
{ "imageposition", INTEGER, &imageposition },
|
||||||
{ "generatecache", INTEGER, &generatecache },
|
{ "generatecache", INTEGER, &generatecache },
|
||||||
|
{ "maxcache", INTEGER, &maxcache },
|
||||||
{ "mode", INTEGER, &mode },
|
{ "mode", INTEGER, &mode },
|
||||||
{ "fast", INTEGER, &fast },
|
{ "fast", INTEGER, &fast },
|
||||||
{ "managed", INTEGER, &managed },
|
{ "managed", INTEGER, &managed },
|
||||||
|
|
|
@ -24,6 +24,7 @@ static int imageheight = 86; /* Default image height */
|
||||||
static int imagegaps = 0; /* Image gaps */
|
static int imagegaps = 0; /* Image gaps */
|
||||||
static int imageposition = 0; /* Image position (0: Top, 1: Bottom, 2: Center, 3: Top center) */
|
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 generatecache = 1; /* Generate image cache by default */
|
||||||
|
static int maxcache = 512; /* Max image size to cache */
|
||||||
|
|
||||||
/* Mode options */
|
/* Mode options */
|
||||||
static int mode = 0; /* Mode to start speedwm in (0: Normal mode, 1: Insert mode) */
|
static int mode = 0; /* Mode to start speedwm in (0: Normal mode, 1: Insert mode) */
|
||||||
|
|
11
spmenu.1
11
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
|
.\" Define V font for inline verbatim, using C font in formats
|
||||||
.\" that render this, and otherwise B font.
|
.\" that render this, and otherwise B font.
|
||||||
|
@ -65,6 +65,9 @@ Generate image cache
|
||||||
\f[V]-ngc, --no-generate-cache\f[R]
|
\f[V]-ngc, --no-generate-cache\f[R]
|
||||||
Don\[cq]t generate image cache
|
Don\[cq]t generate image cache
|
||||||
.TP
|
.TP
|
||||||
|
\f[V]-mc, --max-cache size\f[R]
|
||||||
|
Set max image cache size to size
|
||||||
|
.TP
|
||||||
\f[V]-rw, --relative-width\f[R]
|
\f[V]-rw, --relative-width\f[R]
|
||||||
Enable relative input width
|
Enable relative input width
|
||||||
.TP
|
.TP
|
||||||
|
@ -174,6 +177,9 @@ Hide right arrow
|
||||||
\f[V]-hpr, --hide-prompt\f[R]
|
\f[V]-hpr, --hide-prompt\f[R]
|
||||||
Hide prompt
|
Hide prompt
|
||||||
.TP
|
.TP
|
||||||
|
\f[V]-hpl, --hide-powerline\f[R]
|
||||||
|
Hide powerline
|
||||||
|
.TP
|
||||||
\f[V]-hc, --hide-cursor\f[R]
|
\f[V]-hc, --hide-cursor\f[R]
|
||||||
Hide cursor
|
Hide cursor
|
||||||
.TP
|
.TP
|
||||||
|
@ -198,6 +204,9 @@ Show right arrow
|
||||||
\f[V]-spr, --show-prompt\f[R]
|
\f[V]-spr, --show-prompt\f[R]
|
||||||
Show prompt
|
Show prompt
|
||||||
.TP
|
.TP
|
||||||
|
\f[V]-spl, --show-powerline\f[R]
|
||||||
|
Show powerline
|
||||||
|
.TP
|
||||||
\f[V]-sc, --show-cursor\f[R]
|
\f[V]-sc, --show-cursor\f[R]
|
||||||
Show cursor
|
Show cursor
|
||||||
.TP
|
.TP
|
||||||
|
|
Loading…
Reference in a new issue