Blame


1 be5b89f6 2018-05-18 omar.polo # MyMenu
2 be5b89f6 2018-05-18 omar.polo
3 68145755 2018-07-01 omar.polo > A menu for Xorg, 'cause I was bored
4 be5b89f6 2018-05-18 omar.polo
5 be5b89f6 2018-05-18 omar.polo ![MyMenu works!](screen.png)
6 be5b89f6 2018-05-18 omar.polo
7 36a15a9f 2018-05-19 omar.polo ![MyMenu alternate layout](screen-alt.png)
8 36a15a9f 2018-05-19 omar.polo
9 be5b89f6 2018-05-18 omar.polo ---
10 be5b89f6 2018-05-18 omar.polo
11 be5b89f6 2018-05-18 omar.polo ## What?
12 be5b89f6 2018-05-18 omar.polo
13 68145755 2018-07-01 omar.polo This is a simple menu for Xorg, like `dmenu(1)`.
14 be5b89f6 2018-05-18 omar.polo
15 be5b89f6 2018-05-18 omar.polo ## Why?
16 be5b89f6 2018-05-18 omar.polo
17 c1be85dd 2018-06-14 omar.polo This was the perfect excuse to learn how to use Xlib.
18 be5b89f6 2018-05-18 omar.polo
19 be5b89f6 2018-05-18 omar.polo ## How?
20 be5b89f6 2018-05-18 omar.polo
21 c1be85dd 2018-06-14 omar.polo Check out the [manpage](mymenu.1.md) for further documentation. Check
22 c1be85dd 2018-06-14 omar.polo out also the [template](Xexample) for the resources.
23 be5b89f6 2018-05-18 omar.polo
24 be5b89f6 2018-05-18 omar.polo ---
25 be5b89f6 2018-05-18 omar.polo
26 630eb368 2018-09-19 omar.polo ## Features
27 630eb368 2018-09-19 omar.polo
28 630eb368 2018-09-19 omar.polo - two layout: `horizontal` (a là dmenu) and `vertical` (a là rofi);
29 630eb368 2018-09-19 omar.polo - highly customizable (width, height, position on the screen, colors, borders, ...);
30 630eb368 2018-09-19 omar.polo - transparency support
31 630eb368 2018-09-19 omar.polo - support for both Xft and bitmap font
32 630eb368 2018-09-19 omar.polo
33 be5b89f6 2018-05-18 omar.polo ## Dependencies
34 be5b89f6 2018-05-18 omar.polo
35 be5b89f6 2018-05-18 omar.polo - Xlib
36 7731c8ff 2022-07-01 op - Xinerama for multi-monitor support
37 7731c8ff 2022-07-01 op - Xft for TrueType font support
38 7731c8ff 2022-07-01 op - pkg-config *(optional)* to aid the autoconfiguration
39 e9107672 2018-07-01 omar.polo - mandoc *(optional)* to generate the
40 e9107672 2018-07-01 omar.polo [markdown version of the manpage](mymenu.1.md)
41 be5b89f6 2018-05-18 omar.polo
42 be5b89f6 2018-05-18 omar.polo ## Build
43 be5b89f6 2018-05-18 omar.polo
44 7731c8ff 2022-07-01 op The usual spell:
45 be5b89f6 2018-05-18 omar.polo
46 7731c8ff 2022-07-01 op $ ./configure
47 7731c8ff 2022-07-01 op $ make
48 75faf30e 2018-05-22 omar.polo
49 9c241438 2018-05-20 omar.polo ## FAQ
50 9c241438 2018-05-20 omar.polo
51 9c241438 2018-05-20 omar.polo - Does not run / Hangs
52 9c241438 2018-05-20 omar.polo
53 9c241438 2018-05-20 omar.polo At the startup mymenu will read `stdin` for a list of item, only
54 9c241438 2018-05-20 omar.polo then it'll display a window. Are you sure that you're passing
55 9c241438 2018-05-20 omar.polo something on standard input?
56 9c241438 2018-05-20 omar.polo
57 9c241438 2018-05-20 omar.polo - Will feature $X be added?
58 9c241438 2018-05-20 omar.polo
59 c1be85dd 2018-06-14 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.
62 9c241438 2018-05-20 omar.polo
63 9c241438 2018-05-20 omar.polo - Is feature $Y present? What $Z do? How to achieve $W?
64 9c241438 2018-05-20 omar.polo
65 c1be85dd 2018-06-14 omar.polo Everything is documented in the [man page](mymenu.1.md). To read
66 c1be85dd 2018-06-14 omar.polo it, simply execute `man -l mymenu.1` or `mandoc mymenu.1 | less`
67 c1be85dd 2018-06-14 omar.polo (depending on your system the `-l` option may not be present).
68 9c241438 2018-05-20 omar.polo
69 be5b89f6 2018-05-18 omar.polo ---
70 be5b89f6 2018-05-18 omar.polo
71 b836b1ec 2018-05-18 omar.polo ## Scripts
72 b836b1ec 2018-05-18 omar.polo
73 8880d5e3 2018-05-19 omar.polo I'm using this script to launch MyMenu with custom item
74 b836b1ec 2018-05-18 omar.polo
75 b836b1ec 2018-05-18 omar.polo ``` shell
76 b836b1ec 2018-05-18 omar.polo #!/bin/sh
77 b836b1ec 2018-05-18 omar.polo
78 b836b1ec 2018-05-18 omar.polo cat <<EOF | /bin/sh -c "$(mymenu "$@")"
79 b836b1ec 2018-05-18 omar.polo sct 4500
80 b836b1ec 2018-05-18 omar.polo lock
81 b836b1ec 2018-05-18 omar.polo connect ethernet
82 b836b1ec 2018-05-18 omar.polo connect home
83 b836b1ec 2018-05-18 omar.polo connect phone
84 8880d5e3 2018-05-19 omar.polo ZZZ
85 b836b1ec 2018-05-18 omar.polo zzz
86 b836b1ec 2018-05-18 omar.polo ...
87 b836b1ec 2018-05-18 omar.polo EOF
88 b836b1ec 2018-05-18 omar.polo ```
89 b836b1ec 2018-05-18 omar.polo
90 630eb368 2018-09-19 omar.polo You can generate a list of executables from `$PATH` like this:
91 8880d5e3 2018-05-19 omar.polo
92 8880d5e3 2018-05-19 omar.polo ``` shell
93 8880d5e3 2018-05-19 omar.polo #!/bin/sh
94 8880d5e3 2018-05-19 omar.polo
95 8880d5e3 2018-05-19 omar.polo path=`echo $PATH | sed 's/:/ /g'`
96 8880d5e3 2018-05-19 omar.polo
97 adbd7a73 2022-07-01 op for p in $path; do
98 adbd7a73 2022-07-01 op for f in "$p"/*; do
99 adbd7a73 2022-07-01 op [ -x "$f" ] && echo "${f##*/}"
100 23ae5997 2022-07-01 op done
101 adbd7a73 2022-07-01 op done | sort -fu | /bin/sh -c "$(mymenu "$@")"
102 8880d5e3 2018-05-19 omar.polo ```
103 8880d5e3 2018-05-19 omar.polo
104 adbd7a73 2022-07-01 op You can, for example, select a song to play from the current queue of
105 adbd7a73 2022-07-01 op [amused][amused]
106 630eb368 2018-09-19 omar.polo
107 630eb368 2018-09-19 omar.polo ```shell
108 23ae5997 2022-07-01 op if song=$(amused show | mymenu -p "Song: " -A); then
109 23ae5997 2022-07-01 op amused jump "$song"
110 23ae5997 2022-07-01 op fi
111 23ae5997 2022-07-01 op ```
112 23ae5997 2022-07-01 op
113 23ae5997 2022-07-01 op The same, but with mpd:
114 23ae5997 2022-07-01 op
115 23ae5997 2022-07-01 op ```shell
116 630eb368 2018-09-19 omar.polo fmt="%position% %artist% - %title%"
117 630eb368 2018-09-19 omar.polo if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then
118 adbd7a73 2022-07-01 op mpc play $(echo $song | sed "s/ .*$//")
119 630eb368 2018-09-19 omar.polo fi
120 630eb368 2018-09-19 omar.polo ```
121 630eb368 2018-09-19 omar.polo
122 b836b1ec 2018-05-18 omar.polo Of course you can as well use the `dmenu_path` and `dmenu_run` scripts
123 b836b1ec 2018-05-18 omar.polo that (usually) comes with `dmenu`.
124 23ae5997 2022-07-01 op
125 23ae5997 2022-07-01 op [amused]: https://projects.omarpolo.com/amused.html