update
This commit is contained in:
parent
a67af2363d
commit
d54b3d899c
72
README.md
72
README.md
|
@ -1,64 +1,64 @@
|
|||
<p align="center">
|
||||
<img src="https://user-images.githubusercontent.com/63266536/89110619-10034f00-d43c-11ea-92a6-275eb50ef881.png", title="demo"/>
|
||||
</p>
|
||||
|
||||
# πmenu
|
||||
# πmenu(zcake build)
|
||||
|
||||
πmenu is a pie menu utility for X.
|
||||
πmenu receives a menu specification in stdin, shows a menu for the user
|
||||
πmenu receives a menu specification in stdin, shows a pie menu for the user
|
||||
to select one of the options, and outputs the option selected to stdout.
|
||||
πmenu can be controlled both via mouse and via keyboard.
|
||||
|
||||
## Features
|
||||
|
||||
πmenu comes with the following features:
|
||||
|
||||
* πmenu reads something in and prints something out, the UNIX way.
|
||||
* Submenus (some pie-menu slices can spawn another menu).
|
||||
* Icons (pie-menu slices can contain icon image).
|
||||
* X resources support (you don't need to recompile πmenu for configuring it).
|
||||
|
||||
Check out my other project, [xclickroot](https://github.com/phillbush/xclickroot) for an application that can
|
||||
spawn πmenu by right clicking on the root window (i.e. on the desktop).
|
||||
|
||||
* 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).
|
||||
|
||||
## Files
|
||||
|
||||
The files are:
|
||||
* ./README: This file.
|
||||
* ./Makefile: The makefile.
|
||||
* ./config.h: The hardcoded default configuration for πmenu.
|
||||
* ./config.mk: The settings for the makefile.
|
||||
* ./pmenu.1: The manual file (man page) for πmenu.
|
||||
* ./pmenu.c: The source code of πmenu.
|
||||
* ./pmenu.sh: A sample script illustrating how to use πmenu.
|
||||
|
||||
* `./README`: This file.
|
||||
* `./Makefile`: The makefile.
|
||||
* `./config.h`: The hardcoded default configuration for πmenu.
|
||||
* `./config.mk`: The setup for the makefile.
|
||||
* `./demo.gif`: A gif demonstrating how πmenu works.
|
||||
* `./pmenu.1`: The manual file (man page) for πmenu.
|
||||
* `./pmenu.c`: The source code of πmenu.
|
||||
* `./pmenu.sh`: A sample script illustrating how to use πmenu.
|
||||
* `./icons/`: Icons for the sample script
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
First, edit ./config.mk to match your local setup.
|
||||
First, edit `./config.mk` to match your local setup.
|
||||
|
||||
In order to build πmenu you need the Imlib2, Xlib and Xft header files.
|
||||
The default configuration for πmenu is specified in the file config.h,
|
||||
In order to build πmenu you need the `Imlib2`, `Xlib` and `Xft` header files.
|
||||
The default configuration for πmenu 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 πmenu. This command
|
||||
creates the binary file ./pmenu.
|
||||
creates the binary file `./pmenu`.
|
||||
````
|
||||
# sudo make
|
||||
|
||||
make
|
||||
|
||||
By default, πmenu is installed into the /usr/local prefix. Enter the
|
||||
````
|
||||
By default, πmenu is installed into the `/usr/local` prefix. Enter the
|
||||
following command to install πmenu (if necessary as root). This command
|
||||
installs the binary file ./pmenu into the ${PREFIX}/bin/ directory, and
|
||||
the manual file ./pmenu.1 into ${MANPREFIX}/man1/ directory.
|
||||
|
||||
make install
|
||||
|
||||
installs the binary file `./pmenu` into the `${PREFIX}/bin/` directory, and
|
||||
the manual file `./pmenu.1` into `${MANPREFIX}/man1/` directory.
|
||||
````
|
||||
# sudo make install
|
||||
|
||||
````
|
||||
## Running πmenu
|
||||
|
||||
πmenu 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.
|
||||
of tabs. Lines without labels are menu separators.
|
||||
|
||||
See the script ./pmenu.sh for an example of how to use πmenu to draw a
|
||||
simple pie menu.
|
||||
See the script `./pmenu.sh` for an example of how to use πmenu 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 for more information on running πmenu.
|
||||
Read the [manual](https://github.com/phillbush/pmenu/wiki) for more information on running πmenu.
|
||||
|
|
47
pmenu.c
47
pmenu.c
|
@ -8,7 +8,6 @@
|
|||
#include <unistd.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xresource.h>
|
||||
#include <X11/XKBlib.h>
|
||||
#include <X11/Xft/Xft.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
|
@ -130,7 +129,6 @@ struct Pie {
|
|||
static void ealloccolor(const char *s, XftColor *color);
|
||||
static void parsefonts(const char *s);
|
||||
static void initmonitor(void);
|
||||
static void initresources(void);
|
||||
static void initdc(void);
|
||||
static void initpie(void);
|
||||
|
||||
|
@ -224,7 +222,6 @@ main(int argc, char *argv[])
|
|||
|
||||
/* initializers */
|
||||
initmonitor();
|
||||
initresources();
|
||||
initdc();
|
||||
initpie();
|
||||
|
||||
|
@ -331,50 +328,8 @@ initmonitor(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* read xrdb for configuration options */
|
||||
static void
|
||||
initresources(void)
|
||||
{
|
||||
char *xrm;
|
||||
long n;
|
||||
char *type;
|
||||
XrmDatabase xdb;
|
||||
XrmValue xval;
|
||||
|
||||
XrmInitialize();
|
||||
if ((xrm = XResourceManagerString(dpy)) == NULL)
|
||||
return;
|
||||
|
||||
xdb = XrmGetStringDatabase(xrm);
|
||||
|
||||
if (XrmGetResource(xdb, "pmenu.diameterWidth", "*", &type, &xval) == True)
|
||||
if ((n = strtol(xval.addr, NULL, 10)) > 0)
|
||||
config.diameter_pixels = n;
|
||||
if (XrmGetResource(xdb, "pmenu.borderWidth", "*", &type, &xval) == True)
|
||||
if ((n = strtol(xval.addr, NULL, 10)) > 0)
|
||||
config.border_pixels = n;
|
||||
if (XrmGetResource(xdb, "pmenu.separatorWidth", "*", &type, &xval) == True)
|
||||
if ((n = strtol(xval.addr, NULL, 10)) > 0)
|
||||
config.separator_pixels = n;
|
||||
if (XrmGetResource(xdb, "pmenu.background", "*", &type, &xval) == True)
|
||||
config.background_color = strdup(xval.addr);
|
||||
if (XrmGetResource(xdb, "pmenu.foreground", "*", &type, &xval) == True)
|
||||
config.foreground_color = strdup(xval.addr);
|
||||
if (XrmGetResource(xdb, "pmenu.selbackground", "*", &type, &xval) == True)
|
||||
config.selbackground_color = strdup(xval.addr);
|
||||
if (XrmGetResource(xdb, "pmenu.selforeground", "*", &type, &xval) == True)
|
||||
config.selforeground_color = strdup(xval.addr);
|
||||
if (XrmGetResource(xdb, "pmenu.separator", "*", &type, &xval) == True)
|
||||
config.separator_color = strdup(xval.addr);
|
||||
if (XrmGetResource(xdb, "pmenu.border", "*", &type, &xval) == True)
|
||||
config.border_color = strdup(xval.addr);
|
||||
if (XrmGetResource(xdb, "pmenu.font", "*", &type, &xval) == True)
|
||||
config.font = strdup(xval.addr);
|
||||
|
||||
XrmDestroyDatabase(xdb);
|
||||
}
|
||||
|
||||
/* init draw context */
|
||||
|
||||
static void
|
||||
initdc(void)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue