some improvements to the scripts

This commit is contained in:
speedie 2023-04-20 18:21:17 +02:00
parent ee9c014b46
commit 0ec8d8cbb9
2 changed files with 21 additions and 20 deletions

View file

@ -5,15 +5,8 @@ CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}"
PREFIX="${PREFIX:-/usr}" PREFIX="${PREFIX:-/usr}"
load_profile() { load_profile() {
[ -f "${CONFDIR}/spmenu/.profile" ] && [ "$(cat "${CONFDIR}/spmenu/.profile")" = "NONE" ] && NONE=true [ -f "${CONFDIR}/spmenu/.profile" ] && [ "$(cat "${CONFDIR}/spmenu/.profile")" = "NONE" ] && NONE=true && return
[ -f "${CONFDIR}/spmenu/.profile" ] && PROFILE="$(cat "${CONFDIR}/spmenu/.profile")"
if [ "$NONE" = "true" ]; then
return
fi
[ -f "${CONFDIR}/spmenu/.profile" ] && \
PROFILE="$(cat "${CONFDIR}/spmenu/.profile")"
[ -f "$HOME/.spmenurc" ] && xrdb -override "$HOME/.spmenurc" # legacy config [ -f "$HOME/.spmenurc" ] && xrdb -override "$HOME/.spmenurc" # legacy config
[ -n "$PROFILE" ] && xrdb -override "$PROFILE" [ -n "$PROFILE" ] && xrdb -override "$PROFILE"
} }

View file

@ -117,15 +117,17 @@ print_cli_help() {
cat << EOF cat << EOF
spmenu_run - Run launcher for spmenu spmenu_run - Run launcher for spmenu
spmenu -x, --run List entries in \$PATH. spmenu_run -x, --run List entries in \$PATH.
spmenu -f, --fm <dir> List files and directories in <dir>. spmenu_run -f, --fm <dir> List files and directories in <dir>.
spmenu -d, --desktop List .desktop entries. spmenu_run -d, --desktop List .desktop entries.
spmenu -p, --full-path Print the full path to the file selected (-fm) spmenu_run -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_run -np, --no-full-path Don't print the full path to the file selected (-fm)
spmenu -h, --help Print this help. spmenu_run -dm, --dmenu Run spmenu_run using dmenu instead of spmenu.
spmenu -o, --stdout Print to standard input and do not execute the selected item. spmenu_run -ndm, --no-dmenu Run spmenu_run using spmenu instead of dmenu.
spmenu -no, --no-stdout Don't print to standard input, execute the selected item. spmenu_run -h, --help Print this help.
spmenu -a, --args <args> Pass <args> to spmenu. 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 <args> Pass <args> to spmenu.
EOF EOF
} }
@ -304,6 +306,12 @@ read_args() {
-np|-no-full-path|--no-full-path) remove_arg "$arg" -np|-no-full-path|--no-full-path) remove_arg "$arg"
USE_FULL_PATH="false" 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" -a|-args|--args) remove_arg "$arg"
if [ -z "$narg" ]; then if [ -z "$narg" ]; then
printf "You must specify a list of arguments to pass to %s.\n" "$RUNLAUNCHER" 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" RUNLAUNCHER_HELP_ARGS="--insert --hist-file $HISTORY $RUNLAUNCHER_HELP_ARGS $MARGS"
# dmenu compatibility # dmenu compatibility
DMENU_FM_ARGS="$MARGS" DMENU_FM_ARGS="-l 20 $MARGS"
DMENU_RUN_ARGS="-l 20 $MARGS" DMENU_RUN_ARGS="$MARGS"
DMENU_DESKTOP_ARGS="-l 20 $MARGS" DMENU_DESKTOP_ARGS="-l 20 $MARGS"
DMENU_HELP_ARGS="-l 20 $MARGS" DMENU_HELP_ARGS="-l 20 $MARGS"
COMPAT_LS_ARGS="--color=never" COMPAT_LS_ARGS="--color=never"