From 0ec8d8cbb9a5e4a834d5374495c393ced3a441fa Mon Sep 17 00:00:00 2001 From: speedie Date: Thu, 20 Apr 2023 18:21:17 +0200 Subject: [PATCH] some improvements to the scripts --- scripts/spmenu_profile | 11 ++--------- scripts/spmenu_run | 30 +++++++++++++++++++----------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/scripts/spmenu_profile b/scripts/spmenu_profile index 5ded885..8c625d1 100755 --- a/scripts/spmenu_profile +++ b/scripts/spmenu_profile @@ -5,15 +5,8 @@ CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}" PREFIX="${PREFIX:-/usr}" load_profile() { - [ -f "${CONFDIR}/spmenu/.profile" ] && [ "$(cat "${CONFDIR}/spmenu/.profile")" = "NONE" ] && NONE=true - - if [ "$NONE" = "true" ]; then - return - fi - - [ -f "${CONFDIR}/spmenu/.profile" ] && \ - PROFILE="$(cat "${CONFDIR}/spmenu/.profile")" - + [ -f "${CONFDIR}/spmenu/.profile" ] && [ "$(cat "${CONFDIR}/spmenu/.profile")" = "NONE" ] && NONE=true && return + [ -f "${CONFDIR}/spmenu/.profile" ] && PROFILE="$(cat "${CONFDIR}/spmenu/.profile")" [ -f "$HOME/.spmenurc" ] && xrdb -override "$HOME/.spmenurc" # legacy config [ -n "$PROFILE" ] && xrdb -override "$PROFILE" } diff --git a/scripts/spmenu_run b/scripts/spmenu_run index b9d2c97..14571b6 100755 --- a/scripts/spmenu_run +++ b/scripts/spmenu_run @@ -117,15 +117,17 @@ print_cli_help() { cat << EOF spmenu_run - Run launcher for spmenu -spmenu -x, --run List entries in \$PATH. -spmenu -f, --fm List files and directories in . -spmenu -d, --desktop List .desktop entries. -spmenu -p, --full-path Print the full path to the file selected (-fm) -spmenu -np, --no-full-path Don't print the full path to the file selected (-fm) -spmenu -h, --help Print this help. -spmenu -o, --stdout Print to standard input and do not execute the selected item. -spmenu -no, --no-stdout Don't print to standard input, execute the selected item. -spmenu -a, --args Pass to spmenu. +spmenu_run -x, --run List entries in \$PATH. +spmenu_run -f, --fm List files and directories in . +spmenu_run -d, --desktop List .desktop entries. +spmenu_run -p, --full-path Print the full path to the file selected (-fm) +spmenu_run -np, --no-full-path Don't print the full path to the file selected (-fm) +spmenu_run -dm, --dmenu Run spmenu_run using dmenu instead of spmenu. +spmenu_run -ndm, --no-dmenu Run spmenu_run using spmenu instead of dmenu. +spmenu_run -h, --help Print this help. +spmenu_run -o, --stdout Print to standard input and do not execute the selected item. +spmenu_run -no, --no-stdout Don't print to standard input, execute the selected item. +spmenu_run -a, --args Pass to spmenu. EOF } @@ -304,6 +306,12 @@ read_args() { -np|-no-full-path|--no-full-path) remove_arg "$arg" USE_FULL_PATH="false" ;; + -dm|-dmenu|--dmenu) remove_arg "$arg" + DMENU_COMPAT="true" + ;; + -ndm|-no-dmenu|--no-dmenu) remove_arg "$arg" + DMENU_COMPAT="false" + ;; -a|-args|--args) remove_arg "$arg" if [ -z "$narg" ]; then printf "You must specify a list of arguments to pass to %s.\n" "$RUNLAUNCHER" @@ -570,8 +578,8 @@ main() { RUNLAUNCHER_HELP_ARGS="--insert --hist-file $HISTORY $RUNLAUNCHER_HELP_ARGS $MARGS" # dmenu compatibility - DMENU_FM_ARGS="$MARGS" - DMENU_RUN_ARGS="-l 20 $MARGS" + DMENU_FM_ARGS="-l 20 $MARGS" + DMENU_RUN_ARGS="$MARGS" DMENU_DESKTOP_ARGS="-l 20 $MARGS" DMENU_HELP_ARGS="-l 20 $MARGS" COMPAT_LS_ARGS="--color=never"