Giter VIP home page Giter VIP logo

pmenu's Introduction

πmenu

WARNING: The options -r, -m and -p are deprecated and were replaced by -x and -X. The option -P (used to provide path) is now replaced by the environment variable $ICONPATH, an environment variable which supports several paths delimited by colons. Read the manual for more information. Update your scripts after updating πmenu.

πmenu is a pie menu utility for X. πmenu 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.

π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).

Files

The files are:

  • ./README.md: This file.
  • ./Makefile: The makefile.
  • ./config.h: The hardcoded default configuration for πmenu.
  • ./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.
  • ./ctrlfnt.*: Routines for drawing text.

Installation

First, edit ./Makefile or set the proper environment variables to match your local setup.

In order to build πmenu you need the Imlib2, Xlib and Xft header files (and some X extensions: XShape and Xinerama). 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.

make

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

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.

See the script ./pmenu.sh for an example of how to use πmenu to draw a simple pie menu.

Read the manual for more information on running πmenu.

pmenu's People

Contributors

0mp avatar emanuele6 avatar magnus-isu avatar phillbush avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pmenu's Issues

Build: wrong default value of PREFIX in config.mk

README states:

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

But, in config.mk, PREFIX and MANPREFIX are defined as:

# paths
PREFIX = ../..
MANPREFIX = ${PREFIX}/man

This settings will cause make install to install, by default, pmenu in ../../bin and pmenu.1 in ../../man/man1 which is very weird as a default and is not coherent with what is written in README.

Also note that, in xmenu's default config.mk, MANPREFIX is set to ${PREFIX}/share/man, while the default value for pmenu is ${PREFIX}/man.

pmenu crashes - I'm not sure why it is happening, but I was able to find out how to fix it

Here is what I am doing to produce the crash. (compiled with -g for debug info)

mag 21:27:19 | ~/tmp/pmenu $ valgrind ./pmenu -r 3 <<!
IMG:/home/mag/pic/icons/folder.png              pcmanfm
IMG:/home/mag/pic/icons/librewolf.png   librewolf
IMG:/home/mag/pic/icons/power.webp
        IMG:/home/mag/pic/icons/phoenix.png             reboot
        IMG:/home/mag/pic/icons/skull.png               shutdown now
IMG:/home/mag/pic/icons/art.webp
        IMG:/home/mag/pic/icons/krita.png               krita
        IMG:/home/mag/pic/icons/gimp.webp               gimp
IMG:/home/mag/pic/icons/message.webp
        IMG:/home/mag/pic/icons/discord.webp    librewolf discord.com/login
        IMG:/home/mag/pic/icons/nheko.png               nheko
        IMG:/home/mag/pic/icons/hexchat.png             hexchat
!
==24177== Memcheck, a memory error detector
==24177== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==24177== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info
==24177== Command: ./pmenu -r 3
==24177== 
librewolf discord.com/login
==24177== Invalid read of size 8
==24177==    at 0x1106F7: run (pmenu.c:1460)
==24177==    by 0x1112D7: main (pmenu.c:1666)
==24177==  Address 0x18 is not stack'd, malloc'd or (recently) free'd
==24177== 
==24177== 
==24177== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==24177==  Access not within mapped region at address 0x18
==24177==    at 0x1106F7: run (pmenu.c:1460)
==24177==    by 0x1112D7: main (pmenu.c:1666)
==24177==  If you believe this happened as a result of a stack
==24177==  overflow in your program's main thread (unlikely but
==24177==  possible), you can try to increase the size of the
==24177==  main thread stack using the --main-stacksize= flag.
==24177==  The main thread stack size used in this run was 8388608.
==24177== 
==24177== HEAP SUMMARY:
==24177==     in use at exit: 3,845,712 bytes in 11,938 blocks
==24177==   total heap usage: 21,769 allocs, 9,831 frees, 12,658,781 bytes allocated
==24177== 
==24177== LEAK SUMMARY:
==24177==    definitely lost: 1,024 bytes in 2 blocks
==24177==    indirectly lost: 1,874 bytes in 67 blocks
==24177==      possibly lost: 0 bytes in 0 blocks
==24177==    still reachable: 3,842,814 bytes in 11,869 blocks
==24177==         suppressed: 0 bytes in 0 blocks
==24177== Rerun with --leak-check=full to see details of leaked memory
==24177== 
==24177== For lists of detected and suppressed errors, rerun with: -s
==24177== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 5 from 1)
Segmentation fault (core dumped)

The following diff fixes it

