| 1 | # XMenu |
| 2 | |
| 3 | <p align="center"> |
| 4 | <img src="https://user-images.githubusercontent.com/63266536/114306062-ffb67000-9ab0-11eb-9a10-be30eadc68b4.gif", title="demo"/> |
| 5 | </p> |
| 6 | |
| 7 | XMenu is a menu utility for X. |
| 8 | XMenu receives a menu specification in stdin, shows a menu for the user |
| 9 | to select one of the options, and outputs the option selected to stdout. |
| 10 | XMenu can be controlled both via mouse and via keyboard. |
| 11 | |
| 12 | In order to generate a menu of applications based on .desktop entries, |
| 13 | as specified by XDG, checkout [xdg-xmenu](https://github.com/OliverLew/xdg-xmenu) |
| 14 | by [OliverLew](https://github.com/OliverLew). |
| 15 | |
| 16 | Check out my other project, [xclickroot](https://github.com/phillbush/xclickroot) for an application that can |
| 17 | spawn xmenu by right clicking on the root window (i.e. on the desktop). |
| 18 | |
| 19 | |
| 20 | ## Features |
| 21 | |
| 22 | XMenu comes with the following features: |
| 23 | |
| 24 | * XMenu reads something in and prints something out, the UNIX way. |
| 25 | * Submenus (some menu entries can spawn another menu). |
| 26 | * Separators (menu entries can be separated by a line). |
| 27 | * Icons (menu entries can be preceded by an icon image). |
| 28 | * X resources support (you don't need to recompile xmenu for configuring it). |
| 29 | * Multi-head (xmenu supports multiple monitors by using Xinerama). |
| 30 | * Type-to-select (you can select an item by typing part of its name). |
| 31 | |
| 32 | |
| 33 | ## Files |
| 34 | |
| 35 | The files are: |
| 36 | |
| 37 | * `./README`: This file. |
| 38 | * `./Makefile`: The makefile. |
| 39 | * `./config.h`: The hardcoded default configuration for XMenu. |
| 40 | * `./config.mk`: The setup for the makefile. |
| 41 | * `./demo.gif`: A gif demonstrating how XMenu works. |
| 42 | * `./xmenu.1`: The manual file (man page) for XMenu. |
| 43 | * `./xmenu.c`: The source code of XMenu. |
| 44 | * `./xmenu.sh`: A sample script illustrating how to use XMenu. |
| 45 | * `./icons/`: Icons for the sample script |
| 46 | |
| 47 | |
| 48 | ## Installation |
| 49 | |
| 50 | First, edit `./config.mk` to match your local setup. |
| 51 | |
| 52 | In order to build XMenu you need the `Imlib2`, `Xlib`, `Xinerama` and `Xft` header files. |
| 53 | The default configuration for XMenu is specified in the file `config.h`, |
| 54 | you can edit it, but most configuration can be changed at runtime via |
| 55 | X resources. Enter the following command to build XMenu. This command |
| 56 | creates the binary file `./xmenu`. |
| 57 | |
| 58 | make |
| 59 | |
| 60 | By default, XMenu is installed into the `/usr/local` prefix. Enter the |
| 61 | following command to install XMenu (if necessary as root). This command |
| 62 | installs the binary file `./xmenu` into the `${PREFIX}/bin/` directory, and |
| 63 | the manual file `./xmenu.1` into `${MANPREFIX}/man1/` directory. |
| 64 | |
| 65 | make install |
| 66 | |
| 67 | |
| 68 | ## Running XMenu |
| 69 | |
| 70 | XMenu receives as input a menu specification where each line is a menu |
| 71 | entry. Each line can be indented with tabs to represent nested menus. |
| 72 | Each line is made out of a label and a command separated by any number |
| 73 | of tabs. Lines without labels are menu separators. |
| 74 | |
| 75 | See the script `./xmenu.sh` for an example of how to use XMenu to draw a |
| 76 | simple menu with submenus and separators. The file `./demo.gif` shows how |
| 77 | the menu generated by that script looks like. |
| 78 | |
| 79 | Read the [manual](https://github.com/phillbush/xmenu/wiki) for more information on running XMenu. |
| 80 | |
| 81 | |
| 82 | ## Acknowledgements |
| 83 | |
| 84 | * [thingmenu](https://github.com/singpolyma/thingmenu) for being the base |
| 85 | for xmenu's code. However, xmenu evolved enough that it no longer resembles |
| 86 | thingmenu at all. |
| 87 | * [dmenu](https://tools.suckless.org/dmenu/) for inspiring the stdin-to-stdout |
| 88 | interface, and being base for drawing routines and input method code. |