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 *(optional)* for multi-monitor support
37 - Xft *(optional)* for TrueType font support
38 - pkg-config *(optional)* to generate `LIBS` and `CFLAGS`
39 - mandoc *(optional)* to generate the
40 [markdown version of the manpage](mymenu.1.md)
42 ## Build
44 As simple as `make` (or `make gnu` if you're using GNU libc). Keep in
45 mind that, by default, both Xft and Xinerama are enabled. So, you may
46 want to run:
48 - `make no_xft` to build without xft support;
49 - `make no_xinerama` to build without xinerama support;
50 - `make no_xft_xinerama` to build without xinerama *and* no xft support.
52 Or you can update the first lines of the `Makefile` customizing
53 `OPTIONAL` and `CDEFS` to your needs.
55 #### ignore case completion / don't have `strcasestr(3)`
57 If you want to build without the ignore case completion or on your
58 platform `strcasestr(3)` isn't available, you have to update the
59 `Makefile` and remove `-DUSE_STRCASESTR`. A simple
60 ``` shell
61 sed -i.orig 's/-DUSE_STRCASESTR//g' Makefile
62 ```
63 should be enough.
66 ## FAQ
68 - Does not run / Hangs
70 At the startup mymenu will read `stdin` for a list of item, only
71 then it'll display a window. Are you sure that you're passing
72 something on standard input?
74 - Will feature $X be added?
76 No. Or maybe yes. In fact, it depends. Open an issue and let's
77 discuss. If it's something that's trivial to achieve in combo with
78 other tool maybe is not the case to add it here.
80 - Is feature $Y present? What $Z do? How to achieve $W?
82 Everything is documented in the [man page](mymenu.1.md). To read
83 it, simply execute `man -l mymenu.1` or `mandoc mymenu.1 | less`
84 (depending on your system the `-l` option may not be present).
86 ---
88 ## Scripts
90 I'm using this script to launch MyMenu with custom item
92 ``` shell
93 #!/bin/sh
95 cat <<EOF | /bin/sh -c "$(mymenu "$@")"
96 sct 4500
97 lock
98 connect ethernet
99 connect home
100 connect phone
101 ZZZ
102 zzz
103 ...
104 EOF
105 ```
107 You can generate a list of executables from `$PATH` like this:
109 ``` shell
110 #!/bin/sh
112 path=`echo $PATH | sed 's/:/ /g'`
115 for i in $path; do
116 ls -F $i | sed -n 's/\*$//p'
117 done
118 } | sort -f | /bin/sh -c "$(mymenu "$@")"
119 ```
121 You can, for example, select a song to play from the current queue (in mpd), with
123 ```shell
124 fmt="%position% %artist% - %title%"
125 if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then
126 mpc play $(echo $song | sed "s/ .*$//")
127 fi
128 ```
130 Of course you can as well use the `dmenu_path` and `dmenu_run` scripts
131 that (usually) comes with `dmenu`.