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 c9a3bfaa 2018-05-21 omar.polo - Xft (optional)
32 c9a3bfaa 2018-05-21 omar.polo For TrueType (r) font support
33 be5b89f6 2018-05-18 omar.polo - pkg-config (optional)
34 be5b89f6 2018-05-18 omar.polo used in the makefile to generate `LIBS` and `CFLAGS` correctly
36 be5b89f6 2018-05-18 omar.polo ## Build
38 c9a3bfaa 2018-05-21 omar.polo As simple as `make`. By default both Xft and Xinerama are enabled, if
39 c9a3bfaa 2018-05-21 omar.polo you want to disable them just delete the relative `-DUSE_` from the
40 c9a3bfaa 2018-05-21 omar.polo `CFLAGS` and update the `OPTIONAL` variable. Of course you can delete
41 c9a3bfaa 2018-05-21 omar.polo both, or just one of them.
45 9c241438 2018-05-20 omar.polo - Does not run / Hangs
47 9c241438 2018-05-20 omar.polo At the startup mymenu will read `stdin` for a list of item, only
48 9c241438 2018-05-20 omar.polo then it'll display a window. Are you sure that you're passing
49 9c241438 2018-05-20 omar.polo something on standard input?
51 9c241438 2018-05-20 omar.polo - License
53 9c241438 2018-05-20 omar.polo The code is released under GPLv3, but I don't have strong
54 9c241438 2018-05-20 omar.polo preference regard licenses, so if you ask I may release the code
55 9c241438 2018-05-20 omar.polo also under a different license (a free software one of course).
57 9c241438 2018-05-20 omar.polo - Will feature $X be added?
59 9c241438 2018-05-20 omar.polo No. Or maybe Yes. In fact, it depends. Open an issue and let's
60 9c241438 2018-05-20 omar.polo discuss. If it's something that's trivial to achieve in combo with
61 9c241438 2018-05-20 omar.polo other tool maybe is not the case to add it here.
63 9c241438 2018-05-20 omar.polo - Is feature $Y present? What $Z do? How to achieve $W?
65 9c241438 2018-05-20 omar.polo Everything is documented in the man page. To read it, simply execute
66 9c241438 2018-05-20 omar.polo `man -l mymenu.1` or `mandoc mymenu.1 | less` (depending on your
67 9c241438 2018-05-20 omar.polo system the `-l` option may not be present).
71 be5b89f6 2018-05-18 omar.polo ## TODO
73 be5b89f6 2018-05-18 omar.polo - Command line flags
75 be5b89f6 2018-05-18 omar.polo At the moment the X Resource Database is the only way to interact
76 be5b89f6 2018-05-18 omar.polo with the graphic appearance of MyMenu.
78 be5b89f6 2018-05-18 omar.polo - Opacity support
80 b836b1ec 2018-05-18 omar.polo ## Scripts
82 8880d5e3 2018-05-19 omar.polo I'm using this script to launch MyMenu with custom item
84 b836b1ec 2018-05-18 omar.polo ``` shell
85 b836b1ec 2018-05-18 omar.polo #!/bin/sh
87 b836b1ec 2018-05-18 omar.polo cat <<EOF | /bin/sh -c "$(mymenu "$@")"
88 b836b1ec 2018-05-18 omar.polo sct 4500
90 b836b1ec 2018-05-18 omar.polo connect ethernet
91 b836b1ec 2018-05-18 omar.polo connect home
92 b836b1ec 2018-05-18 omar.polo connect phone
99 8880d5e3 2018-05-19 omar.polo You can generate a menu from the `.desktop` file with something like
102 8880d5e3 2018-05-19 omar.polo ``` shell
103 8880d5e3 2018-05-19 omar.polo #!/bin/sh
105 8880d5e3 2018-05-19 omar.polo getname() {
106 8880d5e3 2018-05-19 omar.polo cat $1 | grep '^Name=' | sed 's/^.*=//'
109 8880d5e3 2018-05-19 omar.polo getexec() {
110 8880d5e3 2018-05-19 omar.polo cat $1 | grep '^Exec=' | sed 's/^.*=//'
113 8880d5e3 2018-05-19 omar.polo desktop_files=`ls /usr/local/share/applications/*.desktop`
116 8880d5e3 2018-05-19 omar.polo for i in $desktop_files; do
117 8880d5e3 2018-05-19 omar.polo getname $i
119 8880d5e3 2018-05-19 omar.polo } | mymenu "$@" | {
120 8880d5e3 2018-05-19 omar.polo read prgname
121 8880d5e3 2018-05-19 omar.polo for i in $desktop_files; do
122 8880d5e3 2018-05-19 omar.polo name=`getname $i`
123 8880d5e3 2018-05-19 omar.polo if [ "x$prgname" = "x$name" ]; then
124 8880d5e3 2018-05-19 omar.polo exec `getexec $i`
130 8880d5e3 2018-05-19 omar.polo or generate a list of executables from `$PATH` like this:
132 8880d5e3 2018-05-19 omar.polo ``` shell
133 8880d5e3 2018-05-19 omar.polo #!/bin/sh
135 8880d5e3 2018-05-19 omar.polo path=`echo $PATH | sed 's/:/ /g'`
138 8880d5e3 2018-05-19 omar.polo for i in $path; do
139 8880d5e3 2018-05-19 omar.polo ls -F $i | grep '.*\*$' | sed 's/\*//'
141 8880d5e3 2018-05-19 omar.polo } | sort | /bin/sh -c "$(mymenu "$@")"
144 b836b1ec 2018-05-18 omar.polo Of course you can as well use the `dmenu_path` and `dmenu_run` scripts
145 b836b1ec 2018-05-18 omar.polo that (usually) comes with `dmenu`.