Compare commits

...

No commits in common. "34302812fe6a32ef881bae8a2827213aa8b67336" and "ec1984719e9ed58e24c6af554feb468a6fcc34a0" have entirely different histories.

12 changed files with 7 additions and 2333 deletions

167
CHANGELOG
View File

@ -1,167 +0,0 @@
CHANGELOG
4.5.5 (2021-04-11)
• Added support for mouse scrolling (#26).
• Changed Makefile; simplify ${DESTDIR} (#25).
• Changed README; removed demo.gif.
• Fixed LICENSE.
• Fixed segfault if a sub-menu is added to a separator (#29).
4.5.4 (2021-01-09)
• Fixed ESC key.
4.5.3 (2021-01-09)
• Fixed missing lines in xmenu.c.
4.5.2 (2021-01-09)
• Fixed missing line in xmenu.c.
4.5.1 (2021-01-09)
• Fixed SHIFT key; it cleared the selection, now it doesn't.
4.5.0 (2021-01-08).
• Added type-to-select feature (#21).
• Added support for setting the text alignment.
• Added -r option to disable right mouse button (#17).
• Added CHANGELOG.
• Changed order of parsing of options.
• Fixed config.mk formatting (#18, #23).
• Fixed README's list of header dependencies (#24).
4.4.1 (2020-10-18).
• Fixed Makefile by removing -D flag of install(1) and making it portable.
• Fixed menu placement when pointer is at the very top of the menu (#16).
4.4.0 (2020-09-27).
• Added support for custom key bindings in config.h.
• Added support for 1 to 9 keys for moving (#14).
• Added support for Home and End keys for moving.
• Fixed code to free stuff earlier, when they're no longer used.
4.3.2 (2020-09-13).
• Changed license.
• Fixed initmonitor() routine to free unused data.
4.3.1 (2020-08-12).
• Added warning messages for unsuccessful icon loading.
• Changed wording in some error messages.
• Changed README to add reference to xdg-xmenu, by OliverLew.
4.3.0 (2020-08-01).
• Added ability to search the system for font containing character.
• Changed drawtext() routine (split part of it into getfontucode()).
• Fixed getfontucode() by adding sanity check tests.
• Removed the -f option.
4.2.0 (2020-07-31).
• Added the -f option.
• Changed xmenu.c to use BETWEEN macro.
• Fixed fallback position.
• Fixed manpage; simplifying description of -i option.
• Fixed xmenu.h; removed unused elements in struct Item.
• Fixed cleanup function to free fonts.
4.1.4 (2020-07-30).
• Added detection of icons in menus.
• Fixed y position of child menus.
• Fixed placement in some window managers when using -w.
• Fixed README to add reference to added features.
4.1.3 (2020-07-30).
• Fixed xmenu.c and xmenu.h: removed redundant variables.
4.1.2 (2020-07-29).
• Fixed computation of the text y position.
4.1.1 (2020-07-29).
• Changed README to README.md (#9).
• Fixed config.mk to load -lXinerama.
4.1.0 (2020-07-29).
• Added Xinerama support (#8).
4.0.2 (2020-07-29).
• Fixed menu drawing; menus are now drawed on demand.
4.0.1 (2020-07-29).
• Fixed calculation of text width.
4.0.0 (2020-07-29).
• Added support for fallback fonts.
• Changed license.
3.4.1 (2020-07-28).
• Fixed performance issue with many icons (#7).
3.4.0 (2020-07-23).
• Added the -p option (to set the root menu position).
3.3.0 (2020-07-15).
• Added the -i option (to disable icons).
• Changed code for computing widths and x position.
3.2.1 (2020-06-29).
• Fixed manpage; add reference to added features in the manual.
3.2.0 (2020-06-29).
• Added support for EWMH properties.
• Added support for gaps between menus (#3).
• Changed README to add reference to xclickroot(1).
• Changed how configuration is done; added a config structure.
• Fixed missing #include.
• Fixed missing type cast.
3.1.1 (2020-06-20).
• Changed how height is calculated; now it's set directly.
• Fix Makefile; removed slashes after DESTDIR (#2).
3.1.0 (2020-06-05).
• Fixed several typos and mismatches between code, manual and README.
3.0.0 (2020-05-31).
• Added support for icons.
• Added some icons samples (in ./icons/).
• Added demo gif.
• Added the -w option (again).
• Changed Makefile; using -D option of install(1).
• Changed input parsing to use stdlib functions rather than get byte-by-byte.
• Changed xmenu.c; making global variables local.
• Changed calcmenu() routine (split into three routines).
• Fixed segfault in case of empty input.
• Fixed calls to strdup(3); called twice only when label and output differs.
• Fixed menu position calculation (it didn't take borders into account).
• Fixed manpage; updated to new features.
• Fixed xmenu.c; removed unused code.
• Fixed cleanup routine; freeing allocated stuff.
2.0.0 (2020-05-27).
• Changed xmenu.c; making global variables local.
• Changed README; including more information.
• Changed getmenuitem() routine (split into getmenu() and getitem()).
• Changed drawing routines in xmenu.c (drawseparator() and drawitem()).
• Fixed xmenu.c; removed unused code.
• Removed the -w option.
1.0.0 (2020-05-19).
• Added keyboard navigation.
• Added manpage.
• Added support for X resources.
• Added XFT support (antialiased fonts).
• Added setting of WM_CLASS property.
• Added recalcmenu() to recalculate menu position when -w is used.
• Added support for WM_DELETE_WINDOW property (ability to close window).
• Changed xmenu.sh script to pipe into sh(1).
• Changed color scheme (stolen from firefox's context menu).
• Changed algorithm for remapping menus (find lowest common ancestor menu).
• Changed computing of menu width to be based on font.
• Changed triangle size; now it's smaller.
• Changed xmenu.sh; it now supposes that xmenu is installed.
• Fixed README; it was a copy of dwm's.
• Fixed Makefile; make install didn't install the manpage.
• Fixed pointer and keyboard grabbing race condition.
• Fixed order of function calls (grab keyboard after reading input).
0.5.0 (2020-05-16).
• Added menu separators (lines without labels in the input).
• Added double buffering, rather than drawing directly on windows.
• Added -w option.

38
LICENSE
View File

@ -1,37 +1,9 @@
MIT/X Consortium License
MIT License
© 2020 Phillip Bushee <phillbush@cock.li>
Copyright (c) <year> <copyright holders>
thingmenu:
© 2011 Christoph Lohmann <20h@r-36.net>
© 2011 Stephen Paul Weber <singpolyma@singpolyma.net>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
dmenu:
© 2006-2019 Anselm R Garbe <anselm@garbe.ca>
© 2006-2008 Sander van Dijk <a.h.vandijk@gmail.com>
© 2006-2007 Michał Janeczek <janeczek@gmail.com>
© 2007 Kris Maglione <jg@suckless.org>
© 2009 Gottox <gottox@s01.de>
© 2009 Markus Schnalke <meillo@marmaro.de>
© 2009 Evan Gates <evan.gates@gmail.com>
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
© 2014-2020 Hiltjo Posthuma <hiltjo@codemadness.org>
© 2015-2019 Quentin Rameau <quinq@fifth.space>
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,32 +0,0 @@
include config.mk
bindir = ${DESTDIR}${PREFIX}
mandir = ${DESTDIR}${MANPREFIX}
SRCS = ${PROG}.c
OBJS = ${SRCS:.c=.o}
all: ${PROG}
${PROG}: ${OBJS}
${CC} -o $@ ${OBJS} ${LDFLAGS}
${OBJS}: config.h ${PROG}.h
.c.o:
${CC} ${CFLAGS} -c $<
clean:
-rm ${OBJS} ${PROG}
install: all
mkdir -p ${bindir}/bin
install -m 755 ${PROG} ${bindir}/bin/${PROG}
mkdir -p ${mandir}/man1
install -m 644 ${PROG}.1 ${mandir}/man1/${PROG}.1
uninstall:
rm -f ${bindir}/bin/${PROG}
rm -f ${mandir}/man1/${PROG}.1
.PHONY: all clean install uninstall

View File

@ -1,88 +1,3 @@
# XMenu
# xmenu
<p align="center">
<img src="https://user-images.githubusercontent.com/63266536/114306062-ffb67000-9ab0-11eb-9a10-be30eadc68b4.gif", title="demo"/>
</p>
XMenu is a menu utility for X.
XMenu receives a menu specification in stdin, shows a menu for the user
to select one of the options, and outputs the option selected to stdout.
XMenu can be controlled both via mouse and via keyboard.
In order to generate a menu of applications based on .desktop entries,
as specified by XDG, checkout [xdg-xmenu](https://github.com/OliverLew/xdg-xmenu)
by [OliverLew](https://github.com/OliverLew).
Check out my other project, [xclickroot](https://github.com/phillbush/xclickroot) for an application that can
spawn xmenu by right clicking on the root window (i.e. on the desktop).
## Features
XMenu comes with the following features:
* XMenu reads something in and prints something out, the UNIX way.
* Submenus (some menu entries can spawn another menu).
* Separators (menu entries can be separated by a line).
* Icons (menu entries can be preceded by an icon image).
* X resources support (you don't need to recompile xmenu for configuring it).
* Multi-head (xmenu supports multiple monitors by using Xinerama).
* Type-to-select (you can select an item by typing part of its name).
## Files
The files are:
* `./README`: This file.
* `./Makefile`: The makefile.
* `./config.h`: The hardcoded default configuration for XMenu.
* `./config.mk`: The setup for the makefile.
* `./demo.gif`: A gif demonstrating how XMenu works.
* `./xmenu.1`: The manual file (man page) for XMenu.
* `./xmenu.c`: The source code of XMenu.
* `./xmenu.sh`: A sample script illustrating how to use XMenu.
* `./icons/`: Icons for the sample script
## Installation
First, edit `./config.mk` to match your local setup.
In order to build XMenu you need the `Imlib2`, `Xlib`, `Xinerama` and `Xft` header files.
The default configuration for XMenu is specified in the file `config.h`,
you can edit it, but most configuration can be changed at runtime via
X resources. Enter the following command to build XMenu. This command
creates the binary file `./xmenu`.
make
By default, XMenu is installed into the `/usr/local` prefix. Enter the
following command to install XMenu (if necessary as root). This command
installs the binary file `./xmenu` into the `${PREFIX}/bin/` directory, and
the manual file `./xmenu.1` into `${MANPREFIX}/man1/` directory.
make install
## Running XMenu
XMenu receives as input a menu specification where each line is a menu
entry. Each line can be indented with tabs to represent nested menus.
Each line is made out of a label and a command separated by any number
of tabs. Lines without labels are menu separators.
See the script `./xmenu.sh` for an example of how to use XMenu to draw a
simple menu with submenus and separators. The file `./demo.gif` shows how
the menu generated by that script looks like.
Read the [manual](https://github.com/phillbush/xmenu/wiki) for more information on running XMenu.
## Acknowledgements
* [thingmenu](https://github.com/singpolyma/thingmenu) for being the base
for xmenu's code. However, xmenu evolved enough that it no longer resembles
thingmenu at all.
* [dmenu](https://tools.suckless.org/dmenu/) for inspiring the stdin-to-stdout
interface, and being base for drawing routines and input method code.
wm-agnostic, X11 menu

View File

@ -1,61 +0,0 @@
static struct Config config = {
/* font, separate different fonts with comma */
.font = "monospace:size=9,DejaVuSansMono:size=9",
/* colors */
.background_color = "#FFFFFF",
.foreground_color = "#2E3436",
.selbackground_color = "#3584E4",
.selforeground_color = "#FFFFFF",
.separator_color = "#CDC7C2",
.border_color = "#E6E6E6",
/* sizes in pixels */
.width_pixels = 130, /* minimum width of a menu */
.height_pixels = 25, /* height of a single menu item */
.border_pixels = 1, /* menu border */
.separator_pixels = 3, /* space around separator */
.gap_pixels = 0, /* gap between menus */
/* text alignment, set to LeftAlignment, CenterAlignment or RightAlignment */
.alignment = LeftAlignment,
/*
* The variables below cannot be set by X resources.
* Their values must be less than .height_pixels.
*/
/* geometry of the right-pointing isoceles triangle for submenus */
.triangle_width = 3,
.triangle_height = 7,
/* the icon size is equal to .height_pixels - .iconpadding * 2 */
.iconpadding = 2,
/* area around the icon, the triangle and the separator */
.horzpadding = 8,
};
/*
* KEYBINDINGS
*
* Look at your /usr/include/X11/keysymdef.h (or the equivalent file
* in your system) for a list of key symbol constants, and change the
* macros below accordingly. All key symbol constants begin with the
* prefix XK_.
*
* For example, to use vim-like key bindings, set KEYSYMLEFT to XK_h,
* KEYSYMDOWN to XK_j, KEYSYMUP to XK_k, etc.
*
* Note that the regular keys like ArrowUp, ArrowDown, Tab, Home, etc
* will ALWAYS work, so you do not need to set them.
*
* If you do not want to set a key binding, keep it with the value of
* XK_VoidSymbol
*/
#define KSYMFIRST XK_VoidSymbol /* select first item */
#define KSYMLAST XK_VoidSymbol /* select last item */
#define KSYMUP XK_VoidSymbol /* select previous item */
#define KSYMDOWN XK_VoidSymbol /* select next item */
#define KSYMLEFT XK_VoidSymbol /* close current menu */
#define KSYMRIGHT XK_VoidSymbol /* enter selected item */

View File

@ -1,31 +0,0 @@
# program name
PROG = xmenu
# paths
PREFIX ?= /usr/local
MANPREFIX ?= ${PREFIX}/share/man
LOCALINC ?= /usr/local/include
LOCALLIB ?= /usr/local/lib
# SHELL variable (mainly for non-GNU make)
SHELL ?= /bin/sh
X11INC ?= /usr/X11R6/include
X11LIB ?= /usr/X11R6/lib
FREETYPEINC ?= /usr/include/freetype2
# OpenBSD (uncomment)
#FREETYPEINC = ${X11INC}/freetype2
# includes and libs
INCS := -I${LOCALINC} -I${X11INC} -I${FREETYPEINC}
LIBS := -L${LOCALLIB} -L${X11LIB} -lfontconfig -lXft -lX11 -lXinerama -lImlib2
# flags
CPPFLAGS :=
CFLAGS := -Wall -Wextra ${INCS} ${CPPFLAGS}
LDFLAGS := ${LIBS}
# compiler and linker
CC = cc

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

221
xmenu.1
View File

@ -1,221 +0,0 @@
.TH XMENU 1
.SH NAME
xmenu \- menu utility for X
.SH SYNOPSIS
.B xmenu
.RB [ \-irw ]
.RB [ -p
.IR position ]
.RI [ title ]
.SH DESCRIPTION
.B xmenu
is a menu for X,
it reads a list of newline-separated items from stdin,
shows a menu for the user to select one of the items,
and outputs the item selected to stdout.
.PP
The options are as follows:
.TP
.B -i
Disable icons.
This makes xmenu loading faster when not using icons.
.TP
.BI -p " position"
Set the position to spawn xmenu.
Without this option, xmenu spawns next to the cursor.
.I position
is a string of the form
.BR INTxINT[:MONITOR] ,
where the first INT is the x position and the second INT is the y position.
The monitor part between brackets is optional.
.B MONITOR
can be a number from 0 to the number of monitors minus 1;
or it can be a string like
.B current
or
.BR cursor .
If present, the monitor specifies that the position is relative to the upper left corner
of that monitor.
If
.B monitor
is
.B current
or
.BR cursor ,
the monitor to be used is that where the cursor is in.
For example,
.B -p 0x0:cursor
specifies that
.B xmenu
must spawn at the position 0x0 of the monitor where the cursor is in.
And
.B -p 100x500:0
specifies that
.B xmenu
must spawn at the position 100x500 of the monitor 0.
.TP
.B -r
If this option is set, the right mouse button is disabled;
so pressing it will not trigger any menu item.
.TP
.B -w
Asks the window manager to draw a border around the menus.
This option may be buggy in some window managers,
specially tiled ones that do not respect window hints.
.PP
Each item read from stdin has the following format:
.IP
.EX
ITEM := [TABS] [[IMAGE TABS] LABEL [TABS OUTPUT]] NEWLINE
.EE
.PP
That means that each item is composed by
tabs, followed by an optional image specification, followed by tabs
followed by a label, followed by more tabs, followed by an output,
and ended by a newline. Brackets group optional elements.
.IP
The initial tabs indicate the menu hierarchy:
items indented with a tab is shown in a submenu of the preceding item not indented.
An item without initial tabs is a top-level item.
.IP
The image is a string of the form "IMG:/path/to/image.png".
It specifies a image to be shown as icon at the left of the entry.
.IP
The label is the string that will be shown as a item in the menu.
An item without label is considered a separator and is drawn as a thin line in the menu
separating the item above from the item below.
.IP
The output is the string that will be output after selecting the item.
If an item does not have an output, its label is used as its output.
.IP
The newline terminates the item specification.
.PP
If the argument
.I title
is given, the title of the menu window is set to it.
.SH USAGE
.B xmenu
is controlled by the mouse,
but can also be controlled by the keyboard.
Items can be selected using the arrow keys,
Tab (with and without Shift),
Home, End,
Enter and Esc, and 1-9 keys.
Items can also be selected by typing the first several characters in it.
.TP
.BR Home
Select the first item in the menu.
.TP
.BR End
Select the last item in the menu.
.TP
.BR Down
Cycle through the items in the regular direction.
.TP
.BR Tab
Cycle through the items in the regular direction.
When the type\-to\-select feature is active, cycle through matching items instead.
.TP
.BR Up
Cycle through the items in the reverse direction.
.TP
.BR Shift-Tab
Cycle through the items in the reverse direction.
When the type\-to\-select feature is active, cycle through matching items instead.
.TP
.BR Right ", " Enter
Select the highlighted item.
.TP
.B Left
Go to the menu above.
.TP
.B Esc
Go to the menu above or exit xmenu.
.PP
.B xmenu
features the type\-to\-select selecting style,
where typing a string will select the first item matching it.
.PP
Additional key bindings can be set at compile time by changing the
.B config.h
file.
.SH RESOURCES
.B
xmenu
understands the following X resources.
.TP
.B xmenu.font
The font in which the labels should be drawn.
Multiple fonts can be added as fallback fonts;
they must be separated by a comma.
.TP
.B xmenu.background
The background color of non-selected items in the menu.
.TP
.B xmenu.foreground
The color of the label text of non-selected items in the menu.
.TP
.B xmenu.selbackground
The background color of selected items in the menu.
.TP
.B xmenu.selforeground
The color of the label text of selected items in the menu.
.TP
.B xmenu.border
The color of the border around the menu.
.TP
.B xmenu.separator
The color of the separator between items in the menu.
.TP
.B xmenu.gap
The gap, in pixels, between the menus.
.TP
.B xmenu.width
The minimum width, in pixels, of the items in the menu.
.TP
.B xmenu.height
The size in pixels of the height of a single menu item.
.TP
.B xmenu.borderWidth
The size in pixels of the border around the menu.
.TP
.B xmenu.separatorWidth
The size in pixels of the item separator.
.TP
.B xmenu.alignment
If set to
.BR "\(dqleft\(dq" ,
.BR "\(dqcenter\(dq" ,
or
.BR "\(dqright\(dq" ,
text is aligned to the left, center, or right of the menu, respectively.
By default, text is aligned to the left.
.SH EXAMPLES
The following script illustrates the use of
.BR xmenu .
The output is redirected to
.IR sh (1),
creating a command to be run by the shell.
.IP
.EX
#!/bin/sh
xmenu <<EOF | sh &
Applications
IMG:./web.png Web Browser firefox
IMG:./gimp.png Image editor gimp
Terminal (xterm) xterm
Terminal (urxvt) urxvt
Terminal (st) st
Shutdown poweroff
Reboot reboot
EOF
.EE
.PP
For example, by selecting \(lqApplications\(rq, a new menu will appear.
Selecting \(lqWeb Browser\(rq in the new menu opens firefox.
.SH SEE ALSO
.IR dmenu (1),
.IR 9menu (1),
.IR thingmenu (1)

1578
xmenu.c

File diff suppressed because it is too large Load Diff

110
xmenu.h
View File

@ -1,110 +0,0 @@
#define PROGNAME "xmenu"
/* Actions for the main loop */
#define ACTION_NOP 0
#define ACTION_CLEAR 1<<0 /* clear text */
#define ACTION_SELECT 1<<1 /* select item */
#define ACTION_MAP 1<<2 /* remap menu windows */
#define ACTION_DRAW 1<<3 /* redraw menu windows */
#define ACTION_WARP 1<<4 /* warp the pointer */
/* enum for keyboard menu navigation */
enum { ITEMPREV, ITEMNEXT, ITEMFIRST, ITEMLAST };
/* enum for text alignment */
enum {LeftAlignment, CenterAlignment, RightAlignment};
/* macros */
#define LEN(x) (sizeof (x) / sizeof (x[0]))
#define MAX(x,y) ((x)>(y)?(x):(y))
#define MIN(x,y) ((x)<(y)?(x):(y))
#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b))
#define GETNUM(n, s) { \
unsigned long __TMP__; \
if ((__TMP__ = strtoul((s), NULL, 10)) < INT_MAX) \
(n) = __TMP__; \
}
/* color enum */
enum {ColorFG, ColorBG, ColorLast};
/* EWMH atoms */
enum {NetWMName, NetWMWindowType, NetWMWindowTypePopupMenu, NetLast};
/* configuration structure */
struct Config {
/* the values below are set by config.h */
const char *font;
const char *background_color;
const char *foreground_color;
const char *selbackground_color;
const char *selforeground_color;
const char *separator_color;
const char *border_color;
int width_pixels;
int height_pixels;
int border_pixels;
int separator_pixels;
int gap_pixels;
int triangle_width;
int triangle_height;
int iconpadding;
int horzpadding;
int alignment;
/* the values below are set by options */
int monitor;
int posx, posy; /* rootmenu position */
/* the value below is computed by xmenu */
int iconsize;
};
/* draw context structure */
struct DC {
XftColor normal[ColorLast];
XftColor selected[ColorLast];
XftColor border;
XftColor separator;
GC gc;
FcPattern *pattern;
XftFont **fonts;
size_t nfonts;
};
/* menu item structure */
struct Item {
char *label; /* string to be drawed on menu */
char *output; /* string to be outputed when item is clicked */
char *file; /* filename of the icon */
int y; /* item y position relative to menu */
int h; /* item height */
int textw; /* text width */
struct Item *prev; /* previous item */
struct Item *next; /* next item */
struct Menu *submenu; /* submenu spawned by clicking on item */
Drawable sel, unsel; /* pixmap for selected and unselected item */
Imlib_Image icon;
};
/* monitor geometry structure */
struct Monitor {
int x, y, w, h; /* monitor geometry */
};
/* menu structure */
struct Menu {
struct Menu *parent; /* parent menu */
struct Item *caller; /* item that spawned the menu */
struct Item *list; /* list of items contained by the menu */
struct Item *selected; /* item currently selected in the menu */
int x, y, w, h; /* menu geometry */
int hasicon; /* whether the menu has item with icons */
int drawn; /* whether the menu was already drawn */
int maxtextw; /* maximum text width */
unsigned level; /* menu level relative to root */
Window win; /* menu window to map on the screen */
XIC xic; /* input context */
};

View File

@ -1,13 +0,0 @@
#!/bin/sh
xmenu <<EOF | sh &
Applications
IMG:./icons/web.png Web Browser firefox
IMG:./icons/gimp.png Image editor gimp
Terminal (xterm) xterm
Terminal (urxvt) urxvt
Terminal (st) st
Shutdown poweroff
Reboot reboot
EOF