some changes, spmenu is now suitable to be used for simply drawing plain

text without any selection or anything
This commit is contained in:
speedie 2023-03-28 17:37:06 +02:00
parent cf1b79008b
commit 231a43d053
10 changed files with 45 additions and 8 deletions

View file

@ -166,6 +166,9 @@ You may use long, descriptive arguments or the shorter arguments.
`-hpr, --hide-prompt `
: Hide prompt
`-hip, --hide-input `
: Hide input
`-hpl, --hide-powerline `
: Hide powerline
@ -193,6 +196,9 @@ You may use long, descriptive arguments or the shorter arguments.
`-spr, --show-prompt `
: Show prompt
`-sin, --show-input `
: Show input
`-spl, --show-powerline `
: Show powerline

View file

@ -106,6 +106,7 @@ spmenu.hidemode: 0
spmenu.hidelarrow: 0
spmenu.hiderarrow: 0
spmenu.hideprompt: 0
spmenu.hideinput: 0
spmenu.hidepowerline: 0
spmenu.hidecursor: 0
spmenu.hidehighlight: 0

View file

@ -114,10 +114,14 @@ readargs(int argc, char *argv[])
hideprompt = 1;
} else if (!strcmp(argv[i], "-hpl") || (!strcmp(argv[i], "--hide-powerline"))) { // hide powerline
hidepowerline = 1;
} else if (!strcmp(argv[i], "-hin") || (!strcmp(argv[i], "--hide-input"))) { // hide input
hideinput = 1;
} else if (!strcmp(argv[i], "-spr") || (!strcmp(argv[i], "--show-prompt"))) { // show prompt
hideprompt = 0;
} else if (!strcmp(argv[i], "-spl") || (!strcmp(argv[i], "--show-powerline"))) { // show prompt
hidepowerline = 0;
} else if (!strcmp(argv[i], "-sin") || (!strcmp(argv[i], "--show-input"))) { // show input
hideinput = 0;
} else if (!strcmp(argv[i], "-hc") || (!strcmp(argv[i], "--hide-cursor"))) { // hide cursor
hidecursor = 1;
} else if (!strcmp(argv[i], "-sc") || (!strcmp(argv[i], "--show-cursor"))) { // show cursor
@ -392,6 +396,7 @@ usage(void)
"spmenu -hla, --hide-left-arrow Hide left arrow\n"
"spmenu -hra, --hide-right-arrow Hide right arrow\n"
"spmenu -hpr, --hide-prompt Hide prompt\n"
"spmenu -hip, --hide-input Hide input\n"
"spmenu -hpl, --hide-powerline Hide powerline\n"
"spmenu -hc, --hide-cursor Hide cursor\n"
"spmenu -hhl, --hide-highlighting Hide highlight\n"
@ -401,6 +406,8 @@ usage(void)
"spmenu -sla, --show-left-arrow Show left arrow\n"
"spmenu -sra, --show-right-arrow Show right arrow\n"
"spmenu -spr, --show-prompt Show prompt\n"
"spmenu -sin, --show-input Show input\n"
"spmenu -spl, --show-powerline Show powerline\n"
"spmenu -sc, --show-cursor Show cursor\n"
"spmenu -shl, --show-highlighting Show highlight\n"
"spmenu -si, --show-image Show image\n"

View file

@ -65,6 +65,10 @@ resizeclient(void)
mh = (lines + 1) * bh;
// why have an empty line?
if (hideprompt && hideinput && hidemode && hidematchcount)
mh += bh;
if (!win || omh == mh) return;
XResizeWindow(dpy, win, mw, mh);

View file

@ -373,14 +373,25 @@ drawmenu(void)
}
}
x = drawprompt(x, y, w);
x = drawinput(x, y, w);
// why have an empty line?
if (hideprompt && hideinput && hidemode && hidematchcount) {
y -= bh;
mh = (lines + 1) * bh - bh;
if (!win) return;
XResizeWindow(dpy, win, mw, mh);
drw_resize(drw, mw, mh);
}
if (!hideprompt) x = drawprompt(x, y, w);
if (!hideinput) x = drawinput(x, y, w);
if (!hidemode) modeWidth = pango_mode ? TEXTWM(modetext) : TEXTW(modetext);
drawitem(x, y, w);
drawnumber(x, y, w, numberWidth, modeWidth);
drawmode(x, y, w, numberWidth, modeWidth);
if (!hidematchcount) drawnumber(x, y, w, numberWidth, modeWidth);
if (!hidemode) drawmode(x, y, w, numberWidth, modeWidth);
drw_map(drw, win, 0, 0, mw, mh);
}

View file

