add long arguments

This commit is contained in:
speedie 2023-03-17 13:51:11 +01:00
parent 4302897f2a
commit a626e946be
3 changed files with 129 additions and 121 deletions

View file

@ -29,7 +29,7 @@ See a list below for a list.
## Arguments ## Arguments
- spmenu -l line - Set line count to stdin - spmenu -l line - Set line count to stdin
- spmenu -mh height - Set spmenu line height to height - spmenu -mh height - Set spmenu line height to height
- spmenu -g grid - Set the number of grids to grid - spmenu -g grid - Set the number of grids to grid
- spmenu -gc - Generate image cache - spmenu -gc - Generate image cache
- spmenu -ngc - Don't generate image cache - spmenu -ngc - Don't generate image cache
@ -37,6 +37,7 @@ See a list below for a list.
- spmenu -nrw - Disable relative input width - spmenu -nrw - Disable relative input width
- spmenu -f - Grabs keyboard before reading stdin - spmenu -f - Grabs keyboard before reading stdin
- spmenu -F - Enable fuzzy matching - spmenu -F - Enable fuzzy matching
- spmenu -NF - Disable fuzzy matching
- spmenu -P - Hide characters - spmenu -P - Hide characters
- spmenu -Ps symbol - Set the password symbol to symbol - spmenu -Ps symbol - Set the password symbol to symbol
- spmenu -p text - Set spmenu prompt text to text - spmenu -p text - Set spmenu prompt text to text

View file

