1 be5b89f6 2018-05-18 omar.polo # MyMenu
3 eccc9e7a 2018-05-20 omar.polo > A replacement for dmenu, 'cause I was bored
5 be5b89f6 2018-05-18 omar.polo ![MyMenu works!](screen.png)
7 36a15a9f 2018-05-19 omar.polo ![MyMenu alternate layout](screen-alt.png)
11 be5b89f6 2018-05-18 omar.polo ## What?
13 eccc9e7a 2018-05-20 omar.polo This is a replacement for `dmenu(1)`.
15 be5b89f6 2018-05-18 omar.polo ## Why?
17 be5b89f6 2018-05-18 omar.polo This was the perfect excuse to learn how to make window with Xlib.
19 be5b89f6 2018-05-18 omar.polo ## How?
21 b3f35c85 2018-05-18 omar.polo Check out the [manpage](mymenu.1) for further documentation. Check out
22 b3f35c85 2018-05-18 omar.polo also the [template](Xexample) for the resources.
26 be5b89f6 2018-05-18 omar.polo ## Dependencies
29 be5b89f6 2018-05-18 omar.polo - Xinerama (optional)
30 be5b89f6 2018-05-18 omar.polo For multi-monitor support
31 be5b89f6 2018-05-18 omar.polo - pkg-config (optional)
32 be5b89f6 2018-05-18 omar.polo used in the makefile to generate `LIBS` and `CFLAGS` correctly
34 be5b89f6 2018-05-18 omar.polo ## Build
36 be5b89f6 2018-05-18 omar.polo As simple as `make`. If you want to disable Xinerama support just
37 be5b89f6 2018-05-18 omar.polo delete `-DUSE_XINERAMA` from the `CFLAGS` and `xinerama` from the
38 be5b89f6 2018-05-18 omar.polo `pkg-config` call from the Makefile.
42 9c241438 2018-05-20 omar.polo - Does not run / Hangs
44 9c241438 2018-05-20 omar.polo At the startup mymenu will read `stdin` for a list of item, only
45 9c241438 2018-05-20 omar.polo then it'll display a window. Are you sure that you're passing
46 9c241438 2018-05-20 omar.polo something on standard input?
48 9c241438 2018-05-20 omar.polo - License
50 9c241438 2018-05-20 omar.polo The code is released under GPLv3, but I don't have strong
51 9c241438 2018-05-20 omar.polo preference regard licenses, so if you ask I may release the code
52 9c241438 2018-05-20 omar.polo also under a different license (a free software one of course).
54 9c241438 2018-05-20 omar.polo - Will feature $X be added?
56 9c241438 2018-05-20 omar.polo No. Or maybe Yes. In fact, it depends. Open an issue and let's
57 9c241438 2018-05-20 omar.polo discuss. If it's something that's trivial to achieve in combo with
58 9c241438 2018-05-20 omar.polo other tool maybe is not the case to add it here.
60 9c241438 2018-05-20 omar.polo - Is feature $Y present? What $Z do? How to achieve $W?
62 9c241438 2018-05-20 omar.polo Everything is documented in the man page. To read it, simply execute
63 9c241438 2018-05-20 omar.polo `man -l mymenu.1` or `mandoc mymenu.1 | less` (depending on your
64 9c241438 2018-05-20 omar.polo system the `-l` option may not be present).
68 be5b89f6 2018-05-18 omar.polo ## TODO
70 be5b89f6 2018-05-18 omar.polo - Command line flags
72 be5b89f6 2018-05-18 omar.polo At the moment the X Resource Database is the only way to interact
73 be5b89f6 2018-05-18 omar.polo with the graphic appearance of MyMenu.
75 be5b89f6 2018-05-18 omar.polo - Optional TrueType support
77 be5b89f6 2018-05-18 omar.polo - Opacity support
79 b836b1ec 2018-05-18 omar.polo ## Scripts
81 8880d5e3 2018-05-19 omar.polo I'm using this script to launch MyMenu with custom item
83 b836b1ec 2018-05-18 omar.polo ``` shell
84 b836b1ec 2018-05-18 omar.polo #!/bin/sh
86 b836b1ec 2018-05-18 omar.polo cat <<EOF | /bin/sh -c "$(mymenu "$@")"
87 b836b1ec 2018-05-18 omar.polo sct 4500
89 b836b1ec 2018-05-18 omar.polo connect ethernet
90 b836b1ec 2018-05-18 omar.polo connect home
91 b836b1ec 2018-05-18 omar.polo connect phone
98 8880d5e3 2018-05-19 omar.polo You can generate a menu from the `.desktop` file with something like
101 8880d5e3 2018-05-19 omar.polo ``` shell
102 8880d5e3 2018-05-19 omar.polo #!/bin/sh
104 8880d5e3 2018-05-19 omar.polo getname() {
105 8880d5e3 2018-05-19 omar.polo cat $1 | grep '^Name=' | sed 's/^.*=//'
108 8880d5e3 2018-05-19 omar.polo getexec() {
109 8880d5e3 2018-05-19 omar.polo cat $1 | grep '^Exec=' | sed 's/^.*=//'
112 8880d5e3 2018-05-19 omar.polo desktop_files=`ls /usr/local/share/applications/*.desktop`
115 8880d5e3 2018-05-19 omar.polo for i in $desktop_files; do
116 8880d5e3 2018-05-19 omar.polo getname $i
118 8880d5e3 2018-05-19 omar.polo } | mymenu "$@" | {
119 8880d5e3 2018-05-19 omar.polo read prgname
120 8880d5e3 2018-05-19 omar.polo for i in $desktop_files; do
121 8880d5e3 2018-05-19 omar.polo name=`getname $i`
122 8880d5e3 2018-05-19 omar.polo if [ "x$prgname" = "x$name" ]; then
123 8880d5e3 2018-05-19 omar.polo exec `getexec $i`
129 8880d5e3 2018-05-19 omar.polo or generate a list of executables from `$PATH` like this:
131 8880d5e3 2018-05-19 omar.polo ``` shell
132 8880d5e3 2018-05-19 omar.polo #!/bin/sh
134 8880d5e3 2018-05-19 omar.polo path=`echo $PATH | sed 's/:/ /g'`
137 8880d5e3 2018-05-19 omar.polo for i in $path; do
138 8880d5e3 2018-05-19 omar.polo ls -F $i | grep '.*\*$' | sed 's/\*//'
140 8880d5e3 2018-05-19 omar.polo } | sort | /bin/sh -c "$(mymenu "$@")"
143 b836b1ec 2018-05-18 omar.polo Of course you can as well use the `dmenu_path` and `dmenu_run` scripts
144 b836b1ec 2018-05-18 omar.polo that (usually) comes with `dmenu`.