@ -79,7 +79,7 @@ readstdin(void)
// spmenu:about
if (!strncmp("about", items[i].ex, strlen("about"))) {
int i = system("printf \"spmenu $([ -f '/usr/share/spmenu/version' ] && cat /usr/share/spmenu/version || printf unknown)\\nBased on dmenu 5.2 from https://tools.suckless.org/dmenu\\nCompiled $([ -f '/usr/share/spmenu/compile-date' ] && cat /usr/share/spmenu/compile-date || printf unknown)\\nCFLAGS: $([ -f '/usr/share/spmenu/cflags' ] && cat /usr/share/spmenu/cflags || printf unknown)\\nCC: $([ -f '/usr/share/spmenu/cc' ] && cat /usr/share/spmenu/cc || printf unknown)\" | spmenu --columns 1 --lines 5 --hide-cursor --no-allow-typing --hide-mode --hide-match-count --hide-powerline --no-indent > /dev/null");
int i = system("printf \"spmenu $([ -f '/usr/share/spmenu/version' ] && cat /usr/share/spmenu/version || printf unknown)\\nBased on dmenu 5.2 from https://tools.suckless.org/dmenu\\nCompiled $([ -f '/usr/share/spmenu/compile-date' ] && cat /usr/share/spmenu/compile-date || printf unknown)\\nCFLAGS: $([ -f '/usr/share/spmenu/cflags' ] && cat /usr/share/spmenu/cflags || printf unknown)\\nCC: $([ -f '/usr/share/spmenu/cc' ] && cat /usr/share/spmenu/cc || printf unknown)\" | spmenu --columns 1 --lines 5 --hide-cursor --no-allow-typing --hide-mode --hide-match-count --hide-prompt --hide-powerline --hide-input --no-indent --no-color-items > /dev/null");
if (i||!i) exit(0);
}

View file

@ -121,6 +121,7 @@ ResourcePref resources[] = {
{ "hidelarrow", INTEGER, &hidelarrow },
{ "hiderarrow", INTEGER, &hiderarrow },
{ "hideprompt", INTEGER, &hideprompt },
{ "hideinput", INTEGER, &hideinput },
{ "hidepowerline", INTEGER, &hidepowerline },
{ "hidecursor", INTEGER, &hidecursor },
{ "histnodup", INTEGER, &histnodup },

View file

@ -64,14 +64,15 @@ static int indentitems = 1; /* Indent items to prompt width? (0/
static char *prompt = NULL; /* Default prompt, set to NULL (nothing) */
/* Hide options */
static int hidematchcount = 0; /* Hide match count (0/1) */
static int hidemode = 0; /* Hide mode (0/1) */
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 hideprompt = 0; /* Hide prompt (0/1) */
static int hidepowerline = 0; /* Hide powerline (0/1) */
static int hidecursor = 0; /* Hide cursor (0/1) */
static int hidehighlight = 0; /* Hide highlight (0/1) */
static int hidematchcount = 0; /* Hide match count (0/1) */
static int hidemode = 0; /* Hide mode (0/1) */
static int hideimage = 0; /* Hide image (0/1) */
/* Color options

View file

@ -27,7 +27,7 @@ path() {
}
print_help() {
cat << EOF | $RUNLAUNCHER $RUNLAUNCHER_ARGS --lines 20 --columns 1 --normal --sgr1 "#FFFF00" --hide-cursor --no-allow-typing --no-color-items --prompt "" > /dev/null
cat << EOF | $RUNLAUNCHER $RUNLAUNCHER_ARGS --lines 20 --columns 1 --normal --sgr1 "#FFFF00" --hide-cursor --no-allow-typing --no-color-items --hide-prompt --hide-powerline --hide-input --hide-right-arrow --hide-left-arrow --hide-mode --hide-match-count > /dev/null
Start typing in keywords to list out entries. Press Enter to select an entry. The selected entry will be run through a shell.
To set spmenu options, you pass arguments to 'spmenu_run' directly. See 'spmenu --help' for a list of valid arguments.
To configure spmenu, you may also copy /usr/share/spmenu/example.Xresources to $HOME/.config/spmenu/spmenurc and edit that.

View file

@ -183,6 +183,9 @@ Hide right arrow
\f[V]-hpr, --hide-prompt\f[R]
Hide prompt
.TP
\f[V]-hip, --hide-input\f[R]
Hide input
.TP
\f[V]-hpl, --hide-powerline\f[R]
Hide powerline
.TP
@ -210,6 +213,9 @@ Show right arrow
\f[V]-spr, --show-prompt\f[R]
Show prompt
.TP
\f[V]-sin, --show-input\f[R]
Show input
.TP
\f[V]-spl, --show-powerline\f[R]
Show powerline
.TP