diff --git a/docs/docs.md b/docs/docs.md index ec2d461..3e9739c 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -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 diff --git a/docs/example.Xresources b/docs/example.Xresources index ae38ed4..80a6037 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -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 diff --git a/docs/spmenu.conf b/docs/spmenu.conf index 85840f5..ca30dff 100644 --- a/docs/spmenu.conf +++ b/docs/spmenu.conf @@ -86,6 +86,7 @@ spmenu = hide = ( { input = 0; larrow = 0; rarrow = 0; + item = 0; prompt = 0; powerline = 0; cursor = 0; diff --git a/libs/argv.c b/libs/argv.c index 417687a..cb1e1a7 100644 --- a/libs/argv.c +++ b/libs/argv.c @@ -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 Set spmenu prompt text to \n" "spmenu -It, --input Set initial input text to \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" diff --git a/libs/draw.c b/libs/draw.c index 3cc8f2a..02e4804 100644 --- a/libs/draw.c +++ b/libs/draw.c @@ -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; diff --git a/libs/xresources.h b/libs/xresources.h index 28319a1..c882c2a 100644 --- a/libs/xresources.h +++ b/libs/xresources.h @@ -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 }, diff --git a/options.h b/options.h index 3e68948..8568843 100644 --- a/options.h +++ b/options.h @@ -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) */ diff --git a/spmenu.1 b/spmenu.1 index a3ca129..a7447e7 100644 --- a/spmenu.1 +++ b/spmenu.1 @@ -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