add some arguments for the mode feature
This commit is contained in:
parent
b94365f88c
commit
2d4b2fb00f
|
@ -64,3 +64,6 @@ spmenu.imagesize: 86
|
|||
spmenu.imagegaps: 0
|
||||
spmenu.imageposition: 0
|
||||
spmenu.generatecache: 0
|
||||
spmenu.mode: 1
|
||||
spmenu.normtext: Normal
|
||||
spmenu.instext: Insert
|
||||
|
|
|
@ -5,9 +5,9 @@ switchmode(const Arg *arg)
|
|||
allowkeys = !selkeys;
|
||||
|
||||
if (!selkeys) {
|
||||
strcpy(modetext, "Normal");
|
||||
strcpy(modetext, normtext);
|
||||
} else {
|
||||
strcpy(modetext, "Insert");
|
||||
strcpy(modetext, instext);
|
||||
}
|
||||
|
||||
if (hidemode) strcpy(modetext, "");
|
||||
|
|
|
@ -21,6 +21,11 @@ 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 */
|
||||
|
||||
/* Mode options */
|
||||
static int mode = 1; /* Mode to start speedwm in (0: Normal mode, 1: Insert mode) */
|
||||
static char normtext[] = "Normal"; /* Text to display for normal mode */
|
||||
static char instext[] = "Insert"; /* Text to display for insert mode */
|
||||
|
||||
/* Color support */
|
||||
static int colorsupport = 1; /* Support 256 colors? Otherwise the default 16 colors will be used. */
|
||||
|
||||
|
|
26
spmenu.c
26
spmenu.c
|
@ -1761,9 +1761,13 @@ usage(void)
|
|||
"spmenu -y <y offset> Offset spmenu y position by <y offset>\n"
|
||||
"spmenu -n <line> Preselect <line> in the list of items\n"
|
||||
"spmenu -z <width> Width of the spmenu window\n"
|
||||
"spmenu -nmt <text> Set normal mode text to <text>\n"
|
||||
"spmenu -imt <text> Set insert mode text to <text>\n"
|
||||
"spmenu -bw Width of the border. 0 will disable the border\n"
|
||||
"spmenu -s Use case-sensitive matching\n"
|
||||
"spmenu -i Use case-insensitive matching\n"
|
||||
"spmenu -nm Start spmenu in normal mode\n"
|
||||
"spmenu -im Start spmenu in insert mode\n"
|
||||
"spmenu -t Position spmenu at the top of the screen\n"
|
||||
"spmenu -b Position spmenu at the bottom of the screen\n"
|
||||
"spmenu -c Position spmenu at the center of the screen\n"
|
||||
|
@ -1886,6 +1890,10 @@ main(int argc, char *argv[])
|
|||
menuposition = 0;
|
||||
} else if (!strcmp(argv[i], "-t")) { /* appears at the top of the screen */
|
||||
menuposition = 1;
|
||||
} else if (!strcmp(argv[i], "-nm")) { /* normal mode */
|
||||
mode = 0;
|
||||
} else if (!strcmp(argv[i], "-im")) { /* insert mode */
|
||||
mode = 1;
|
||||
} else if (!strcmp(argv[i], "-c")) { /* appears at the center of the screen */
|
||||
centered = 1;
|
||||
} else if (!strcmp(argv[i], "-f")) { /* grabs keyboard before reading stdin */
|
||||
|
@ -1969,8 +1977,12 @@ main(int argc, char *argv[])
|
|||
dmw = atoi(argv[++i]);
|
||||
else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
|
||||
prompt = argv[++i];
|
||||
else if (!strcmp(argv[i], "-fn")) { /* font or font set */
|
||||
else if (!strcmp(argv[i], "-fn")) /* font or font set */
|
||||
strcpy(font, argv[++i]); /* font[0] = argv[++i]; */
|
||||
else if (!strcmp(argv[i], "-nmt")) /* normal mode text */
|
||||
strcpy(normtext, argv[++i]);
|
||||
else if (!strcmp(argv[i], "-imt")) { /* insert mode text */
|
||||
strcpy(instext, argv[++i]);
|
||||
|
||||
/* dmenu compatibility options */
|
||||
} else if (!strcmp(argv[i], "-nb")) { /* normal background color */
|
||||
|
@ -2071,6 +2083,18 @@ main(int argc, char *argv[])
|
|||
else
|
||||
usage();
|
||||
|
||||
if (mode) {
|
||||
selkeys = 1;
|
||||
allowkeys = !selkeys;
|
||||
|
||||
strcpy(modetext, instext);
|
||||
} else {
|
||||
selkeys = 0;
|
||||
allowkeys = !selkeys;
|
||||
|
||||
strcpy(modetext, normtext);
|
||||
}
|
||||
|
||||
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||
fputs("warning: no locale support\n", stderr);
|
||||
if (!(dpy = XOpenDisplay(NULL)))
|
||||
|
|
|
@ -102,6 +102,8 @@ ResourcePref resources[] = {
|
|||
{ "class", STRING, &class },
|
||||
{ "leftarrow", STRING, &leftarrow },
|
||||
{ "rightarrow", STRING, &rightarrow },
|
||||
{ "normtext", STRING, &normtext },
|
||||
{ "instext", STRING, &instext },
|
||||
{ "bordercentered", INTEGER, &bordercentered },
|
||||
{ "borderwidth", INTEGER, &borderwidth },
|
||||
{ "lines", INTEGER, &lines },
|
||||
|
@ -117,4 +119,5 @@ ResourcePref resources[] = {
|
|||
{ "imagegaps", INTEGER, &imagegaps },
|
||||
{ "imageposition", INTEGER, &imageposition },
|
||||
{ "generatecache", INTEGER, &generatecache },
|
||||
{ "mode", INTEGER, &mode },
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue