commit 23ae59970f29d0f5d4d43ca1c8393c1611ab6e6c from: Omar Polo date: Fri Jul 01 20:42:08 2022 UTC update the examples in the readme commit - 7731c8ffbe9868165d22f905cf07b677326beea6 commit + 23ae59970f29d0f5d4d43ca1c8393c1611ab6e6c blob - 477c516f24407ae9de992047a1dc6a39701b1549 blob + 6e431d8f6f726c1ee48579620166eacad1ee2f66 --- README.md +++ README.md @@ -95,15 +95,25 @@ You can generate a list of executables from `$PATH` li path=`echo $PATH | sed 's/:/ /g'` { - for i in $path; do - ls -F $i | sed -n 's/\*$//p' - done -} | sort -f | /bin/sh -c "$(mymenu "$@")" + for p in $path; do + for f in "$p"/*; do + [ -x "$f" ] && echo "${f##*/}" + done + done +} | sort -fu | /bin/sh -c "$(mymenu "$@")" ``` -You can, for example, select a song to play from the current queue (in mpd), with +You can, for example, select a song to play from the current queue of [amused][amused] ```shell +if song=$(amused show | mymenu -p "Song: " -A); then + amused jump "$song" +fi +``` + +The same, but with mpd: + +```shell fmt="%position% %artist% - %title%" if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then mpc play $(echo $song | sed "s/ .*$//") @@ -112,3 +122,5 @@ fi Of course you can as well use the `dmenu_path` and `dmenu_run` scripts that (usually) comes with `dmenu`. + +[amused]: https://projects.omarpolo.com/amused.html