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 ## Dependencies
28 - Xlib
29 - Xinerama *(optional)* for multi-monitor support
30 - Xft *(optional)* for TrueType font support
31 - pkg-config *(optional)* to generate `LIBS` and `CFLAGS`
32 - mandoc *(optional)* to generate the
33 [markdown version of the manpage](mymenu.1.md)
35 ## Build
37 As simple as `make` (or `make gnu` if you're using GNU libc). Keep in
38 mind that, by default, both Xft and Xinerama are enabled. So, you may
39 want to run:
41 - `make no_xft` to build without xft support;
42 - `make no_xinerama` to build without xinerama support;
43 - `make no_xft_xinerama` to build without xinerama *and* no xft support.
45 Or you can update the first lines of the `Makefile` customizing
46 `OPTIONAL` and `CDEFS` to your needs.
48 #### ignore case completion / don't have `strcasestr(3)`
50 If you want to build without the ignore case completion or on your
51 platform `strcasestr(3)` isn't available, you have to update the
52 `Makefile` and remove `-DUSE_STRCASESTR`. A simple
53 ``` shell
54 sed -i.orig 's/-DUSE_STRCASESTR//g' Makefile
55 ```
56 should be enough.
59 ## FAQ
61 - Does not run / Hangs
63 At the startup mymenu will read `stdin` for a list of item, only
64 then it'll display a window. Are you sure that you're passing
65 something on standard input?
67 - Will feature $X be added?
69 No. Or maybe yes. In fact, it depends. Open an issue and let's
70 discuss. If it's something that's trivial to achieve in combo with
71 other tool maybe is not the case to add it here.
73 - Is feature $Y present? What $Z do? How to achieve $W?
75 Everything is documented in the [man page](mymenu.1.md). To read
76 it, simply execute `man -l mymenu.1` or `mandoc mymenu.1 | less`
77 (depending on your system the `-l` option may not be present).
79 ---
81 ## TODO
83 - Improve UTF8 support
85 The whole UTF8 support is still kinda naïve and should definitely
86 be improved.
88 - Opacity support
90 - Command line flags
92 At the moment the X Resource Database is the only way to interact
93 with the graphic appearance of MyMenu.
95 ## Scripts
97 I'm using this script to launch MyMenu with custom item
99 ``` shell
100 #!/bin/sh
102 cat <<EOF | /bin/sh -c "$(mymenu "$@")"
103 sct 4500
104 lock
105 connect ethernet
106 connect home
107 connect phone
108 ZZZ
109 zzz
110 ...
111 EOF
112 ```
114 You can generate a menu from the `.desktop` file with something like
115 this:
117 ``` shell
118 #!/bin/sh
120 getname() {
121 cat $1 | grep '^Name=' | sed 's/^.*=//'
124 getexec() {
125 cat $1 | grep '^Exec=' | sed 's/^.*=//'
128 desktop_files=`ls /usr/local/share/applications/*.desktop`
131 for i in $desktop_files; do
132 getname $i
133 done
134 } | mymenu "$@" | {
135 read prgname
136 for i in $desktop_files; do
137 name=`getname $i`
138 if [ "x$prgname" = "x$name" ]; then
139 exec `getexec $i`
140 fi
141 done
143 ```
145 or generate a list of executables from `$PATH` like this:
147 ``` shell
148 #!/bin/sh
150 path=`echo $PATH | sed 's/:/ /g'`
153 for i in $path; do
154 ls -F $i | grep '.*\*$' | sed 's/\*//'
155 done
156 } | sort -f | /bin/sh -c "$(mymenu "$@")"
157 ```
159 Of course you can as well use the `dmenu_path` and `dmenu_run` scripts
160 that (usually) comes with `dmenu`.