Blob


1 # mymenu
2 > a menu of mine
4 mymenu is a simple, dmenu-inspired, menu for X11. It was written because of NIH, because I was bored, and because it was the perfect opportunity to learn more about X11 and xlib. Jokes aside, is a fully functional and very customizable menu that I use every day.
6 => https://git.omarpolo.com/mymenud Git repo
7 => https://github.com/omar-polo/mymenu GitHub mirror
9 It supports two layout: a vertical one (like rofi) and one horizontal (like dmenu). Various aspects are customizables: color, transparency, borders and window placement. It is very easily scriptable, and in the default repo you’ll find some example script (both in the manpage and in the scripts folder). Of course, you can easily adapt your dmenu/rofi scripts to mymenu if you want.
11 For instance, here’s what I’m currently using. It has submenu and custom actions, so it could be a good example.
13 ```
14 #!/bin/ksh
16 a-menu() {
17 mymenu -f 'Go Mono-11' -l vertical -p '% ' \
18 -W 50% -H 30% -P 10 -x center -y center \
19 -C '#ffffea' -c '#000' -T '#ffffea' \
20 -t '#000' -S '#000' -s '#fff' -b 3 \
21 -a
22 }
24 # pass
25 p() {
26 prefix=${PASSWORD_STORE_DIR:-~/.password-store}
27 set -A files -- "$prefix"/**/*.gpg "$prefix"/**/**/*.gpg
28 typeit=${1:-yes}
30 if p=$(printf '%s\n' ${files[@]} | sed -e 's/\.gpg$//' -e "s,^$prefix/,," | a-menu); then
31 if [ "$typeit" = yes ]; then
32 pass show "$p" | { IFS= read -r pass; printf %s "$pass"; } |
33 xdotool type --clearmodifiers --file -
34 else
35 pass show --clip "$password"
36 fi
37 fi
38 }
40 # exec
41 e() {
42 if ! x=$(a-menu); then
43 return
44 elif [ "$x" = "pass" ]; then
45 p yes
46 elif [ "$x" = "pass copy" ]; then
47 p nope
48 elif [ "$x" = "keep" ]; then
49 exec keepassxc
50 else
51 exec $x
52 fi
53 }
55 (
56 echo keep
57 echo firefox
58 # ...
59 echo pass
60 echo pass copy # not "copy pass" so it's after pass
61 ) | e
62 ```