master #1

Merged
Lucas-mother3 merged 5 commits from speedie/spmenu:master into master 2023-09-10 01:37:34 +02:00
3 changed files with 25 additions and 22 deletions
Showing only changes of commit 62137e26e7 - Show all commits

11
scripts/spmenu_desktop Normal file → Executable file
View file

@ -143,13 +143,20 @@ print_desktop_list() {
mapfile -t it_only < "$ONLYFILE" mapfile -t it_only < "$ONLYFILE"
mapfile -t it_comment < "$COMMENTFILE" mapfile -t it_comment < "$COMMENTFILE"
d_print_array d_print_array | \
sort -k 2 "${sort_args[@]}" | \
uniq "${uniq_args[@]}" | \
grep -vE "$HIDDEN_ENTRY_KEYWORDS" | \
grep -E "$ENTRY_KEYWORDS"
fi fi
} }
d_print_array() { d_print_array() {
command -v print_array > /dev/null && print_array && return command -v print_array > /dev/null && print_array && return
printf "SORT_ARGS: %s\n" "${sort_args[*]}" >> "$LOGFILE"
printf "UNIQ_ARGS: %s\n" "${uniq_args[*]}" >> "$LOGFILE"
for i in "${!it_title[@]}"; do for i in "${!it_title[@]}"; do
[ "$RESPECT_ONLYSHOWIN" != "false" ] && [ "${it_only[i]}" != "false" ] && continue [ "$RESPECT_ONLYSHOWIN" != "false" ] && [ "${it_only[i]}" != "false" ] && continue
[ "$RESPECT_NODISPLAY" != "false" ] && [ "${it_display[i]}" != "true" ] && continue [ "$RESPECT_NODISPLAY" != "false" ] && [ "${it_display[i]}" != "true" ] && continue
@ -214,7 +221,7 @@ print_desktop_menu() {
HIDDEN_ENTRY_KEYWORDS="${HIDDEN_ENTRY_KEYWORDS:-NULL_ENTRY}" HIDDEN_ENTRY_KEYWORDS="${HIDDEN_ENTRY_KEYWORDS:-NULL_ENTRY}"
print_desktop_list "" | uniq "${uniq_args[@]}" | sort "${sort_args[@]}" | grep -vE "$HIDDEN_ENTRY_KEYWORDS" | grep -E "$ENTRY_KEYWORDS" | $RUNLAUNCHER "${rl_desktop[@]}" > /tmp/spmenu_out print_desktop_list "" | $RUNLAUNCHER "${rl_desktop[@]}" > /tmp/spmenu_out
while read -r menusel; do while read -r menusel; do
[ "$menusel" = "?" ] && print_desktop_help && print_desktop_menu [ "$menusel" = "?" ] && print_desktop_help && print_desktop_menu

View file

@ -5,31 +5,20 @@
# See LICENSE file for copyright and license details. # See LICENSE file for copyright and license details.
path() { path() {
[ "$SORT_BY_NUMBER" != "false" ] && NUMBERSORTARG="-n"
[ "$SORT_IN_REVERSE" != "false" ] && REVERSESORTARG="-r"
SORT_ARGS="$NUMBERSORTARG $REVERSESORTARG $SORT_ARGS"
read -ra uniq_args <<< "${UNIQ_ARGS}"
read -ra sort_args <<< "${SORT_ARGS}"
HIDDEN_KEYWORDS="${HIDDEN_KEYWORDS:-NULL_ENTRY}" HIDDEN_KEYWORDS="${HIDDEN_KEYWORDS:-NULL_ENTRY}"
print_menu() { print_menu() {
print() { print() {
compgen -c | \ compgen -c | \
grep -vE "$HIDDEN_KEYWORDS" | \ grep -vE "$HIDDEN_KEYWORDS" | \
grep -E "$KEYWORDS" grep -E "$KEYWORDS"
[ "$DISPLAY_BOOKMARKS" != "false" ] && bookmark_path [ "$DISPLAY_BOOKMARKS" != "false" ] && bookmark_path
}
if [ "$SORT_BY_RECENT" != "false" ]; then
print | sort "${sort_args[@]}" | cut -d' ' -f 2 2>&1
else
print | sort "${sort_args[@]}" | cut -d' ' -f 2 2>&1
fi
} }
print | sort "${sort_args[@]}" | cut -d' ' -f 2 2>&1
}
# uniq # uniq
if [ "$DISPLAY_DUPLICATES" != "false" ]; then if [ "$DISPLAY_DUPLICATES" != "false" ]; then
print_menu print_menu

11
scripts/spmenu_run Normal file → Executable file
View file

@ -20,8 +20,8 @@ RUNLAUNCHER="${RUNLAUNCHER:-spmenu}"
PREFIX="${PREFIX:-/usr}" PREFIX="${PREFIX:-/usr}"
DESTDIR="${DESTDIR:-}" DESTDIR="${DESTDIR:-}"
STDOUT="${STDOUT:-false}" STDOUT="${STDOUT:-false}"
SORT_BY_NUMBER="${SORT_BY_NUMBER:-true}" SORT_BY_NUMBER="${SORT_BY_NUMBER:-false}"
SORT_IN_REVERSE="${SORT_IN_REVERSE:-true}" SORT_IN_REVERSE="${SORT_IN_REVERSE:-false}"
SORT_BY_RECENT="${SORT_BY_RECENT:-false}" SORT_BY_RECENT="${SORT_BY_RECENT:-false}"
SORT_ARGS="${SORT_ARGS:-}" SORT_ARGS="${SORT_ARGS:-}"
UNIQ_ARGS="${UNIQ_ARGS:-}" UNIQ_ARGS="${UNIQ_ARGS:-}"
@ -435,6 +435,13 @@ main() {
rl_bm+=("$RUNLAUNCHER_BM_PRETEXT") rl_bm+=("$RUNLAUNCHER_BM_PRETEXT")
fi fi
[ "$SORT_BY_NUMBER" != "false" ] && NUMBERSORTARG="-n"
[ "$SORT_IN_REVERSE" != "false" ] && REVERSESORTARG="-r"
SORT_ARGS="$NUMBERSORTARG $REVERSESORTARG $SORT_ARGS"
read -ra uniq_args <<< "${UNIQ_ARGS}"
read -ra sort_args <<< "${SORT_ARGS}"
# $PATH listing # $PATH listing
case "$function" in case "$function" in
"run") "run")