diff --git a/README.md b/README.md index f8bc9db..65e573d 100644 --- a/README.md +++ b/README.md @@ -182,3 +182,5 @@ Before contributing, please see [this article](https://spmenu.speedie.site/Contr spmenu has [a wiki](https://spmenu.speedie.site) for more extensive documentation. Contributions to the wiki are appreciated, and can be done through [the Git repository](https://git.speedie.site/speedie/spmenu-wiki). + +If you need help, you can also check out [my Matrix space](https://matrix.speedie.site). diff --git a/docs/run-docs.md b/docs/run-docs.md index cab79fd..f34a7b0 100644 --- a/docs/run-docs.md +++ b/docs/run-docs.md @@ -52,6 +52,11 @@ cache (useful if you just installed/uninstalled a program) run `spmenu_run -cc`. **NOTE: By default it will hide any entries matching `spmenu` (for convenience) but you can unhide these if you wish through the configuration file.** +Flatpaks are also functional, provided they use valid .desktop entries. You +can use Flatpaks with spmenu_run by passing `-d`. $DESKTOP_DIR and +$ICON_DIR must contain Flatpak paths though. If you have a new config, +these variables should be defined properly already. + ## Bookmarking spmenu_run provides bookmarking entries or just general text if preferred. To diff --git a/scripts/spmenu_desktop b/scripts/spmenu_desktop old mode 100644 new mode 100755 index bd78cb3..b8e4b91 --- a/scripts/spmenu_desktop +++ b/scripts/spmenu_desktop @@ -67,7 +67,7 @@ print_desktop_list() { [ "$PRINT_LOGS_STDERR" = "true" ] && printf "spmenu_run: Updating .desktop entries.\n" >> /dev/stderr - icons="$(find "${icondir[@]}" -type f 2>/dev/null)" + icons="$(find -L "${icondir[@]}" -type f 2>/dev/null)" [ -z "$entry" ] && entry="$(find -L "${desktopdir[@]}" -type f -name '*.desktop' 2>/dev/null)" [ -z "$entry_c" ] && entry_c="$(printf "%s\n" "$entry" | grep -c "")" @@ -143,13 +143,20 @@ print_desktop_list() { mapfile -t it_only < "$ONLYFILE" 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 } d_print_array() { 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 [ "$RESPECT_ONLYSHOWIN" != "false" ] && [ "${it_only[i]}" != "false" ] && continue [ "$RESPECT_NODISPLAY" != "false" ] && [ "${it_display[i]}" != "true" ] && continue @@ -214,7 +221,7 @@ print_desktop_menu() { 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 [ "$menusel" = "?" ] && print_desktop_help && print_desktop_menu diff --git a/scripts/spmenu_path b/scripts/spmenu_path index 530c1f3..9d52e11 100755 --- a/scripts/spmenu_path +++ b/scripts/spmenu_path @@ -5,31 +5,20 @@ # See LICENSE file for copyright and license details. 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}" print_menu() { print() { - compgen -c | \ - grep -vE "$HIDDEN_KEYWORDS" | \ - grep -E "$KEYWORDS" + compgen -c | \ + grep -vE "$HIDDEN_KEYWORDS" | \ + grep -E "$KEYWORDS" - [ "$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 + [ "$DISPLAY_BOOKMARKS" != "false" ] && bookmark_path } + print | sort "${sort_args[@]}" | cut -d' ' -f 2 2>&1 + } + # uniq if [ "$DISPLAY_DUPLICATES" != "false" ]; then print_menu diff --git a/scripts/spmenu_run b/scripts/spmenu_run old mode 100644 new mode 100755 index 738f871..5f8e3d0 --- a/scripts/spmenu_run +++ b/scripts/spmenu_run @@ -20,8 +20,8 @@ RUNLAUNCHER="${RUNLAUNCHER:-spmenu}" PREFIX="${PREFIX:-/usr}" DESTDIR="${DESTDIR:-}" STDOUT="${STDOUT:-false}" -SORT_BY_NUMBER="${SORT_BY_NUMBER:-true}" -SORT_IN_REVERSE="${SORT_IN_REVERSE:-true}" +SORT_BY_NUMBER="${SORT_BY_NUMBER:-false}" +SORT_IN_REVERSE="${SORT_IN_REVERSE:-false}" SORT_BY_RECENT="${SORT_BY_RECENT:-false}" SORT_ARGS="${SORT_ARGS:-}" UNIQ_ARGS="${UNIQ_ARGS:-}" @@ -435,6 +435,13 @@ main() { rl_bm+=("$RUNLAUNCHER_BM_PRETEXT") 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 case "$function" in "run") diff --git a/spmenu.1 b/spmenu.1 index bd55282..6bc93c9 100644 --- a/spmenu.1 +++ b/spmenu.1 @@ -1,5 +1,5 @@ '\" t -.\" Automatically generated by Pandoc 3.1.2 +.\" Automatically generated by Pandoc 3.1.6 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. diff --git a/spmenu_run.1 b/spmenu_run.1 index 9080029..5b13182 100644 --- a/spmenu_run.1 +++ b/spmenu_run.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pandoc 3.1.2 +.\" Automatically generated by Pandoc 3.1.6 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. @@ -77,6 +77,12 @@ run \f[V]spmenu_run -cc\f[R]. \f[B]NOTE: By default it will hide any entries matching \f[VB]spmenu\f[B] (for convenience) but you can unhide these if you wish through the configuration file.\f[R] +.PP +Flatpaks are also functional, provided they use valid .desktop entries. +You can use Flatpaks with spmenu_run by passing \f[V]-d\f[R]. +$DESKTOP_DIR and $ICON_DIR must contain Flatpak paths though. +If you have a new config, these variables should be defined properly +already. .SS Bookmarking .PP spmenu_run provides bookmarking entries or just general text if diff --git a/spmenu_test.1 b/spmenu_test.1 index 449c3c0..db91bfe 100644 --- a/spmenu_test.1 +++ b/spmenu_test.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pandoc 3.1.2 +.\" Automatically generated by Pandoc 3.1.6 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font.