forked from speedie/spmenu
add incremental as well, this should now include most suckless patches people use
This commit is contained in:
parent
5ff1abc849
commit
442c40b732
|
@ -63,6 +63,12 @@ You may use long, descriptive arguments or the shorter arguments.
|
|||
`-f, --fast`
|
||||
: Grabs keyboard before reading stdin
|
||||
|
||||
`-r, --incremental`
|
||||
: Print text every time a key is pressed
|
||||
|
||||
`-nr, --no-incremental`
|
||||
: Don't print text every time a key is pressed
|
||||
|
||||
`-F, --fuzzy`
|
||||
: Enable fuzzy matching
|
||||
|
||||
|
|
|
@ -143,6 +143,7 @@ spmenu.fast: 0
|
|||
spmenu.managed: 0
|
||||
spmenu.mon: -1
|
||||
spmenu.printindex: 0
|
||||
spmenu.incremental: 0
|
||||
spmenu.coloritems: 1
|
||||
spmenu.sgr: 1
|
||||
|
||||
|
|
|
@ -201,6 +201,7 @@ spmenu = {
|
|||
|
||||
/* Output options */
|
||||
output = ( { printindex = 0; // Print index instead of actual text (0/1)
|
||||
incremental = 0; // Print text on every keypress (0/1)
|
||||
} );
|
||||
|
||||
/* Mode options */
|
||||
|
|
|
@ -86,6 +86,10 @@ void readargs(int argc, char *argv[]) {
|
|||
mode = 1;
|
||||
} else if (!strcmp(argv[i], "-f") || (!strcmp(argv[i], "--fast"))) { // grabs keyboard before reading stdin
|
||||
fast = 1;
|
||||
} else if (!strcmp(argv[i], "-r") || (!strcmp(argv[i], "--incremental"))) { // incremental
|
||||
incremental = 1;
|
||||
} else if (!strcmp(argv[i], "-nr") || (!strcmp(argv[i], "--no-incremental"))) { // no incremental
|
||||
incremental = 0;
|
||||
} else if (!strcmp(argv[i], "-rw") || (!strcmp(argv[i], "--relative-width"))) { // relative width
|
||||
accuratewidth = 1;
|
||||
} else if (!strcmp(argv[i], "-nrw") || (!strcmp(argv[i], "--no-relative-width"))) { // no relative width
|
||||
|
@ -455,6 +459,8 @@ void usage(void) {
|
|||
"spmenu -ix, --print-index Print index instead of actual text\n"
|
||||
"spmenu -nix, --no-print-index Don't print index instead of actual text\n"
|
||||
"spmenu -f, --fast Grabs keyboard before reading stdin\n"
|
||||
"spmenu -r, --incremental Print text every time a key is pressed\n"
|
||||
"spmenu -nr, --no-incremental Don't print text every time a key is pressed\n"
|
||||
"spmenu -F, --fuzzy Enable fuzzy matching\n"
|
||||
"spmenu -NF, --no-fuzzy Disable fuzzy matching\n"
|
||||
"spmenu -P, --password Hide characters\n"
|
||||
|
|
|
@ -408,6 +408,7 @@ void conf_init(void) {
|
|||
|
||||
// look up
|
||||
config_setting_lookup_int(conf, "printindex", &printindex); // spmenu.output.printindex
|
||||
config_setting_lookup_int(conf, "incremental", &incremental); // spmenu.output.incremental
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,11 @@ void eventloop(void) {
|
|||
grabfocus();
|
||||
break;
|
||||
case KeyPress: // read key array and call functions
|
||||
if (incremental) {
|
||||
puts(text);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
keypress(&ev);
|
||||
break;
|
||||
case SelectionNotify: // paste selection
|
||||
|
|
|
@ -147,6 +147,7 @@ ResourcePref resources[] = {
|
|||
{ "mon", INTEGER, &mon },
|
||||
{ "sortmatches", INTEGER, &sortmatches },
|
||||
{ "printindex", INTEGER, &printindex },
|
||||
{ "incremental", INTEGER, &incremental },
|
||||
{ "fuzzy", INTEGER, &fuzzy },
|
||||
{ "pango_item", INTEGER, &pango_item },
|
||||
{ "pango_prompt", INTEGER, &pango_prompt },
|
||||
|
|
|
@ -226,6 +226,7 @@ static int pango_password = 0; /* Enable support for pango markup f
|
|||
|
||||
/* Misc */
|
||||
static int printindex = 0; /* Print index instead of the text itself (0/1) */
|
||||
static int incremental = 0; /* Print text every time a key is pressed (0/1) */
|
||||
static int coloritems = 1; /* Color items (0/1) */
|
||||
static int sgr = 1; /* Support SGR sequences (0/1) */
|
||||
static char *worddelimiters = " "; /* Word delimiters used for keybinds that change words, Space is default. */
|
||||
|
|
6
spmenu.1
6
spmenu.1
|
@ -83,6 +83,12 @@ Don\[cq]t print index instead of actual text
|
|||
\f[V]-f, --fast\f[R]
|
||||
Grabs keyboard before reading stdin
|
||||
.TP
|
||||
\f[V]-r, --incremental\f[R]
|
||||
Print text every time a key is pressed
|
||||
.TP
|
||||
\f[V]-nr, --no-incremental\f[R]
|
||||
Don\[cq]t print text every time a key is pressed
|
||||
.TP
|
||||
\f[V]-F, --fuzzy\f[R]
|
||||
Enable fuzzy matching
|
||||
.TP
|
||||
|
|
|
@ -235,6 +235,14 @@ Don’t print index instead of actual text
|
|||
<dd>
|
||||
Grabs keyboard before reading stdin
|
||||
</dd>
|
||||
<dt><code>-r, --incremental</code></dt>
|
||||
<dd>
|
||||
Print text every time a key is pressed
|
||||
</dd>
|
||||
<dt><code>-nr, --no-incremental</code></dt>
|
||||
<dd>
|
||||
Don’t print text every time a key is pressed
|
||||
</dd>
|
||||
<dt><code>-F, --fuzzy</code></dt>
|
||||
<dd>
|
||||
Enable fuzzy matching
|
||||
|
|
Loading…
Reference in a new issue