diff --git a/docs/docs.md b/docs/docs.md index 87c6a7b..047bcb2 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -106,6 +106,9 @@ in the config files. `-p, --prompt text` : Set spmenu prompt text to text +`-pt, --pretext text` +: Set spmenu pretext to text + `-It, --input text` : Set initial input text to text diff --git a/libs/argv.c b/libs/argv.c index 1d88320..a7e126e 100644 --- a/libs/argv.c +++ b/libs/argv.c @@ -352,6 +352,8 @@ void readargs(int argc, char *argv[]) { menuwidth = 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], "-pt") || (!strcmp(argv[i], "--pretext"))) // adds pretext + pretext = 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 @@ -623,6 +625,7 @@ void usage(int status) { "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 -pt, --pretext Set spmenu pretext 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" diff --git a/scripts/spmenu_run b/scripts/spmenu_run index f16779e..6ff8d51 100755 --- a/scripts/spmenu_run +++ b/scripts/spmenu_run @@ -53,6 +53,12 @@ RUNLAUNCHER_DESKTOP_ARGS="" RUNLAUNCHER_FM_ARGS="--lines 40 --columns 2" RUNLAUNCHER_HELP_ARGS="" +RUNLAUNCHER_RUN_PRETEXT="Type in keywords to search for a program.." +RUNLAUNCHER_BM_PRETEXT="Type in keywords to search for a bookmark.." +RUNLAUNCHER_DESKTOP_PRETEXT="Type in keywords to search for a program.." +RUNLAUNCHER_FM_PRETEXT="Type in keywords to search for a file or directory.." +RUNLAUNCHER_HELP_PRETEXT="" + DESKTOP_DIR="${DESKTOP_DIR:-${DESTDIR}${PREFIX}/share/applications ${HOME}/.local/share/applications}" ICON_DIR="${ICON_DIR:-${DESTDIR}${PREFIX}/share/icons/hicolor ${HOME}/.local/share/icons/hicolor ${DESTDIR}${PREFIX}/share/pixmaps}" IMAGE="${IMAGE:-true}" @@ -211,6 +217,13 @@ RUNLAUNCHER_FM_ARGS="${RUNLAUCNHER_FM_ARGS}" # Extra arguments passed to \$RUNLA RUNLAUNCHER_HELP_ARGS="${RUNLAUNCHER_HELP_ARGS}" # Extra arguments passed to \$RUNLAUNCHER when using the help DMENU_COMPAT="$DMENU_COMPAT" # Enable dmenu compatibility (true/false) +# Pretext +RUNLAUNCHER_RUN_PRETEXT="$RUNLAUNCHER_RUN_PRETEXT" # Text to display when no input text +RUNLAUNCHER_BM_PRETEXT="$RUNLAUNCHER_BM_PRETEXT" # Text to display when no input text +RUNLAUNCHER_DESKTOP_PRETEXT="$RUNLAUNCHER_DESKTOP_PRETEXT" # Text to display when no input text +RUNLAUNCHER_FM_PRETEXT="$RUNLAUNCHER_FM_PRETEXT" # Text to display when no input text +RUNLAUNCHER_HELP_PRETEXT="$RUNLAUNCHER_HELP_PRETEXT" # Text to display when no input text + # Sorting SORT_BY_NUMBER="$SORT_BY_NUMBER" # Sort by numbers SORT_IN_REVERSE="$SORT_IN_REVERSE" # Sort in reverse @@ -379,7 +392,7 @@ main() { RUNLAUNCHER_FM_ARGS="--insert --lines 20 --columns 1 $HIST_ARG $RUNLAUNCHER_FM_ARGS $MARGS" RUNLAUNCHER_RUN_ARGS="--insert $HIST_ARG $RUNLAUNCHER_RUN_ARGS $MARGS" RUNLAUNCHER_BM_ARGS="--insert $HIST_ARG --prompt Bookmarks $RUNLAUNCHER_BM_ARGS $MARGS" - RUNLAUNCHER_DESKTOP_ARGS="--sgr1 $DESCRIPTION_COLOR --sgr2 $COMMENT_COLOR --lines 20 --columns 1 --image-size 100 --image-gaps 20 --display-icons $RUNLAUNCHER_DESKTOP_ARGS $MARGS" + RUNLAUNCHER_DESKTOP_ARGS="--insert --sgr1 $DESCRIPTION_COLOR --sgr2 $COMMENT_COLOR --lines 20 --columns 1 --image-size 100 --image-gaps 20 --display-icons $RUNLAUNCHER_DESKTOP_ARGS $MARGS" RUNLAUNCHER_HELP_ARGS="--insert $HIST_ARG $RUNLAUNCHER_HELP_ARGS $MARGS" # dmenu compatibility @@ -411,6 +424,19 @@ main() { read -ra desktopdir <<< "${DESKTOP_DIR}" read -ra icondir <<< "${ICON_DIR}" + if [ "$DMENU_COMPAT" = "false" ]; then + rl_desktop+=("--pretext") + rl_fm+=("--pretext") + rl_run+=("--pretext") + rl_help+=("--pretext") + rl_bm+=("--pretext") + rl_desktop+=("$RUNLAUNCHER_DESKTOP_PRETEXT") + rl_fm+=("$RUNLAUNCHER_FM_PRETEXT") + rl_run+=("$RUNLAUNCHER_RUN_PRETEXT") + rl_help+=("$RUNLAUNCHER_HELP_PRETEXT") + rl_bm+=("$RUNLAUNCHER_BM_PRETEXT") + fi + # $PATH listing case "$function" in "run") diff --git a/spmenu.1 b/spmenu.1 index f4bc605..8384fa9 100644 --- a/spmenu.1 +++ b/spmenu.1 @@ -133,6 +133,9 @@ Don\[cq]t hide characters \f[V]-p, --prompt text\f[R] Set spmenu prompt text to text .TP +\f[V]-pt, --pretext text\f[R] +Set spmenu pretext to text +.TP \f[V]-It, --input text\f[R] Set initial input text to text .TP