commit 630eb3682c87545cd76b3c2e069b9747019fa91d from: Omar Polo date: Wed Sep 19 15:55:01 2018 UTC update code examples + features in README added commit - 3bb7d28e7a99efe60e32ea7bf412766ff806d693 commit + 630eb3682c87545cd76b3c2e069b9747019fa91d blob - b24e17704aa3eb3d4d86402c260bd355b9c37a37 blob + 0c4f5bb2cabe9ff6d5e603b62295a467ac8b3f95 --- README.md +++ README.md @@ -23,6 +23,13 @@ out also the [template](Xexample) for the resources. --- +## Features + +- two layout: `horizontal` (a là dmenu) and `vertical` (a là rofi); +- highly customizable (width, height, position on the screen, colors, borders, ...); +- transparency support +- support for both Xft and bitmap font + ## Dependencies - Xlib @@ -78,12 +85,6 @@ should be enough. --- -## TODO - - - Improve the filtering process of the completions - - - Opacity support - ## Scripts I'm using this script to launch MyMenu with custom item @@ -103,42 +104,11 @@ zzz EOF ``` -You can generate a menu from the `.desktop` file with something like -this: +You can generate a list of executables from `$PATH` like this: ``` shell #!/bin/sh -getname() { - cat $1 | grep '^Name=' | sed 's/^.*=//' -} - -getexec() { - cat $1 | grep '^Exec=' | sed 's/^.*=//' -} - -desktop_files=`ls /usr/local/share/applications/*.desktop` - -{ - for i in $desktop_files; do - getname $i - done -} | mymenu "$@" | { - read prgname - for i in $desktop_files; do - name=`getname $i` - if [ "x$prgname" = "x$name" ]; then - exec `getexec $i` - fi - done -} -``` - -or generate a list of executables from `$PATH` like this: - -``` shell -#!/bin/sh - path=`echo $PATH | sed 's/:/ /g'` { @@ -148,5 +118,14 @@ path=`echo $PATH | sed 's/:/ /g'` } | sort -f | /bin/sh -c "$(mymenu "$@")" ``` +You can, for example, select a song to play from the current queue (in mpd), with + +```shell +fmt="%position% %artist% - %title%" +if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then + mpc play $(echo $song | sed "s/ .*$//") +fi +``` + Of course you can as well use the `dmenu_path` and `dmenu_run` scripts that (usually) comes with `dmenu`. blob - 3ef368bc51908e88ff65574a36c0e2fe5c811e36 blob + d6c2db3e5ce25eb32b75032f5ca87b1f620a44c2 --- mymenu.1 +++ mymenu.1 @@ -240,9 +240,9 @@ EOF .It Select and play a song from the current mpd playlist .Bd -literal -offset indent -fmt="%position%) %artist% - %title%" -if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d ") "); then - mpc play $(echo $song | sed "s/).*$//") +fmt="%position% %artist% - %title%" +if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then + mpc play $(echo $song | sed "s/ .*$//") fi .Ed .El blob - ee7f58307b534e25813647f01a5ae331e7cdd8d9 blob + 30d2574de592d314de3b34b430137ee193133ae4 --- mymenu.1.md +++ mymenu.1.md @@ -347,9 +347,9 @@ fails. * Select and play a song from the current mpd playlist - fmt="%position%) %artist% - %title%" - if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d ") "); then - mpc play $(echo $song | sed "s/).*$//") + fmt="%position% %artist% - %title%" + if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then + mpc play $(echo $song | sed "s/ .*$//") fi # SEE ALSO @@ -382,4 +382,4 @@ Omar Polo <omar.polo@europecom.net> height of the window, remember to override the x and y coordinates as well. -OpenBSD 6.4 - September 16, 2018 +OpenBSD 6.4 - September 19, 2018