Blob


1 # MyMenu
3 > A menu for Xorg, 'cause I was bored
5 ![MyMenu works!](screen.png)
7 ![MyMenu alternate layout](screen-alt.png)
9 ---
11 ## What?
13 This is a simple menu for Xorg, like `dmenu(1)`.
15 ## Why?
17 This was the perfect excuse to learn how to use Xlib.
19 ## How?
21 Check out the [manpage](mymenu.1.md) for further documentation. Check
22 out also the [template](Xexample) for the resources.
24 ---
26 ## Features
28 - two layout: `horizontal` (a là dmenu) and `vertical` (a là rofi);
29 - highly customizable (width, height, position on the screen, colors, borders, ...);
30 - transparency support
31 - support for both Xft and bitmap font
33 ## Dependencies
35 - Xlib
36 - Xinerama for multi-monitor support
37 - Xft for TrueType font support
38 - pkg-config *(optional)* to aid the autoconfiguration
39 - mandoc *(optional)* to generate the
40 [markdown version of the manpage](mymenu.1.md)
42 ## Build
44 The usual spell:
46 $ ./configure
47 $ make
49 ## FAQ
51 - Does not run / Hangs
53 At the startup mymenu will read `stdin` for a list of item, only
54 then it'll display a window. Are you sure that you're passing
55 something on standard input?
57 - Will feature $X be added?
59 No. Or maybe yes. In fact, it depends. Open an issue and let's
60 discuss. If it's something that's trivial to achieve in combo with
61 other tool maybe is not the case to add it here.
63 - Is feature $Y present? What $Z do? How to achieve $W?
65 Everything is documented in the [man page](mymenu.1.md). To read
66 it, simply execute `man -l mymenu.1` or `mandoc mymenu.1 | less`
67 (depending on your system the `-l` option may not be present).
69 ---
71 ## Scripts
73 I'm using this script to launch MyMenu with custom item
75 ``` shell
76 #!/bin/sh
78 cat <<EOF | /bin/sh -c "$(mymenu "$@")"
79 sct 4500
80 lock
81 connect ethernet
82 connect home
83 connect phone
84 ZZZ
85 zzz
86 ...
87 EOF
88 ```
90 You can generate a list of executables from `$PATH` like this:
92 ``` shell
93 #!/bin/sh
95 path=`echo $PATH | sed 's/:/ /g'`
97 for p in $path; do
98 for f in "$p"/*; do
99 [ -x "$f" ] && echo "${f##*/}"
100 done
101 done | sort -fu | /bin/sh -c "$(mymenu "$@")"
102 ```
104 You can, for example, select a song to play from the current queue of
105 [amused][amused]
107 ```shell
108 if song=$(amused show | mymenu -p "Song: " -A); then
109 amused jump "$song"
110 fi
111 ```
113 The same, but with mpd:
115 ```shell
116 fmt="%position% %artist% - %title%"
117 if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then
118 mpc play $(echo $song | sed "s/ .*$//")
119 fi
120 ```
122 Of course you can as well use the `dmenu_path` and `dmenu_run` scripts
123 that (usually) comes with `dmenu`.
125 [amused]: https://projects.omarpolo.com/amused.html