Blame
Date:
Fri Jul 1 20:51:10 2022 UTC
Message:
minor tweaks
001
2018-05-18
omar.pol
# MyMenu
002
2018-05-18
omar.pol
003
2018-07-01
omar.pol
> A menu for Xorg, 'cause I was bored
004
2018-05-18
omar.pol
005
2018-05-18
omar.pol
![MyMenu works!](screen.png)
006
2018-05-18
omar.pol
007
2018-05-19
omar.pol
![MyMenu alternate layout](screen-alt.png)
008
2018-05-19
omar.pol
009
2018-05-18
omar.pol
---
010
2018-05-18
omar.pol
011
2018-05-18
omar.pol
## What?
012
2018-05-18
omar.pol
013
2018-07-01
omar.pol
This is a simple menu for Xorg, like `dmenu(1)`.
014
2018-05-18
omar.pol
015
2018-05-18
omar.pol
## Why?
016
2018-05-18
omar.pol
017
2018-06-14
omar.pol
This was the perfect excuse to learn how to use Xlib.
018
2018-05-18
omar.pol
019
2018-05-18
omar.pol
## How?
020
2018-05-18
omar.pol
021
2018-06-14
omar.pol
Check out the [manpage](mymenu.1.md) for further documentation. Check
022
2018-06-14
omar.pol
out also the [template](Xexample) for the resources.
023
2018-05-18
omar.pol
024
2018-05-18
omar.pol
---
025
2018-05-18
omar.pol
026
2018-09-19
omar.pol
## Features
027
2018-09-19
omar.pol
028
2018-09-19
omar.pol
- two layout: `horizontal` (a là dmenu) and `vertical` (a là rofi);
029
2018-09-19
omar.pol
- highly customizable (width, height, position on the screen, colors, borders, ...);
030
2018-09-19
omar.pol
- transparency support
031
2018-09-19
omar.pol
- support for both Xft and bitmap font
032
2018-09-19
omar.pol
033
2018-05-18
omar.pol
## Dependencies
034
2018-05-18
omar.pol
035
2018-05-18
omar.pol
- Xlib
036
2022-07-01
op
- Xinerama for multi-monitor support
037
2022-07-01
op
- Xft for TrueType font support
038
2022-07-01
op
- pkg-config *(optional)* to aid the autoconfiguration
039
2018-07-01
omar.pol
- mandoc *(optional)* to generate the
040
2018-07-01
omar.pol
[markdown version of the manpage](mymenu.1.md)
041
2018-05-18
omar.pol
042
2018-05-18
omar.pol
## Build
043
2018-05-18
omar.pol
044
2022-07-01
op
The usual spell:
045
2018-05-18
omar.pol
046
2022-07-01
op
$ ./configure
047
2022-07-01
op
$ make
048
2018-05-22
omar.pol
049
2018-05-20
omar.pol
## FAQ
050
2018-05-20
omar.pol
051
2018-05-20
omar.pol
- Does not run / Hangs
052
2018-05-20
omar.pol
053
2018-05-20
omar.pol
At the startup mymenu will read `stdin` for a list of item, only
054
2018-05-20
omar.pol
then it'll display a window. Are you sure that you're passing
055
2018-05-20
omar.pol
something on standard input?
056
2018-05-20
omar.pol
057
2018-05-20
omar.pol
- Will feature $X be added?
058
2018-05-20
omar.pol
059
2018-06-14
omar.pol
No. Or maybe yes. In fact, it depends. Open an issue and let's
060
2018-05-20
omar.pol
discuss. If it's something that's trivial to achieve in combo with
061
2018-05-20
omar.pol
other tool maybe is not the case to add it here.
062
2018-05-20
omar.pol
063
2018-05-20
omar.pol
- Is feature $Y present? What $Z do? How to achieve $W?
064
2018-05-20
omar.pol
065
2018-06-14
omar.pol
Everything is documented in the [man page](mymenu.1.md). To read
066
2018-06-14
omar.pol
it, simply execute `man -l mymenu.1` or `mandoc mymenu.1 | less`
067
2018-06-14
omar.pol
(depending on your system the `-l` option may not be present).
068
2018-05-20
omar.pol
069
2018-05-18
omar.pol
---
070
2018-05-18
omar.pol
071
2018-05-18
omar.pol
## Scripts
072
2018-05-18
omar.pol
073
2018-05-19
omar.pol
I'm using this script to launch MyMenu with custom item
074
2018-05-18
omar.pol
075
2018-05-18
omar.pol
``` shell
076
2018-05-18
omar.pol
#!/bin/sh
077
2018-05-18
omar.pol
078
2018-05-18
omar.pol
cat <<EOF | /bin/sh -c "$(mymenu "$@")"
079
2018-05-18
omar.pol
sct 4500
080
2018-05-18
omar.pol
lock
081
2018-05-18
omar.pol
connect ethernet
082
2018-05-18
omar.pol
connect home
083
2018-05-18
omar.pol
connect phone
084
2018-05-19
omar.pol
ZZZ
085
2018-05-18
omar.pol
zzz
086
2018-05-18
omar.pol
...
087
2018-05-18
omar.pol
EOF
088
2018-05-18
omar.pol
```
089
2018-05-18
omar.pol
090
2018-09-19
omar.pol
You can generate a list of executables from `$PATH` like this:
091
2018-05-19
omar.pol
092
2018-05-19
omar.pol
``` shell
093
2018-05-19
omar.pol
#!/bin/sh
094
2018-05-19
omar.pol
095
2018-05-19
omar.pol
path=`echo $PATH | sed 's/:/ /g'`
096
2018-05-19
omar.pol
097
2022-07-01
op
for p in $path; do
098
2022-07-01
op
for f in "$p"/*; do
099
2022-07-01
op
[ -x "$f" ] && echo "${f##*/}"
100
2022-07-01
op
done
101
2022-07-01
op
done | sort -fu | /bin/sh -c "$(mymenu "$@")"
102
2018-05-19
omar.pol
```
103
2018-05-19
omar.pol
104
2022-07-01
op
You can, for example, select a song to play from the current queue of
105
2022-07-01
op
[amused][amused]
106
2018-09-19
omar.pol
107
2018-09-19
omar.pol
```shell
108
2022-07-01
op
if song=$(amused show | mymenu -p "Song: " -A); then
109
2022-07-01
op
amused jump "$song"
110
2022-07-01
op
fi
111
2022-07-01
op
```
112
2022-07-01
op
113
2022-07-01
op
The same, but with mpd:
114
2022-07-01
op
115
2022-07-01
op
```shell
116
2018-09-19
omar.pol
fmt="%position% %artist% - %title%"
117
2018-09-19
omar.pol
if song=$(mpc playlist -f "$fmt" | mymenu -p "Song: " -A -d " "); then
118
2022-07-01
op
mpc play $(echo $song | sed "s/ .*$//")
119
2018-09-19
omar.pol
fi
120
2018-09-19
omar.pol
```
121
2018-09-19
omar.pol
122
2018-05-18
omar.pol
Of course you can as well use the `dmenu_path` and `dmenu_run` scripts
123
2018-05-18
omar.pol
that (usually) comes with `dmenu`.
124
2022-07-01
op
125
2022-07-01
op
[amused]: https://projects.omarpolo.com/amused.html
Omar Polo