From 2c68937e38e13cba8067739f9988620771da9838 Mon Sep 17 00:00:00 2001 From: speedie Date: Mon, 3 Apr 2023 15:14:20 +0200 Subject: [PATCH] finish the -It argument --- docs/docs.md | 8 ++++++-- libs/argv.c | 3 +++ spmenu.1 | 7 ++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/docs.md b/docs/docs.md index 7206d7e..c600b20 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -71,6 +71,9 @@ You may use long, descriptive arguments or the shorter arguments. `-p, --prompt text` : Set spmenu prompt text to text +`-It, --input text` +: Set initial input text to text + `-ip, --indent` : Indent items to prompt width @@ -486,7 +489,7 @@ no need to filter the output or anything. Not only does it support colored text, but it also supports colored backgrounds. This allows something similar to the emoji highlight patch, except even more useful. -Example: `printf "\033[0;44m😀\033[0mEmoji highlighting\n" | spmenu --columns 1` +Example: `printf "\033[0;44m😀\033[0m Emoji highlighting\n" | spmenu --columns 1` For 256 color support to work, you must add to the array. See `libs/color.h` if you want this. @@ -645,7 +648,8 @@ In addition to the aforementioned `spmenu_run`, the spmenu package also provides Unlike the regular run launcher though, spmenu_desktop supports displaying an icon for entries that use one. -It can be configured through editing `~/.config/spmenu/desktop/config`. +It can be configured through editing `~/.config/spmenu/desktop/config`. The +configuration file can also be moved by setting `${XDG_CONFIG_HOME}`. spmenu commands =============== diff --git a/libs/argv.c b/libs/argv.c index 0ac3344..2dc2547 100644 --- a/libs/argv.c +++ b/libs/argv.c @@ -214,6 +214,8 @@ readargs(int argc, char *argv[]) dmw = atoi(argv[++i]); else if (!strcmp(argv[i], "-p") || (!strcmp(argv[i], "--prompt"))) // adds prompt to left of input field prompt = argv[++i]; + else if (!strcmp(argv[i], "-It") || (!strcmp(argv[i], "--input"))) // specify initial text + input = argv[++i]; else if (!strcmp(argv[i], "-fn") || (!strcmp(argv[i], "--font"))) // font or font set fonts[0] = argv[++i]; else if (!strcmp(argv[i], "-nmt") || (!strcmp(argv[i], "--normal-mode-text"))) // normal mode text @@ -378,6 +380,7 @@ usage(void) "spmenu -NF, --no-fuzzy Disable fuzzy matching\n" "spmenu -P, --password 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" "spmenu -nip, --no-indent Don't indent items to prompt width\n" "spmenu -ci, --color-items Color items\n" diff --git a/spmenu.1 b/spmenu.1 index 64201c6..bf1a300 100644 --- a/spmenu.1 +++ b/spmenu.1 @@ -88,6 +88,9 @@ Hide characters \f[V]-p, --prompt text\f[R] Set spmenu prompt text to text .TP +\f[V]-It, --input text\f[R] +Set initial input text to text +.TP \f[V]-ip, --indent\f[R] Indent items to prompt width .TP @@ -513,7 +516,7 @@ backgrounds. This allows something similar to the emoji highlight patch, except even more useful. Example: -\f[V]printf \[dq]\[rs]033[0;44m😀\[rs]033[0mEmoji highlighting\[rs]n\[dq] | spmenu --columns 1\f[R] +\f[V]printf \[dq]\[rs]033[0;44m😀\[rs]033[0m Emoji highlighting\[rs]n\[dq] | spmenu --columns 1\f[R] .PP For 256 color support to work, you must add to the array. See \f[V]libs/color.h\f[R] if you want this. @@ -689,6 +692,8 @@ displaying an icon for entries that use one. .PP It can be configured through editing \f[V]\[ti]/.config/spmenu/desktop/config\f[R]. +The configuration file can also be moved by setting +\f[V]${XDG_CONFIG_HOME}\f[R]. .SH spmenu commands .PP spmenu has a few special commands.