diff --git a/docs/docs.md b/docs/docs.md index 0c705a3..ef815c6 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -81,6 +81,12 @@ You may use long, descriptive arguments or the shorter arguments. `-nrm, --no-require-match` : 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` : Enable fuzzy matching @@ -349,6 +355,9 @@ You may use long, descriptive arguments or the shorter arguments. `-v, --version` : Print spmenu version to stdout +`-rv, --raw-version` +: Print raw spmenu version number to stdout + `-fn, --font font` : Set the spmenu font to font diff --git a/docs/example.Xresources b/docs/example.Xresources index adcb08c..67405e4 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -128,6 +128,7 @@ spmenu.type: 1 spmenu.passwd: 0 spmenu.fuzzy: 1 spmenu.sortmatches: 1 +spmenu.mark: 1 spmenu.casesensitive: 0 !! Menu diff --git a/docs/spmenu.conf b/docs/spmenu.conf index 6793aa6..5fe5509 100644 --- a/docs/spmenu.conf +++ b/docs/spmenu.conf @@ -166,6 +166,7 @@ spmenu = { casesensitive = 0; // Enable case sensitivity when matching (0/1) fuzzy = 1; // Enable fuzzy finding (0/1) 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) 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) diff --git a/libs/arg.c b/libs/arg.c index 621b10d..97dc254 100644 --- a/libs/arg.c +++ b/libs/arg.c @@ -241,6 +241,7 @@ void backspace(Arg *arg) { } void markitem(Arg *arg) { + if (!mark) return; if (sel && is_selected(sel->index)) { for (int i = 0; i < sel_size; i++) { if (sel_index[i] == sel->index) { diff --git a/libs/argv.c b/libs/argv.c index 33d3f25..bc23101 100644 --- a/libs/argv.c +++ b/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 puts("spmenu-"VERSION); 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 usage(0); } 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; } else if (!strcmp(argv[i], "-rm") || (!strcmp(argv[i], "--require-match"))) { // require match 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; + } 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 accuratewidth = 1; } 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 -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 -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 -NF, --no-fuzzy Disable fuzzy matching\n" "spmenu -P, --password Hide characters\n" @@ -578,6 +587,7 @@ void usage(int status) { "spmenu -tm, --theme Load theme \n" "spmenu -ltm, --load-theme 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" "\n", status ? stderr : stdout); diff --git a/libs/conf/config.c b/libs/conf/config.c index ab5d1aa..dbf9cdf 100644 --- a/libs/conf/config.c +++ b/libs/conf/config.c @@ -476,6 +476,7 @@ void conf_init(void) { 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, "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_string(conf, "delimiters", &dest); // spmenu.match.delimiters worddelimiters = strdup(dest); diff --git a/libs/xresources.h b/libs/xresources.h index b13f254..ea15279 100644 --- a/libs/xresources.h +++ b/libs/xresources.h @@ -155,6 +155,7 @@ ResourcePref resources[] = { { "mode", INTEGER, &mode }, { "fast", INTEGER, &fast }, { "managed", INTEGER, &managed }, + { "mark", INTEGER, &mark }, { "mon", INTEGER, &mon }, { "sortmatches", INTEGER, &sortmatches }, { "printindex", INTEGER, &printindex }, diff --git a/options.h b/options.h index 77ca071..bc98e61 100644 --- a/options.h +++ b/options.h @@ -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 sortmatches = 1; /* Sort matches (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 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 */