add option to not allow selecting multiple items to spmenu itself
This commit is contained in:
parent
5aeea3230b
commit
620cb0ca63
|
@ -81,6 +81,12 @@ You may use long, descriptive arguments or the shorter arguments.
|
||||||
`-nrm, --no-require-match`
|
`-nrm, --no-require-match`
|
||||||
: Don't require that input text matches an item
|
: Don't require that input text matches an item
|
||||||
|
|
||||||
|
`-ma, --mark-items`
|
||||||
|
: Allow marking/selecting multiple items
|
||||||
|
|
||||||
|
`-nma, --no-mark-items`
|
||||||
|
: Don't allow marking/selecting multiple items
|
||||||
|
|
||||||
`-F, --fuzzy`
|
`-F, --fuzzy`
|
||||||
: Enable fuzzy matching
|
: Enable fuzzy matching
|
||||||
|
|
||||||
|
@ -349,6 +355,9 @@ You may use long, descriptive arguments or the shorter arguments.
|
||||||
`-v, --version`
|
`-v, --version`
|
||||||
: Print spmenu version to stdout
|
: Print spmenu version to stdout
|
||||||
|
|
||||||
|
`-rv, --raw-version`
|
||||||
|
: Print raw spmenu version number to stdout
|
||||||
|
|
||||||
`-fn, --font font`
|
`-fn, --font font`
|
||||||
: Set the spmenu font to font
|
: Set the spmenu font to font
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,7 @@ spmenu.type: 1
|
||||||
spmenu.passwd: 0
|
spmenu.passwd: 0
|
||||||
spmenu.fuzzy: 1
|
spmenu.fuzzy: 1
|
||||||
spmenu.sortmatches: 1
|
spmenu.sortmatches: 1
|
||||||
|
spmenu.mark: 1
|
||||||
spmenu.casesensitive: 0
|
spmenu.casesensitive: 0
|
||||||
|
|
||||||
!! Menu
|
!! Menu
|
||||||
|
|
|
@ -166,6 +166,7 @@ spmenu = {
|
||||||
casesensitive = 0; // Enable case sensitivity when matching (0/1)
|
casesensitive = 0; // Enable case sensitivity when matching (0/1)
|
||||||
fuzzy = 1; // Enable fuzzy finding (0/1)
|
fuzzy = 1; // Enable fuzzy finding (0/1)
|
||||||
preselected = 0; // Preselect an item, 0 is the first item (number)
|
preselected = 0; // Preselect an item, 0 is the first item (number)
|
||||||
|
mark = 1; // Allow marking/selecting multiple items (0/1)
|
||||||
accuratewidth = 0; // Enable accurate width, could be noticeably slower in some cases (0/1)
|
accuratewidth = 0; // Enable accurate width, could be noticeably slower in some cases (0/1)
|
||||||
delimiters = " "; // Word delimiter, used to delete words (text)
|
delimiters = " "; // Word delimiter, used to delete words (text)
|
||||||
listfile = "NULL"; // File to read entries from. If set to NULL standard input is read. This is read every time a key is pressed. (text)
|
listfile = "NULL"; // File to read entries from. If set to NULL standard input is read. This is read every time a key is pressed. (text)
|
||||||
|
|
|
@ -241,6 +241,7 @@ void backspace(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void markitem(Arg *arg) {
|
void markitem(Arg *arg) {
|
||||||
|
if (!mark) return;
|
||||||
if (sel && is_selected(sel->index)) {
|
if (sel && is_selected(sel->index)) {
|
||||||
for (int i = 0; i < sel_size; i++) {
|
for (int i = 0; i < sel_size; i++) {
|
||||||
if (sel_index[i] == sel->index) {
|
if (sel_index[i] == sel->index) {
|
||||||
|
|
12
libs/argv.c
12
libs/argv.c
|
@ -65,6 +65,9 @@ void readargs(int argc, char *argv[]) {
|
||||||
if (!strcmp(argv[i], "-v") || (!strcmp(argv[i], "--version"))) { // prints version information
|
if (!strcmp(argv[i], "-v") || (!strcmp(argv[i], "--version"))) { // prints version information
|
||||||
puts("spmenu-"VERSION);
|
puts("spmenu-"VERSION);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
} else if (!strcmp(argv[i], "-rv") || (!strcmp(argv[i], "--raw-version"))) { // help
|
||||||
|
puts(VERSION);
|
||||||
|
exit(0);
|
||||||
} else if (!strcmp(argv[i], "-h") || (!strcmp(argv[i], "--help"))) { // help
|
} else if (!strcmp(argv[i], "-h") || (!strcmp(argv[i], "--help"))) { // help
|
||||||
usage(0);
|
usage(0);
|
||||||
} else if (!strcmp(argv[i], "-it") || (!strcmp(argv[i], "--image-top"))) { // image: top
|
} else if (!strcmp(argv[i], "-it") || (!strcmp(argv[i], "--image-top"))) { // image: top
|
||||||
|
@ -93,8 +96,12 @@ void readargs(int argc, char *argv[]) {
|
||||||
incremental = 0;
|
incremental = 0;
|
||||||
} else if (!strcmp(argv[i], "-rm") || (!strcmp(argv[i], "--require-match"))) { // require match
|
} else if (!strcmp(argv[i], "-rm") || (!strcmp(argv[i], "--require-match"))) { // require match
|
||||||
requirematch = 1;
|
requirematch = 1;
|
||||||
} else if (!strcmp(argv[i], "-nrm") || (!strcmp(argv[i], "--no-require-match"))) { // no incremental
|
} else if (!strcmp(argv[i], "-nrm") || (!strcmp(argv[i], "--no-require-match"))) { // no require match
|
||||||
requirematch = 0;
|
requirematch = 0;
|
||||||
|
} else if (!strcmp(argv[i], "-ma") || (!strcmp(argv[i], "--mark-items"))) { // allow marking items
|
||||||
|
mark = 1;
|
||||||
|
} else if (!strcmp(argv[i], "-nma") || (!strcmp(argv[i], "--no-mark-items"))) { // don't allow marking items
|
||||||
|
mark = 0;
|
||||||
} else if (!strcmp(argv[i], "-rw") || (!strcmp(argv[i], "--relative-width"))) { // relative width
|
} else if (!strcmp(argv[i], "-rw") || (!strcmp(argv[i], "--relative-width"))) { // relative width
|
||||||
accuratewidth = 1;
|
accuratewidth = 1;
|
||||||
} else if (!strcmp(argv[i], "-nrw") || (!strcmp(argv[i], "--no-relative-width"))) { // no relative width
|
} else if (!strcmp(argv[i], "-nrw") || (!strcmp(argv[i], "--no-relative-width"))) { // no relative width
|
||||||
|
@ -482,6 +489,8 @@ void usage(int status) {
|
||||||
"spmenu -nr, --no-incremental Don't 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 -rm, --require-match Require that input text matches an item\n"
|
"spmenu -rm, --require-match Require that input text matches an item\n"
|
||||||
"spmenu -nrm, --no-require-match Don't require that input text matches an item\n"
|
"spmenu -nrm, --no-require-match Don't require that input text matches an item\n"
|
||||||
|
"spmenu -ma, --mark-items Allow marking/selecting multiple items\n"
|
||||||
|
"spmenu -nma, --no-mark-items Don't allow marking/selecting multiple items\n"
|
||||||
"spmenu -F, --fuzzy Enable fuzzy matching\n"
|
"spmenu -F, --fuzzy Enable fuzzy matching\n"
|
||||||
"spmenu -NF, --no-fuzzy Disable fuzzy matching\n"
|
"spmenu -NF, --no-fuzzy Disable fuzzy matching\n"
|
||||||
"spmenu -P, --password Hide characters\n"
|
"spmenu -P, --password Hide characters\n"
|
||||||
|
@ -578,6 +587,7 @@ void usage(int status) {
|
||||||
"spmenu -tm, --theme <theme> Load theme <theme>\n"
|
"spmenu -tm, --theme <theme> Load theme <theme>\n"
|
||||||
"spmenu -ltm, --load-theme Load theme\n"
|
"spmenu -ltm, --load-theme Load theme\n"
|
||||||
"spmenu -nltm, --no-load-theme Don't load theme\n"
|
"spmenu -nltm, --no-load-theme Don't load theme\n"
|
||||||
|
"spmenu -rv, --raw-version Print spmenu version number to stdout\n"
|
||||||
"spmenu -v, --version Print spmenu version to stdout\n"
|
"spmenu -v, --version Print spmenu version to stdout\n"
|
||||||
"\n", status ? stderr : stdout);
|
"\n", status ? stderr : stdout);
|
||||||
|
|
||||||
|
|
|
@ -476,6 +476,7 @@ void conf_init(void) {
|
||||||
config_setting_lookup_int(conf, "casesensitive", &casesensitive); // spmenu.match.casesensitive
|
config_setting_lookup_int(conf, "casesensitive", &casesensitive); // spmenu.match.casesensitive
|
||||||
config_setting_lookup_int(conf, "fuzzy", &fuzzy); // spmenu.match.fuzzy
|
config_setting_lookup_int(conf, "fuzzy", &fuzzy); // spmenu.match.fuzzy
|
||||||
config_setting_lookup_int(conf, "preselected", &preselected); // spmenu.match.preselected
|
config_setting_lookup_int(conf, "preselected", &preselected); // spmenu.match.preselected
|
||||||
|
config_setting_lookup_int(conf, "mark", &mark); // spmenu.match.mark
|
||||||
config_setting_lookup_int(conf, "accuratewidth", &accuratewidth); // spmenu.match.accuratewidth
|
config_setting_lookup_int(conf, "accuratewidth", &accuratewidth); // spmenu.match.accuratewidth
|
||||||
config_setting_lookup_string(conf, "delimiters", &dest); // spmenu.match.delimiters
|
config_setting_lookup_string(conf, "delimiters", &dest); // spmenu.match.delimiters
|
||||||
worddelimiters = strdup(dest);
|
worddelimiters = strdup(dest);
|
||||||
|
|
|
@ -155,6 +155,7 @@ ResourcePref resources[] = {
|
||||||
{ "mode", INTEGER, &mode },
|
{ "mode", INTEGER, &mode },
|
||||||
{ "fast", INTEGER, &fast },
|
{ "fast", INTEGER, &fast },
|
||||||
{ "managed", INTEGER, &managed },
|
{ "managed", INTEGER, &managed },
|
||||||
|
{ "mark", INTEGER, &mark },
|
||||||
{ "mon", INTEGER, &mon },
|
{ "mon", INTEGER, &mon },
|
||||||
{ "sortmatches", INTEGER, &sortmatches },
|
{ "sortmatches", INTEGER, &sortmatches },
|
||||||
{ "printindex", INTEGER, &printindex },
|
{ "printindex", INTEGER, &printindex },
|
||||||
|
|
|
@ -77,6 +77,7 @@ static int type = 1; /* Allow typing into spmenu or only
|
||||||
static int passwd = 0; /* Replace input with another character and don't read stdin */
|
static int passwd = 0; /* Replace input with another character and don't read stdin */
|
||||||
static int sortmatches = 1; /* Sort matches (0/1) */
|
static int sortmatches = 1; /* Sort matches (0/1) */
|
||||||
static int casesensitive = 0; /* Case-sensitive by default? (0/1) */
|
static int casesensitive = 0; /* Case-sensitive by default? (0/1) */
|
||||||
|
static int mark = 1; /* Enable marking items (multi selection) (0/1) */
|
||||||
static int preselected = 0; /* Which line should spmenu preselect? */
|
static int preselected = 0; /* Which line should spmenu preselect? */
|
||||||
static int accuratewidth = 0; /* Enable accurate width. May have a performance hit if you are matching a lot of items at once */
|
static int accuratewidth = 0; /* Enable accurate width. May have a performance hit if you are matching a lot of items at once */
|
||||||
static int fuzzy = 1; /* Whether or not to enable fuzzy matching by default */
|
static int fuzzy = 1; /* Whether or not to enable fuzzy matching by default */
|
||||||
|
|
Loading…
Reference in a new issue