add some arguments

This commit is contained in:
speedie 2023-04-07 17:58:42 +02:00
parent 4f62a82df2
commit e43754f534
8 changed files with 32 additions and 2 deletions

View file

@ -68,6 +68,9 @@ You may use long, descriptive arguments or the shorter arguments.
`-P, --password`
: Hide characters
`-nP, --no-password`
: Don't hide characters
`-p, --prompt text`
: Set spmenu prompt text to text
@ -152,6 +155,9 @@ You may use long, descriptive arguments or the shorter arguments.
`-hm, --hide-mode`
: Hide mode indicator
`-hit, --hide-item`
: Hide items
`-hmc, --hide-match-count`
: Hide match count
@ -182,6 +188,9 @@ You may use long, descriptive arguments or the shorter arguments.
`-sm, --show-mode`
: Show mode indicator
`-sit, --show-item`
: Show items
`-smc, --show-match-count`
: Show match count

View file

@ -110,6 +110,7 @@ spmenu.hidematchcount: 0
spmenu.hidemode: 0
spmenu.hidelarrow: 0
spmenu.hiderarrow: 0
spmenu.hideitem: 0
spmenu.hideprompt: 0
spmenu.hideinput: 0
spmenu.hidepowerline: 0

View file

@ -86,6 +86,7 @@ spmenu =
hide = ( { input = 0;
larrow = 0;
rarrow = 0;
item = 0;
prompt = 0;
powerline = 0;
cursor = 0;

View file

@ -102,6 +102,8 @@ readargs(int argc, char *argv[])
type = 0;
} else if (!strcmp(argv[i], "-P") || (!strcmp(argv[i], "--password"))) { // is the input a password
passwd = 1;
} else if (!strcmp(argv[i], "-nP") || (!strcmp(argv[i], "--no-password"))) { // is the input a password
passwd = 0;
} else if (!strcmp(argv[i], "-hmc") || (!strcmp(argv[i], "--hide-match-count"))) { // hide match count
hidematchcount = 1;
} else if (!strcmp(argv[i], "-smc") || (!strcmp(argv[i], "--show-match-count"))) { // show match count
@ -110,6 +112,10 @@ readargs(int argc, char *argv[])
hidemode = 1;
} else if (!strcmp(argv[i], "-sm") || (!strcmp(argv[i], "--show-mode"))) { // show mode indicator
hidemode = 0;
} else if (!strcmp(argv[i], "-hit") || (!strcmp(argv[i], "--hide-item"))) { // hide items
hideitem = 1;
} else if (!strcmp(argv[i], "-sit") || (!strcmp(argv[i], "--show-item"))) { // show items
hideitem = 0;
} else if (!strcmp(argv[i], "-hla") || (!strcmp(argv[i], "--hide-left-arrow"))) { // hide left arrow
hidelarrow = 1;
} else if (!strcmp(argv[i], "-sla") || (!strcmp(argv[i], "--show-left-arrow"))) { // show left arrow
@ -381,6 +387,7 @@ usage(void)
"spmenu -F, --fuzzy Enable fuzzy matching\n"
"spmenu -NF, --no-fuzzy Disable fuzzy matching\n"
"spmenu -P, --password Hide characters\n"
"spmenu -nP, --no-password Don't hide characters\n"
"spmenu -p, --prompt <text> Set spmenu prompt text to <text>\n"
"spmenu -It, --input <text> Set initial input text to <text>\n"
"spmenu -ip, --indent Indent items to prompt width\n"
@ -415,6 +422,7 @@ usage(void)
"spmenu -hmc, --hide-match-count Hide match count\n"
"spmenu -hla, --hide-left-arrow Hide left arrow\n"
"spmenu -hra, --hide-right-arrow Hide right arrow\n"
"spmenu -hit, --hide-item Hide items\n"
"spmenu -hpr, --hide-prompt Hide prompt\n"
"spmenu -hip, --hide-input Hide input\n"
"spmenu -hpl, --hide-powerline Hide powerline\n"
@ -425,6 +433,7 @@ usage(void)
"spmenu -smc, --show-match-count Show match count\n"
"spmenu -sla, --show-left-arrow Show left arrow\n"
"spmenu -sra, --show-right-arrow Show right arrow\n"
"spmenu -sit, --show-item Show items\n"
"spmenu -spr, --show-prompt Show prompt\n"
"spmenu -sin, --show-input Show input\n"
"spmenu -spl, --show-powerline Show powerline\n"

View file

@ -424,8 +424,7 @@ drawmenu(void)
if (!hidemode) modeWidth = pango_mode ? TEXTWM(modetext) : TEXTW(modetext);
// draw the items, this function also calls drawrarrow() and drawlarrow()
// TODO: Allow hiding items, without setting columns to 0
drawitem(x, y, w);
if (!hideitem) drawitem(x, y, w);
if (!hidematchcount) {
w = numberWidth;

View file

@ -70,6 +70,7 @@ ResourcePref resources[] = {
{ "lineheight", INTEGER, &lineheight },
{ "columns", INTEGER, &columns },
{ "maxhist", INTEGER, &maxhist },
{ "hideitem", INTEGER, &hideitem },
{ "hidematchcount", INTEGER, &hidematchcount },
{ "hidehighlight", INTEGER, &hidehighlight },
{ "hidemode", INTEGER, &hidemode },

View file

@ -78,6 +78,7 @@ static int indentitems = 1; /* Indent items to prompt width? (0/
static int hideinput = 0; /* Hide input (0/1) */
static int hidelarrow = 0; /* Hide left arrow (0/1) */
static int hiderarrow = 0; /* Hide right arrow (0/1) */
static int hideitem = 0; /* Hide item (0/1) */
static int hideprompt = 0; /* Hide prompt (0/1) */
static int hidepowerline = 0; /* Hide powerline (0/1) */
static int hidecursor = 0; /* Hide cursor (0/1) */

View file

@ -85,6 +85,9 @@ Disable fuzzy matching
\f[V]-P, --password\f[R]
Hide characters
.TP
\f[V]-nP, --no-password\f[R]
Don\[cq]t hide characters
.TP
\f[V]-p, --prompt text\f[R]
Set spmenu prompt text to text
.TP
@ -170,6 +173,9 @@ Position spmenu at the center of the screen
\f[V]-hm, --hide-mode\f[R]
Hide mode indicator
.TP
\f[V]-hit, --hide-item\f[R]
Hide items
.TP
\f[V]-hmc, --hide-match-count\f[R]
Hide match count
.TP
@ -200,6 +206,9 @@ Hide image
\f[V]-sm, --show-mode\f[R]
Show mode indicator
.TP
\f[V]-sit, --show-item\f[R]
Show items
.TP
\f[V]-smc, --show-match-count\f[R]
Show match count
.TP