mag 21:32:58 | ~/hak/dev/pmenu $ git --no-pager diff
diff --git a/pmenu.c b/pmenu.c
index 66b217e..c8a2122 100644
--- a/pmenu.c
+++ b/pmenu.c
@@ -1485,7 +1485,11 @@ run(struct Menu *rootmenu)
 			switch (ev.type) {
 			case Expose:
 				if (ev.xexpose.count == 0) {
-					if (currmenu->selected != NULL && ev.xexpose.window == currmenu->selected->tooltip) {
+					if (
+						currmenu &&
+						currmenu->selected != NULL &&
+						ev.xexpose.window == currmenu->selected->tooltip
+					) {
 						copytooltip(currmenu->selected);
 					} else if (currmenu && ev.xexpose.window == currmenu->win) {
 						copymenu(currmenu);

Cursor jumping behavior

It's somewhat frustrating to fight the menu when it constantly grabs your cursor and throws it to the center. I mean specifically when your cursor exits the circle, and then you want to go back, but as soon as the cursor touches the circle edge pmenu grabs it and throws it to the center, completely stuns me about where my cursor was and where I will end up in another second.
I think the perfect solution is to jump to the center only once after each circle spawn, but then leave the cursor alone, so that user can exit the second sub menu, return to the first circle and point at whatever he wants without intervention.
But if this kind of thing is difficult to implement, second best option is to make jumping behavior toggable in config.h

Fonts broken?

I'm not sure what happened but after a plasma update text just stopped rendering. No idea why

Eliminate Compilation Warnings

There are apparently a few unused variables and an implicitly defined nanosleep().
Its an easy fix of including <time.h>, removing unsigned x, y from initpie(), and removing struct Slice *prevslice from main()

I don't know if these are intended for future use, but after some cursory pmenu usage it doesn't seem to break anything. I can make a PR with the changes, but its 5 line deletions and one include addition.

*accidentally posted to https://github.com/phillbush/xmenu/issues/13

`time.h` missing

Hi,
First of all thanks for the nice program! Is it possible that you are missing the time.h header in pmenu.c? I get the following warning when compiling:

cc -Wall -Wextra -I/usr/local/include -I/usr/X11R6/include -I/usr/include/freetype2  -c pmenu.c
pmenu.c: In function ‘grabpointer’:
pmenu.c:1017:17: warning: implicit declaration of function ‘nanosleep’ [-Wimplicit-function-declaration]
 1017 |                 nanosleep(&ts, NULL);
      |                 ^~~~~~~~~

[Request] Assignable hotkeys for options and submenus?

If there was a way to bind keys for going to a specific command that would be really helpful, ex. whenever I add something to my utilities menu the number of times I need to press tab changes, plus it would just make navigation faster in general

cannot install on archlinux

$ sudo make install                                                           # ~/Downloads/Src/pmenu > master ?
mkdir -p /usr/local/bin
mkdir -p /usr/local/share/man/man1
m 755 pmenu /usr/local/bin/pmenu
make: m: No such file or directory
make: [Makefile:37: install] Error 127 (ignored)
m 644 pmenu.1 /usr/local/share/man/man1/pmenu.1
make: m: No such file or directory
make: [Makefile:38: install] Error 127 (ignored)

Sub menus don't work with Wacom tablet

Graphic tablets have absolute cursor positioning, so I just tested, when I open second menu cursor jumps to the center, but immediately jumps back to where it was (because of absolute positioning of the tablet). So If you have a tablet you can't open second menus.
Demo:
https://fastupload.co/1085111
I think using radial menus with a tablet is very intuitive, so it would be nice to have pmenu support tablets. Maybe adding jump toggle to the config?

Don't exit if icons are missing

Hi,
I have an issue where pmenu refuses to run (one-shot), when icons are specified, but not found in the filesystem. xmenu just prints a warning and ignores the icon for that option, while pmenu just exits after returning. It would be nice, if pmenu would act the same.

Let me know what you think of it...

Wayland?

Hey man,

I want to use pmenu in a wayland environment (without XWayland) but obviously that won't work. Looking at the code it seems to rely pretty heavily on X's own functionality rather than using another lib like cairo or something. This probably makes a wayland option difficult to implement within this tree, as with a wayland version you'd probably want to use something like cairo (there is no real xrender alternative). I'd probably fork pmenu and make it work in wayland but figured I should bring it up here in case you'd want that to become part of the original codebase alongside the X version. This would have many advantages but would probably require a transition to using something that isn't XRender for rendering.

What do you think? Don't bother changing this one and just fork it, or have one repository that does both X and wayland?

Cannot build

Hello, the build process fails because a file, defs.h, cannot be found.
I see it is not in the project directory, where can I find it?
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.