@ -35,109 +35,110 @@ readargs(int argc, char *argv[])
// no arguments // no arguments
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
if (!strcmp(argv[i], "-v")) { // 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], "-h")) { // help } else if (!strcmp(argv[i], "-h") || (!strcmp(argv[i], "--help"))) { // help
usage(); usage();
} else if (!strcmp(argv[i], "-it")) { // image: top } else if (!strcmp(argv[i], "-it") || (!strcmp(argv[i], "--image_top"))) { // image: top
imageposition = 0; imageposition = 0;
} else if (!strcmp(argv[i], "-ib")) { // image: bottom } else if (!strcmp(argv[i], "-ib") || (!strcmp(argv[i], "--image_bottom"))) { // image: bottom
imageposition = 1; imageposition = 1;
} else if (!strcmp(argv[i], "-ic")) { // image: center } else if (!strcmp(argv[i], "-ic") || (!strcmp(argv[i], "--image_center"))) { // image: center
imageposition = 2; imageposition = 2;
} else if (!strcmp(argv[i], "-itc")) { // image: top center } else if (!strcmp(argv[i], "-itc") || (!strcmp(argv[i], "--image_topcenter"))) { // image: top center
imageposition = 3; imageposition = 3;
} else if (!strcmp(argv[i], "-b")) { // appears at the bottom of the screen } else if (!strcmp(argv[i], "-b") || (!strcmp(argv[i], "--bottom"))) { // 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") || (!strcmp(argv[i], "--top"))) { // appears at the top of the screen
menuposition = 1; menuposition = 1;
} else if (!strcmp(argv[i], "-c")) { // appears at the center of the screen } else if (!strcmp(argv[i], "-c") || (!strcmp(argv[i], "--center"))) { // appears at the center of the screen
menuposition = 2; menuposition = 2;
} else if (!strcmp(argv[i], "-nm")) { // normal mode } else if (!strcmp(argv[i], "-nm") || (!strcmp(argv[i], "--normal"))) { // normal mode
mode = 0; mode = 0;
} else if (!strcmp(argv[i], "-im")) { // insert mode } else if (!strcmp(argv[i], "-im") || (!strcmp(argv[i], "--insert"))) { // insert mode
mode = 1; mode = 1;
} else if (!strcmp(argv[i], "-f")) { // grabs keyboard before reading stdin } else if (!strcmp(argv[i], "-f") || (!strcmp(argv[i], "--fast"))) { // grabs keyboard before reading stdin
fast = 1; fast = 1;
} else if (!strcmp(argv[i], "-rw")) { // 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")) { // no relative width } else if (!strcmp(argv[i], "-nrw") || (!strcmp(argv[i], "--no-relative-width"))) { // no relative width
accuratewidth = 0; accuratewidth = 0;
} else if (!strcmp(argv[i], "-xrdb")) { // xresources } else if (!strcmp(argv[i], "-xrdb") || (!strcmp(argv[i], "--xrdb"))) { // xresources
xresources = 1; xresources = 1;
} else if (!strcmp(argv[i], "-nxrdb")) { // no xresources } else if (!strcmp(argv[i], "-nxrdb") || (!strcmp(argv[i], "--no-xrdb"))) { // no xresources
xresources = 0; xresources = 0;
} else if (!strcmp(argv[i], "-F")) { // fuzzy matching } else if (!strcmp(argv[i], "-F") || (!strcmp(argv[i], "--fuzzy"))) { // fuzzy matching
fuzzy = 1;
} else if (!strcmp(argv[i], "-NF") || (!strcmp(argv[i], "--no-fuzzy"))) { // no fuzzy matching
fuzzy = 0; fuzzy = 0;
} else if (!strcmp(argv[i], "-s")) { // case-sensitive item matching } else if (!strcmp(argv[i], "-s") || (!strcmp(argv[i], "--case-sensitive")) || (!strcmp(argv[i], "--sensitive"))) { // case-sensitive item matching
casesensitive = 1; casesensitive = 1;
} else if (!strcmp(argv[i], "-ns")) { // case-insensitive item matching } else if (!strcmp(argv[i], "-ns") || (!strcmp(argv[i], "--case-insensitive")) || (!strcmp(argv[i], "--insensitive"))) { // case-insensitive item matching
casesensitive = 0; casesensitive = 0;
} else if (!strcmp(argv[i], "-S")) { // don't sort } else if (!strcmp(argv[i], "-nso") || (!strcmp(argv[i], "--no-sort"))) { // don't sort
sortmatches = 0; sortmatches = 0;
} else if (!strcmp(argv[i], "-nso")) { // don't sort } else if (!strcmp(argv[i], "-so") || (!strcmp(argv[i], "--sort"))) { // sort
sortmatches = 0;
} else if (!strcmp(argv[i], "-so")) { // don't sort
sortmatches = 1; sortmatches = 1;
} else if (!strcmp(argv[i], "-gc")) { // generate image cache } else if (!strcmp(argv[i], "-gc") || (!strcmp(argv[i], "--generate-cache"))) { // generate image cache
generatecache = 1; generatecache = 1;
} else if (!strcmp(argv[i], "-ngc")) { // don't generate image cache } else if (!strcmp(argv[i], "-ngc") || (!strcmp(argv[i], "--no-generate-cache"))) { // don't generate image cache
generatecache = 0; generatecache = 0;
} else if (!strcmp(argv[i], "-wm")) { // display as managed wm window } else if (!strcmp(argv[i], "-wm") || (!strcmp(argv[i], "--managed")) || (!strcmp(argv[i], "--x11-client"))) { // display as managed wm window
managed = 1; managed = 1;
} else if (!strcmp(argv[i], "-nwm")) { // don't display as managed wm window } else if (!strcmp(argv[i], "-nwm") || (!strcmp(argv[i], "--unmanaged"))) { // don't display as managed wm window
managed = 0; managed = 0;
} else if (!strcmp(argv[i], "-na")) { // disable alpha } else if (!strcmp(argv[i], "-na") || (!strcmp(argv[i], "--no-alpha"))) { // disable alpha
alpha = 0; alpha = 0;
} else if (!strcmp(argv[i], "-a")) { // alpha } else if (!strcmp(argv[i], "-a") || (!strcmp(argv[i], "--alpha"))) { // alpha
alpha = 1; alpha = 1;
} else if (!strcmp(argv[i], "-tp")) { // allow the user to type } else if (!strcmp(argv[i], "-tp") || (!strcmp(argv[i], "--allow-typing"))) { // allow the user to type
type = 1; type = 1;
} else if (!strcmp(argv[i], "-nt")) { // don't allow the user to type } else if (!strcmp(argv[i], "-nt") || (!strcmp(argv[i], "--no-allow-typing"))) { // don't allow the user to type
type = 0; type = 0;
} else if (!strcmp(argv[i], "-P")) { // is the input a password } else if (!strcmp(argv[i], "-P") || (!strcmp(argv[i], "--password"))) { // is the input a password
passwd = 1; passwd = 1;
} else if (!strcmp(argv[i], "-hmc")) { // hide match count } else if (!strcmp(argv[i], "-hmc") || (!strcmp(argv[i], "--hide-match-count"))) { // hide match count
hidematchcount = 1; hidematchcount = 1;
} else if (!strcmp(argv[i], "-smc")) { // don't hide match count } else if (!strcmp(argv[i], "-smc") || (!strcmp(argv[i], "--show-match-count"))) { // show match count
hidematchcount = 0; hidematchcount = 0;
} else if (!strcmp(argv[i], "-hm")) { // hide mode indicator } else if (!strcmp(argv[i], "-hm") || (!strcmp(argv[i], "--hide-mode"))) { // hide mode indicator
hidemode = 1; hidemode = 1;
} else if (!strcmp(argv[i], "-sm")) { // don't hide mode indicator } else if (!strcmp(argv[i], "-sm") || (!strcmp(argv[i], "--show-mode"))) { // show mode indicator
hidemode = 0; hidemode = 0;
} else if (!strcmp(argv[i], "-hla")) { // hide left arrow } else if (!strcmp(argv[i], "-hla") || (!strcmp(argv[i], "--hide-left-arrow"))) { // hide left arrow
hidelarrow = 1; hidelarrow = 1;
} else if (!strcmp(argv[i], "-sla")) { // don't hide left arrow } else if (!strcmp(argv[i], "-sla") || (!strcmp(argv[i], "--show-left-arrow"))) { // show left arrow
hidelarrow = 0; hidelarrow = 0;
} else if (!strcmp(argv[i], "-hra")) { // hide right arrow } else if (!strcmp(argv[i], "-hra") || (!strcmp(argv[i], "--hide-right-arrow"))) { // hide right arrow
hiderarrow = 1; hiderarrow = 1;
} else if (!strcmp(argv[i], "-sra")) { // don't hide right arrow } else if (!strcmp(argv[i], "-sra") || (!strcmp(argv[i], "--show-right-arrow"))) { // show right arrow
hiderarrow = 0; hiderarrow = 0;
} else if (!strcmp(argv[i], "-hpr")) { // hide prompt } else if (!strcmp(argv[i], "-hpr") || (!strcmp(argv[i], "--hide-prompt"))) { // hide prompt
hideprompt = 1; hideprompt = 1;
} else if (!strcmp(argv[i], "-spr")) { // don't hide prompt } else if (!strcmp(argv[i], "-spr") || (!strcmp(argv[i], "--show-prompt"))) { // show prompt
hideprompt = 0; hideprompt = 0;
} else if (!strcmp(argv[i], "-hc")) { // hide cursor } else if (!strcmp(argv[i], "-hc") || (!strcmp(argv[i], "--hide-cursor"))) { // hide cursor
hidecursor = 1; hidecursor = 1;
} else if (!strcmp(argv[i], "-sc")) { // don't hide cursor } else if (!strcmp(argv[i], "-sc") || (!strcmp(argv[i], "--show-cursor"))) { // show cursor
hidecursor = 0; hidecursor = 0;
} else if (!strcmp(argv[i], "-hhl")) { // hide highlighting } else if (!strcmp(argv[i], "-hhl") || (!strcmp(argv[i], "--hide-highlighting"))) { // hide highlighting
hidehighlight = 1; hidehighlight = 1;
} else if (!strcmp(argv[i], "-shl")) { // don't hide highlighting } else if (!strcmp(argv[i], "-shl") || (!strcmp(argv[i], "--show-highlighting"))) { // show highlighting
hidehighlight = 0; hidehighlight = 0;
} else if (!strcmp(argv[i], "-hi")) { // hide image } else if (!strcmp(argv[i], "-hi") || (!strcmp(argv[i], "--hide-image"))) { // hide image
hideimage = 1; hideimage = 1;
} else if (!strcmp(argv[i], "-si")) { // don't hide image } else if (!strcmp(argv[i], "-si") || (!strcmp(argv[i], "--show-image"))) { // show image
hideimage = 0; hideimage = 0;
} else if (!strcmp(argv[i], "-ip")) { // indent to prompt width } else if (!strcmp(argv[i], "-ip") || (!strcmp(argv[i], "--indent"))) { // indent to prompt width
indentitems = 1; indentitems = 1;
} else if (!strcmp(argv[i], "-nip")) { // don't indent to prompt width } else if (!strcmp(argv[i], "-nip") || (!strcmp(argv[i], "--no-indent"))) { // don't indent to prompt width
indentitems = 0; indentitems = 0;
} else if (i + 1 == argc) { } else if (i + 1 == argc) {
int arg = i; int arg = i;
int pr = 1; int pr = 1;
// any of the arguments we checked first
if (strcmp(argv[i-1], "-xrdb") if (strcmp(argv[i-1], "-xrdb")
|| strcmp(argv[i-1], "-nxrdb") || strcmp(argv[i-1], "-nxrdb")
|| strcmp(argv[i-1], "-lcfg") || strcmp(argv[i-1], "-lcfg")
@ -153,49 +154,51 @@ readargs(int argc, char *argv[])
// dmenu compatibility arguments // dmenu compatibility arguments
} else if (!strcmp(argv[i], "-i")) { // case-insensitive item matching, for compatibility reasons } else if (!strcmp(argv[i], "-i")) { // case-insensitive item matching, for compatibility reasons
casesensitive = 0; casesensitive = 0;
} else if (!strcmp(argv[i], "-S")) { // don't sort
sortmatches = 0;
// these options take one argument // these options take one argument
} else if (!strcmp(argv[i], "-g")) { // number of columns in grid } else if (!strcmp(argv[i], "-g") || (!strcmp(argv[i], "--columns"))) { // number of columns in grid
columns = atoi(argv[++i]); columns = atoi(argv[++i]);
if (lines == 0) lines = 1; if (lines == 0) lines = 1;
} else if (!strcmp(argv[i], "-Ps")) { // password symbol } else if (!strcmp(argv[i], "-Ps") || (!strcmp(argv[i], "--password-symbol"))) { // password symbol
password = argv[++i]; password = argv[++i];
} else if (!strcmp(argv[i], "-l")) { // number of lines in grid } else if (!strcmp(argv[i], "-l") || (!strcmp(argv[i], "--lines"))) { // number of lines in grid
lines = atoi(argv[++i]); lines = atoi(argv[++i]);
} else if (!strcmp(argv[i], "-mh")) { // minimum height of one menu line } else if (!strcmp(argv[i], "-mh") || (!strcmp(argv[i], "--lineheight"))) { // line height
lineheight += atoi(argv[++i]); lineheight += atoi(argv[++i]);
if (columns == 0) columns = 1; if (columns == 0) columns = 1;
} else if (!strcmp(argv[i], "-lp")) { // vertical padding } else if (!strcmp(argv[i], "-lp") || (!strcmp(argv[i], "--vertical-padding"))) { // vertical padding
menupaddingv = atoi(argv[++i]); menupaddingv = atoi(argv[++i]);
} else if (!strcmp(argv[i], "-hp")) { // horizontal padding } else if (!strcmp(argv[i], "-hp") || (!strcmp(argv[i], "--horizontal-padding"))) { // horizontal padding
menupaddingh = atoi(argv[++i]); menupaddingh = atoi(argv[++i]);
} else if (!strcmp(argv[i], "-pri")) { // high priority (csv) } else if (!strcmp(argv[i], "-pri") || (!strcmp(argv[i], "--priority"))) { // high priority (csv format)
hpitems = tokenize(argv[++i], ",", &hplength); hpitems = tokenize(argv[++i], ",", &hplength);
} else if (!strcmp(argv[i], "-ig")) { // gaps between image } else if (!strcmp(argv[i], "-ig") || (!strcmp(argv[i], "--image-gaps"))) { // gaps between image
imagegaps = atoi(argv[++i]); imagegaps = atoi(argv[++i]);
} else if (!strcmp(argv[i], "-la")) { // left arrow symbol } else if (!strcmp(argv[i], "-la") || (!strcmp(argv[i], "--left-arrow-symbol"))) { // left arrow symbol
leftarrow = argv[++i]; leftarrow = argv[++i];
} else if (!strcmp(argv[i], "-ra")) { // right arrow symbol } else if (!strcmp(argv[i], "-ra") || (!strcmp(argv[i], "--right-arrow-symbol"))) { // right arrow symbol
rightarrow = argv[++i]; rightarrow = argv[++i];
} else if (!strcmp(argv[i], "-m")) // monitor } else if (!strcmp(argv[i], "-m") || (!strcmp(argv[i], "--monitor"))) // monitor
mon = atoi(argv[++i]); mon = atoi(argv[++i]);
else if (!strcmp(argv[i], "-bw")) { // border width else if (!strcmp(argv[i], "-bw") || (!strcmp(argv[i], "--border-width"))) { // border width
borderwidth = atoi(argv[++i]); borderwidth = atoi(argv[++i]);
} else if (!strcmp(argv[i], "-H")) // hist file location } else if (!strcmp(argv[i], "-H") || (!strcmp(argv[i], "--hist-file"))) // hist file location
histfile = argv[++i]; histfile = argv[++i];
else if (!strcmp(argv[i], "-x")) // window x offset else if (!strcmp(argv[i], "-x") || (!strcmp(argv[i], "--x-position"))) // window x offset
dmx = atoi(argv[++i]); dmx = atoi(argv[++i]);
else if (!strcmp(argv[i], "-y")) // window y offset (from bottom up if -b) else if (!strcmp(argv[i], "-y") || (!strcmp(argv[i], "--y-position"))) // window y offset (from bottom up if -b)
dmy = atoi(argv[++i]); dmy = atoi(argv[++i]);
else if (!strcmp(argv[i], "-z")) // make spmenu this wide else if (!strcmp(argv[i], "-z") || (!strcmp(argv[i], "--width"))) // make spmenu this wide
dmw = atoi(argv[++i]); dmw = atoi(argv[++i]);
else if (!strcmp(argv[i], "-p")) // adds prompt to left of input field else if (!strcmp(argv[i], "-p") || (!strcmp(argv[i], "--prompt"))) // adds prompt to left of input field
prompt = argv[++i]; prompt = argv[++i];
else if (!strcmp(argv[i], "-fn")) // font or font set else if (!strcmp(argv[i], "-fn") || (!strcmp(argv[i], "--font"))) // font or font set
fonts[0] = argv[++i]; fonts[0] = argv[++i];
else if (!strcmp(argv[i], "-nmt")) // normal mode text else if (!strcmp(argv[i], "-nmt") || (!strcmp(argv[i], "--normal-mode-text"))) // normal mode text
strcpy(normtext, argv[++i]); strcpy(normtext, argv[++i]);
else if (!strcmp(argv[i], "-imt")) { // insert mode text else if (!strcmp(argv[i], "-imt") || (!strcmp(argv[i], "--insert-mode-text"))) { // insert mode text
strcpy(instext, argv[++i]); strcpy(instext, argv[++i]);
// dmenu compatibility options // dmenu compatibility options
@ -219,7 +222,9 @@ readargs(int argc, char *argv[])
colors[SchemeMenu][ColFg] = argv[++i]; colors[SchemeMenu][ColFg] = argv[++i];
colors[SchemeInput][ColBg] = argv[++i]; colors[SchemeInput][ColBg] = argv[++i];
colors[SchemePrompt][ColFg] = argv[++i]; colors[SchemePrompt][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-is")) { // image size
// more
} else if (!strcmp(argv[i], "-is") || (!strcmp(argv[i], "--image-size"))) { // image size
char buf[255]; char buf[255];
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
memcpy(buf, argv[++i], sizeof(buf)-1); memcpy(buf, argv[++i], sizeof(buf)-1);
@ -227,86 +232,85 @@ readargs(int argc, char *argv[])
if(sscanf(buf, "%dx%d", &imagewidth, &imageheight) == 1) if(sscanf(buf, "%dx%d", &imagewidth, &imageheight) == 1)
imageheight = imagewidth; imageheight = imagewidth;
} else if (!strcmp(argv[i], "-w")) { // embedding window id } else if (!strcmp(argv[i], "-w") || (!strcmp(argv[i], "--embed"))) { // embedding window id
embed = argv[++i]; embed = argv[++i];
} else if (!strcmp(argv[i], "-n")) { // preselected item } else if (!strcmp(argv[i], "-n") || (!strcmp(argv[i], "--preselect"))) { // preselected item
preselected = atoi(argv[++i]); preselected = atoi(argv[++i]);
// spmenu colors // spmenu colors
} else if (!strcmp(argv[i], "-nif")) { // normal item foreground color } else if (!strcmp(argv[i], "-nif") || (!strcmp(argv[i], "--normal-item-foreground"))) { // normal item foreground color
colors[SchemeItemNorm][ColFg] = argv[++i]; colors[SchemeItemNorm][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-nib")) { // normal item background color } else if (!strcmp(argv[i], "-nib") || (!strcmp(argv[i], "--normal-item-background"))) { // normal item background color
colors[SchemeItemNorm][ColBg] = argv[++i]; colors[SchemeItemNorm][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-sif")) { // selected item foreground color } else if (!strcmp(argv[i], "-sif") || (!strcmp(argv[i], "--selected-item-foreground"))) { // selected item foreground color
colors[SchemeItemSel][ColFg] = argv[++i]; colors[SchemeItemSel][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-sib")) { // selected item background color } else if (!strcmp(argv[i], "-sib") || (!strcmp(argv[i], "--selected-item-background"))) { // selected item background color
colors[SchemeItemSel][ColBg] = argv[++i]; colors[SchemeItemSel][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-npf")) { // normal item priority foreground color } else if (!strcmp(argv[i], "-npf") || (!strcmp(argv[i], "--normal-item-priority-foreground"))) { // normal item priority foreground color
colors[SchemeItemNormPri][ColFg] = argv[++i]; colors[SchemeItemNormPri][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-npb")) { // normal item priority background color } else if (!strcmp(argv[i], "-npb") || (!strcmp(argv[i], "--normal-item-priority-background"))) { // normal item priority background color
colors[SchemeItemNormPri][ColBg] = argv[++i]; colors[SchemeItemNormPri][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-spf")) { // selected item priority foreground color } else if (!strcmp(argv[i], "-spf") || (!strcmp(argv[i], "--selected-item-priority-foreground"))) { // selected item priority foreground color
colors[SchemeItemSelPri][ColFg] = argv[++i]; colors[SchemeItemSelPri][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-spb")) { // selected item priority background color } else if (!strcmp(argv[i], "-spb") || (!strcmp(argv[i], "--selected-item-priority-background"))) { // selected item priority background color
colors[SchemeItemSelPri][ColBg] = argv[++i]; colors[SchemeItemSelPri][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-mbg")) { // menu color } else if (!strcmp(argv[i], "-mbg") || (!strcmp(argv[i], "--menu-background"))) { // menu color
colors[SchemeMenu][ColBg] = argv[++i]; colors[SchemeMenu][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-pfg")) { // prompt fg color } else if (!strcmp(argv[i], "-pfg") || (!strcmp(argv[i], "--prompt-foreground"))) { // prompt fg color
colors[SchemePrompt][ColFg] = argv[++i]; colors[SchemePrompt][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-pbg")) { // prompt bg color } else if (!strcmp(argv[i], "-pbg") || (!strcmp(argv[i], "--prompt-background"))) { // prompt bg color
colors[SchemePrompt][ColBg] = argv[++i]; colors[SchemePrompt][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-ifg")) { // input fg color } else if (!strcmp(argv[i], "-ifg") || (!strcmp(argv[i], "--input-foreground"))) { // input fg color
colors[SchemeInput][ColFg] = argv[++i]; colors[SchemeInput][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-pfg")) { // input bg color } else if (!strcmp(argv[i], "-pfg") || (!strcmp(argv[i], "--input-background"))) { // input bg color
colors[SchemeInput][ColBg] = argv[++i]; colors[SchemeInput][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-shf")) { // selected highlight foreground color } else if (!strcmp(argv[i], "-nhb") || (!strcmp(argv[i], "--normal-highlight-background"))) { // normal highlight background color
colors[SchemeSelHighlight][ColBg] = argv[++i]; colors[SchemeNormHighlight][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-shf")) { // selected highlight foreground color } else if (!strcmp(argv[i], "-shf") || (!strcmp(argv[i], "--normal-highlight-foreground"))) { // normal highlight foreground color
colors[SchemeSelHighlight][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-nhf")) { // normal highlight foreground color
colors[SchemeNormHighlight][ColFg] = argv[++i]; colors[SchemeNormHighlight][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-shb")) { // selected highlight foreground color } else if (!strcmp(argv[i], "-nhf") || (!strcmp(argv[i], "--selected-highlight-foreground"))) { // selected highlight foreground color
colors[SchemeSelHighlight][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-shb") || (!strcmp(argv[i], "--selected-highlight-background"))) { // selected highlight background color
colors[SchemeSelHighlight][ColBg] = argv[++i]; colors[SchemeSelHighlight][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-nhb")) { // normal highlight foreground color } else if (!strcmp(argv[i], "-nbg") || (!strcmp(argv[i], "--number-background"))) { // numbgcolor
colors[SchemeNormHighlight][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-nbg")) { // numbgcolor
colors[SchemeNumber][ColBg] = argv[++i]; colors[SchemeNumber][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-nfg")) { // numfgcolor } else if (!strcmp(argv[i], "-nfg") || (!strcmp(argv[i], "--number-foreground"))) { // numfgcolor
colors[SchemeNumber][ColFg] = argv[++i]; colors[SchemeNumber][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-mbg")) { // mode } else if (!strcmp(argv[i], "-mbg") || (!strcmp(argv[i], "--mode-background"))) { // mode
colors[SchemeMode][ColBg] = argv[++i]; colors[SchemeMode][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-mfg")) { // mode } else if (!strcmp(argv[i], "-mfg") || (!strcmp(argv[i], "--mode-foreground"))) { // mode
colors[SchemeMode][ColFg] = argv[++i]; colors[SchemeMode][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-laf")) { // left arrow fg } else if (!strcmp(argv[i], "-laf") || (!strcmp(argv[i], "--left-arrow-foreground"))) { // left arrow fg
colors[SchemeLArrow][ColFg] = argv[++i]; colors[SchemeLArrow][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-raf")) { // right arrow fg } else if (!strcmp(argv[i], "-raf") || (!strcmp(argv[i], "--right-arrow-foreground"))) { // right arrow fg
colors[SchemeRArrow][ColFg] = argv[++i]; colors[SchemeRArrow][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-lab")) { // left arrow bg } else if (!strcmp(argv[i], "-lab") || (!strcmp(argv[i], "--left-arrow-background"))) { // left arrow bg
colors[SchemeLArrow][ColFg] = argv[++i]; colors[SchemeLArrow][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-rab")) { // right arrow bg } else if (!strcmp(argv[i], "-rab") || (!strcmp(argv[i], "--right-arrow-background"))) { // right arrow bg
colors[SchemeRArrow][ColFg] = argv[++i]; colors[SchemeRArrow][ColFg] = argv[++i];
} else if (!strcmp(argv[i], "-bc")) { // border } else if (!strcmp(argv[i], "-bc") || (!strcmp(argv[i], "--border-background"))) { // border
colors[SchemeBorder][ColBg] = argv[++i]; colors[SchemeBorder][ColBg] = argv[++i];
} else if (!strcmp(argv[i], "-cc")) // caret color } else if (!strcmp(argv[i], "-cc") || (!strcmp(argv[i], "--caret-foreground"))) { // caret color
colors[SchemeCaret][ColFg] = argv[++i]; colors[SchemeCaret][ColFg] = argv[++i];
}
// sgr colors // sgr colors
else if (!strcmp(argv[i], "-sgr0")) textcolors[0] = argv[++i]; // sgr color 0 else if (!strcmp(argv[i], "-sgr0") || (!strcmp(argv[i], "--sgr0"))) textcolors[0] = argv[++i]; // sgr color 0
else if (!strcmp(argv[i], "-sgr1")) textcolors[1] = argv[++i]; // sgr color 1 else if (!strcmp(argv[i], "-sgr1") || (!strcmp(argv[i], "--sgr1"))) textcolors[1] = argv[++i]; // sgr color 1
else if (!strcmp(argv[i], "-sgr2")) textcolors[2] = argv[++i]; // sgr color 2 else if (!strcmp(argv[i], "-sgr2") || (!strcmp(argv[i], "--sgr2"))) textcolors[2] = argv[++i]; // sgr color 2
else if (!strcmp(argv[i], "-sgr3")) textcolors[3] = argv[++i]; // sgr color 3 else if (!strcmp(argv[i], "-sgr3") || (!strcmp(argv[i], "--sgr3"))) textcolors[3] = argv[++i]; // sgr color 3
else if (!strcmp(argv[i], "-sgr4")) textcolors[4] = argv[++i]; // sgr color 4 else if (!strcmp(argv[i], "-sgr4") || (!strcmp(argv[i], "--sgr4"))) textcolors[4] = argv[++i]; // sgr color 4
else if (!strcmp(argv[i], "-sgr5")) textcolors[5] = argv[++i]; // sgr color 5 else if (!strcmp(argv[i], "-sgr5") || (!strcmp(argv[i], "--sgr5"))) textcolors[5] = argv[++i]; // sgr color 5
else if (!strcmp(argv[i], "-sgr6")) textcolors[6] = argv[++i]; // sgr color 6 else if (!strcmp(argv[i], "-sgr6") || (!strcmp(argv[i], "--sgr6"))) textcolors[6] = argv[++i]; // sgr color 6
else if (!strcmp(argv[i], "-sgr7")) textcolors[7] = argv[++i]; // sgr color 7 else if (!strcmp(argv[i], "-sgr7") || (!strcmp(argv[i], "--sgr7"))) textcolors[7] = argv[++i]; // sgr color 7
else if (!strcmp(argv[i], "-sgr8")) textcolors[8] = argv[++i]; // sgr color 8 else if (!strcmp(argv[i], "-sgr8") || (!strcmp(argv[i], "--sgr8"))) textcolors[8] = argv[++i]; // sgr color 8
else if (!strcmp(argv[i], "-sgr9")) textcolors[9] = argv[++i]; // sgr color 9 else if (!strcmp(argv[i], "-sgr9") || (!strcmp(argv[i], "--sgr9"))) textcolors[9] = argv[++i]; // sgr color 9
else if (!strcmp(argv[i], "-sgr10")) textcolors[10] = argv[++i]; // sgr color 10 else if (!strcmp(argv[i], "-sgr10") || (!strcmp(argv[i], "--sgr10"))) textcolors[10] = argv[++i]; // sgr color 10
else if (!strcmp(argv[i], "-sgr11")) textcolors[11] = argv[++i]; // sgr color 11 else if (!strcmp(argv[i], "-sgr11") || (!strcmp(argv[i], "--sgr11"))) textcolors[11] = argv[++i]; // sgr color 11
else if (!strcmp(argv[i], "-sgr12")) textcolors[12] = argv[++i]; // sgr color 12 else if (!strcmp(argv[i], "-sgr12") || (!strcmp(argv[i], "--sgr12"))) textcolors[12] = argv[++i]; // sgr color 12
else if (!strcmp(argv[i], "-sgr13")) textcolors[13] = argv[++i]; // sgr color 13 else if (!strcmp(argv[i], "-sgr13") || (!strcmp(argv[i], "--sgr13"))) textcolors[13] = argv[++i]; // sgr color 13
else if (!strcmp(argv[i], "-sgr14")) textcolors[14] = argv[++i]; // sgr color 14 else if (!strcmp(argv[i], "-sgr14") || (!strcmp(argv[i], "--sgr14"))) textcolors[14] = argv[++i]; // sgr color 14
else if (!strcmp(argv[i], "-sgr15")) textcolors[15] = argv[++i]; // sgr color 15 else if (!strcmp(argv[i], "-sgr15") || (!strcmp(argv[i], "--sgr15"))) textcolors[15] = argv[++i]; // sgr color 15
else else
fprintf(stderr, "spmenu: Invalid argument: '%s'\n", argv[i]); fprintf(stderr, "spmenu: Invalid argument: '%s'\n", argv[i]);
@ -333,6 +337,7 @@ usage(void)
"spmenu -nrw Disable relative input width\n" "spmenu -nrw Disable relative input width\n"
"spmenu -f Grabs keyboard before reading stdin\n" "spmenu -f Grabs keyboard before reading stdin\n"
"spmenu -F Enable fuzzy matching\n" "spmenu -F Enable fuzzy matching\n"
"spmenu -NF Disable fuzzy matching\n"
"spmenu -P Hide characters\n" "spmenu -P Hide characters\n"
"spmenu -Ps <symbol> Set the password symbol to <symbol>\n" "spmenu -Ps <symbol> Set the password symbol to <symbol>\n"
"spmenu -p <text> Set spmenu prompt text to <text>\n" "spmenu -p <text> Set spmenu prompt text to <text>\n"

View file

@ -66,6 +66,8 @@ spmenu -f - Grabs keyboard before reading stdin
.IP \[bu] 2 .IP \[bu] 2
spmenu -F - Enable fuzzy matching spmenu -F - Enable fuzzy matching
.IP \[bu] 2 .IP \[bu] 2
spmenu -NF - Disable fuzzy matching
.IP \[bu] 2
spmenu -P - Hide characters spmenu -P - Hide characters
.IP \[bu] 2 .IP \[bu] 2
spmenu -Ps symbol - Set the password symbol to symbol spmenu -Ps symbol - Set the password symbol to symbol