forked from speedie/spmenu
add arguments and xresources values
This commit is contained in:
parent
abe10f04b5
commit
c02fe163a5
|
@ -57,3 +57,7 @@ spmenu.leftarrow: <
|
||||||
spmenu.rightarrow: >
|
spmenu.rightarrow: >
|
||||||
spmenu.hidematchcount: 0
|
spmenu.hidematchcount: 0
|
||||||
spmenu.hidehighlight: 0
|
spmenu.hidehighlight: 0
|
||||||
|
spmenu.imagesize: 86
|
||||||
|
spmenu.imagegaps: 0
|
||||||
|
spmenu.imageposition: 0
|
||||||
|
spmenu.generatecache: 0
|
||||||
|
|
|
@ -16,8 +16,12 @@ static int minwidth = 500; /* Minimum width */
|
||||||
static int centered = 0; /* Whether or not to center spmenu by default */
|
static int centered = 0; /* Whether or not to center spmenu by default */
|
||||||
|
|
||||||
/* Image options */
|
/* Image options */
|
||||||
|
static int imagesize = 86; /* Default image size */
|
||||||
|
static int imagegaps = 0; /* Image gaps */
|
||||||
|
static int imageposition = 0; /* Image position (0: Top, 1: Bottom, 2: Center, 3: Top center) */
|
||||||
static int generatecache = 0; /* Generate image cache by default */
|
static int generatecache = 0; /* Generate image cache by default */
|
||||||
|
|
||||||
|
/* Color support */
|
||||||
static int colorsupport = 1; /* Support 256 colors? Otherwise the default 16 colors will be used. */
|
static int colorsupport = 1; /* Support 256 colors? Otherwise the default 16 colors will be used. */
|
||||||
|
|
||||||
/* Window border options */
|
/* Window border options */
|
||||||
|
|
32
spmenu.c
32
spmenu.c
|
@ -108,7 +108,6 @@ typedef struct {
|
||||||
} Key;
|
} Key;
|
||||||
|
|
||||||
#if USEIMAGE
|
#if USEIMAGE
|
||||||
static int imagesize = 86;
|
|
||||||
static Imlib_Image image = NULL;
|
static Imlib_Image image = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -647,7 +646,7 @@ drawmenu(void)
|
||||||
if (lines > 0) {
|
if (lines > 0) {
|
||||||
#if USEIMAGE
|
#if USEIMAGE
|
||||||
if (imagesize)
|
if (imagesize)
|
||||||
x += 4 + imagesize;
|
x += imagegaps + imagesize;
|
||||||
#endif
|
#endif
|
||||||
/* draw grid */
|
/* draw grid */
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -1731,7 +1730,19 @@ run(void)
|
||||||
imlib_free_image();
|
imlib_free_image();
|
||||||
image = NULL;
|
image = NULL;
|
||||||
} if (image && imagesize) {
|
} if (image && imagesize) {
|
||||||
imlib_render_image_on_drawable(imagesize-width, (imagesize-height)/2+bh);
|
int leftmargin = imagegaps;
|
||||||
|
|
||||||
|
if (!imageposition) { /* top mode = 0 */
|
||||||
|
imlib_render_image_on_drawable(leftmargin+(imagesize-width)/2, bh+imagegaps);
|
||||||
|
} else if (imageposition == 1) { /* bottom mode = 1 */
|
||||||
|
imlib_render_image_on_drawable(leftmargin+(imagesize-width)/2, mh-height-imagegaps);
|
||||||
|
} else if (imageposition == 2) { /* center mode = 2 */
|
||||||
|
imlib_render_image_on_drawable(leftmargin+(imagesize-width)/2, (mh-bh-height)/2+bh);
|
||||||
|
} else {
|
||||||
|
int minh = MIN(imagesize, mh-bh-imagegaps*2);
|
||||||
|
imlib_render_image_on_drawable(leftmargin+(imagesize-width)/2, (minh-height)/2+bh+imagegaps);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} if (sel) {
|
} if (sel) {
|
||||||
limg = sel->image;
|
limg = sel->image;
|
||||||
|
@ -2011,11 +2022,16 @@ usage(void)
|
||||||
"spmenu -m <monitor> Specify a monitor to run spmenu on\n"
|
"spmenu -m <monitor> Specify a monitor to run spmenu on\n"
|
||||||
"spmenu -w <window id> Embed spmenu inside <window id>\n"
|
"spmenu -w <window id> Embed spmenu inside <window id>\n"
|
||||||
"spmenu -H <hist file> Specify a path to save the history to\n"
|
"spmenu -H <hist file> Specify a path to save the history to\n"
|
||||||
|
"spmenu -ig <gaps> Set image gaps to <gaps>\n"
|
||||||
"spmenu -lp <padding> Set the vertical padding\n"
|
"spmenu -lp <padding> Set the vertical padding\n"
|
||||||
"spmenu -hp <padding> Set the horizontal padding\n"
|
"spmenu -hp <padding> Set the horizontal padding\n"
|
||||||
"spmenu -la <symbol> Set the left arrow to <symbol>\n"
|
"spmenu -la <symbol> Set the left arrow to <symbol>\n"
|
||||||
"spmenu -ra <symbol> Set the right arrow to <symbol>\n"
|
"spmenu -ra <symbol> Set the right arrow to <symbol>\n"
|
||||||
"spmenu -is <size> Image size\n"
|
"spmenu -is <size> Image size\n"
|
||||||
|
"spmenu -it Position the image at the top\n"
|
||||||
|
"spmenu -ib Position the image at the bottom\n"
|
||||||
|
"spmenu -ic Position the image in the center\n"
|
||||||
|
"spmenu -itc Position the image in the top center\n"
|
||||||
"spmenu -wm Spawn spmenu as a window manager controlled client/window. Useful for testing\n"
|
"spmenu -wm Spawn spmenu as a window manager controlled client/window. Useful for testing\n"
|
||||||
"spmenu -v Print spmenu version to stdout\n"
|
"spmenu -v Print spmenu version to stdout\n"
|
||||||
"\n", stdout);
|
"\n", stdout);
|
||||||
|
@ -2102,6 +2118,14 @@ main(int argc, char *argv[])
|
||||||
if (!strcmp(argv[i], "-v")) { /* prints version information */
|
if (!strcmp(argv[i], "-v")) { /* prints version information */
|
||||||
puts("spmenu-"VERSION);
|
puts("spmenu-"VERSION);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
} else if (!strcmp(argv[i], "-it")) { /* image: top */
|
||||||
|
imageposition = 0;
|
||||||
|
} else if (!strcmp(argv[i], "-ib")) { /* image: bottom */
|
||||||
|
imageposition = 1;
|
||||||
|
} else if (!strcmp(argv[i], "-ic")) { /* image: center */
|
||||||
|
imageposition = 2;
|
||||||
|
} else if (!strcmp(argv[i], "-itc")) { /* image: top center */
|
||||||
|
imageposition = 3;
|
||||||
} else if (!strcmp(argv[i], "-b")) { /* appears at the bottom of the screen */
|
} else if (!strcmp(argv[i], "-b")) { /* appears at the bottom of the screen */
|
||||||
menuposition = 0;
|
menuposition = 0;
|
||||||
} else if (!strcmp(argv[i], "-t")) { /* appears at the top of the screen */
|
} else if (!strcmp(argv[i], "-t")) { /* appears at the top of the screen */
|
||||||
|
@ -2164,6 +2188,8 @@ main(int argc, char *argv[])
|
||||||
menupaddingv = atoi(argv[++i]);
|
menupaddingv = atoi(argv[++i]);
|
||||||
} else if (!strcmp(argv[i], "-hp")) {
|
} else if (!strcmp(argv[i], "-hp")) {
|
||||||
menupaddingh = atoi(argv[++i]);
|
menupaddingh = atoi(argv[++i]);
|
||||||
|
} else if (!strcmp(argv[i], "-ig")) {
|
||||||
|
imagegaps = atoi(argv[++i]);
|
||||||
} else if (!strcmp(argv[i], "-la")) {
|
} else if (!strcmp(argv[i], "-la")) {
|
||||||
leftarrow = argv[++i];
|
leftarrow = argv[++i];
|
||||||
} else if (!strcmp(argv[i], "-ra")) {
|
} else if (!strcmp(argv[i], "-ra")) {
|
||||||
|
|
|
@ -108,4 +108,8 @@ ResourcePref resources[] = {
|
||||||
{ "hidehighlight", INTEGER, &hidehighlight },
|
{ "hidehighlight", INTEGER, &hidehighlight },
|
||||||
{ "histnodup", INTEGER, &histnodup },
|
{ "histnodup", INTEGER, &histnodup },
|
||||||
{ "casesensitive", INTEGER, &casesensitive },
|
{ "casesensitive", INTEGER, &casesensitive },
|
||||||
|
{ "imagesize", INTEGER, &imagesize },
|
||||||
|
{ "imagegaps", INTEGER, &imagegaps },
|
||||||
|
{ "imageposition", INTEGER, &imageposition },
|
||||||
|
{ "generatecache", INTEGER, &generatecache },
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue