[dev] [pdmenu] radial (pie) menu for X11

0 views
Skip to first unread message

Peter Valach

unread,
Feb 14, 2026, 6:18:54 AM (yesterday) Feb 14
to d...@suckless.org
I created this a few months ago and used it since then without problems,
maybe it will be useful for someone here:

pdmenu is a minimal, mouse-only, radial (pie) menu for X11.

It reads menu items from stdin (like dmenu), displays them in
a fullscreen transparent overlay around the current mouse cursor, and
prints the selected item to stdout. Inspired by https://kando.menu/,
implementing only the basic idea.

The first item is shown in the center; remaining items are arranged
clockwise in a circle, starting from the top.

https://github.com/pvxx/pdmenu

I know literally nothing about X programming and it is really long time
since I did anything in C (except small patches), therefore all the
X stuff was written by AI, so it can be improved a lot for sure;
I welcome any patches/suggestions.

Hiltjo Posthuma

unread,
Feb 14, 2026, 6:41:24 AM (yesterday) Feb 14
to dev mail list
Thanks for sharing.
At a glance the code doesn't look bad written by an AI.

(Maybe there is some missing error checking in parse_color and XGrabPointer,
but I don't care to review AI code :))

Maybe interesting to you, there is also another pie menu. Written by a real
human bean, made with love:

https://github.com/phillbush/pmenu

--
Kind regards,
Hiltjo

NRK

unread,
Feb 14, 2026, 11:57:44 AM (24 hours ago) Feb 14
to dev mail list
Looks cool, seems to work (somewhat) ok.

Does not build correctly by default though:

pdmenu.c:12:10: fatal error: config.h: No such file or directory

You should make `config.h` a dependency of `pdmenu` in the makefile.

Also, on this topic, I think the whole `config.def.h` file is not very
useful and in many cases actively harmful. Most users are using git so
they can get back the default by just checking out git history, having
seperate config files (one tracked by git and one not) makes it annoying
to work with since they can get desynced. I personally just end up
making config.h a symlink to avoid all these issues.

The only case where the def file helps that I can think of would be
users using the tarball. But in that case, it's better to check out
`config.h` in the git repo and then only add the additional def file
while making the archive (i.e in `make dist` rule). This way git users
don't have to care about syncing two different files and tarball users
have a file with the defaults, win-win scenario.

Anyways, I said it works "somewhat" ok because if you pass too many
things to it it just seems unable to cope with it. E.g:

seq 64 | ./pdmenu

Also it'd be nice if the menu can be moved around. I use xbanish to
automatically move my cursor to the bottom and so pdmenu ends up
creating the menu there where half the items end up unselectable and
offscreen.

- NRK

Daniel Brandes

unread,
Feb 14, 2026, 2:45:05 PM (21 hours ago) Feb 14
to dev mail list
Speaking of -- what's the policy for generated code?



Hiltjo Posthuma

unread,
Feb 14, 2026, 3:42:37 PM (20 hours ago) Feb 14
to dev mail list
On Sat, Feb 14, 2026 at 08:38:28PM +0100, Daniel Brandes wrote:
> Speaking of -- what's the policy for generated code?
>
>
>

There is no policy, but I hope people (keeping) sending good quality patches
and test/review them beforehand.

If AI is used it is probably a good idea to say so also.

There have been no issues so far with people abusing AI for patches or software
so far on suckless. Lets see what happens :)

--
Kind regards,
Hiltjo

Страхиња Радић

unread,
Feb 14, 2026, 4:27:04 PM (19 hours ago) Feb 14
to dev mail list
Дана 26/02/14 12:40PM, Hiltjo Posthuma написа:
> Thanks for sharing.
> At a glance the code doesn't look bad written by an AI.

At a glance, see eg. load_defaults[1]. It seems completely redundant,
copies settings from static const variables set in config.h to static
variables in pdmenu.c, for... no reason whatsoever. So characteristic
of AI.

This is why code made by a living human should be preferable to AI.


[1]: https://github.com/pvxx/pdmenu/blob/fb3fe2325b029edb0f5bfd0424ec8ef4190e0cf2/pdmenu.c#L77

Peter Valach

unread,
Feb 14, 2026, 4:53:37 PM (19 hours ago) Feb 14
to dev mail list
On Sat, Feb 14, 2026 at 04:56:52PM +0000, NRK wrote:
> Looks cool, seems to work (somewhat) ok.
>
> Does not build correctly by default though:
>
> pdmenu.c:12:10: fatal error: config.h: No such file or directory
>
> You should make `config.h` a dependency of `pdmenu` in the makefile.
>
> Also, on this topic, I think the whole `config.def.h` file is not very
> [...]

It was my first time actually writing whole Makefile :), I copied a lot
from dmenu itself. Could you please point me to some doc or existing app
that already does this? I personally have some apps I keep up to date
and use git, others I only check occasionally and update using tarball
if there is something interesting or important; in both cases I vimdiff
my config and def to see if something changed, so for me it's fine to
have them separate. But it is true that for an app as simple as this it
may not be really needed.

> Anyways, I said it works "somewhat" ok because if you pass too many
> things to it it just seems unable to cope with it. E.g:
>
> seq 64 | ./pdmenu

I intentionally didn't add any checks, because I never use it with
"uncontrolled" input and didn't want to complicate the code needlessly;
but I will consider any suggestions, that are reasonably simple to
implement :).

> Also it'd be nice if the menu can be moved around. I use xbanish to
> automatically move my cursor to the bottom and so pdmenu ends up
> creating the menu there where half the items end up unselectable and
> offscreen.

I have no idea how to implement that :) and it somewhat goes against the
idea of needing minimum "mouse work". I use unclutter, so I rarely hit
this problem. My first plan was to make sure that whole menu fits on the
screen, but it had the very bad side effect, that the center item didn't
always end up under cursor, which is critical for me - that was the
reason I put one item in the center, so often used actions can be run
without thinking (I have usually at least three mapped there to
different mouse buttons ;). And in the rare case I have required option
off-screen, I just dismiss it (clicking an unmapped button), move the
mouse and run the menu again, takes less than a second. But in some use
cases it might not be optimal, maybe I could add it as an option.

- PVx

Peter Valach

unread,
Feb 14, 2026, 5:02:25 PM (19 hours ago) Feb 14
to dev mail list
On Sat, Feb 14, 2026 at 10:26:12PM +0100, Страхиња Радић wrote:
> Дана 26/02/14 12:40PM, Hiltjo Posthuma написа:
> > Thanks for sharing.
> > At a glance the code doesn't look bad written by an AI.
>
> At a glance, see eg. load_defaults[1]. It seems completely redundant,
> copies settings from static const variables set in config.h to static
> variables in pdmenu.c, for... no reason whatsoever. So characteristic
> of AI.
>
> This is why code made by a living human should be preferable to AI.

Thanks, I should have realized this myself, I thought there is some
reason to use const in config ;). I'll fix it in the next release.

- PVx

Greg Minshall

unread,
Feb 14, 2026, 5:14:52 PM (18 hours ago) Feb 14
to dev mail list
Страхиња,

> At a glance, see eg. load_defaults[1]. It seems completely redundant,
> copies settings from static const variables set in config.h to static
> variables in pdmenu.c, for... no reason whatsoever. So characteristic
> of AI.

actually, i tend to write my code that way. but, who's to say that i
don't pass the Turing test. :)

cheers, Greg

Peter Valach

unread,
Feb 14, 2026, 5:16:23 PM (18 hours ago) Feb 14
to dev mail list
On Sat, Feb 14, 2026 at 12:40:30PM +0100, Hiltjo Posthuma wrote:
> On Sat, Feb 14, 2026 at 12:11:40PM +0100, Peter Valach wrote:
> > I created this a few months ago and used it since then without problems,
> > maybe it will be useful for someone here:
> >
> > pdmenu is a minimal, mouse-only, radial (pie) menu for X11.
> >
> > It reads menu items from stdin (like dmenu), displays them in
> > a fullscreen transparent overlay around the current mouse cursor, and
> > prints the selected item to stdout. Inspired by https://kando.menu/,
> > implementing only the basic idea.
> >
> > The first item is shown in the center; remaining items are arranged
> > clockwise in a circle, starting from the top.
> >
> > https://github.com/pvxx/pdmenu
> >
> > I know literally nothing about X programming and it is really long time
> > since I did anything in C (except small patches), therefore all the
> > X stuff was written by AI, so it can be improved a lot for sure;
> > I welcome any patches/suggestions.
> >
>
> Thanks for sharing.
> At a glance the code doesn't look bad written by an AI.
>
> (Maybe there is some missing error checking in parse_color and XGrabPointer,
> but I don't care to review AI code :))

thanks for looking, I did quite a few changes, but in X stuff itself
only cosmetic ones :).

> Maybe interesting to you, there is also another pie menu. Written by a real
> human bean, made with love:
>
> https://github.com/phillbush/pmenu

I searched before and found a few, I don't remember this one exactly;
but all of them had too many dependencies and/or were specifically for
starting apps. I wanted something dmenu-like, that can be easily
incorporated into scripts. Like I wrote in README, I use it mainly for
browser stuff (like downloading videos and images into specific
directories, storing links, making screenshots, etc.), because that is
the only time I have my hand on the mouse for longer time, for
everything else dmenu is better ;).

- PVx

NRK

unread,
Feb 14, 2026, 5:38:31 PM (18 hours ago) Feb 14
to dev mail list
On Sat, Feb 14, 2026 at 10:46:01PM +0100, Peter Valach wrote:
> My first plan was to make sure that whole menu fits on the screen, but
> it had the very bad side effect, that the center item didn't always
> end up under cursor

You can use XWarpPointer() to automagically move the cursor over to the
center in those edge cases. Though maybe that could be a bit jarring to
have your cursor jump over, you'll need to test it out and judge for
yourself.

- NRK

Страхиња Радић

unread,
Feb 14, 2026, 6:07:47 PM (18 hours ago) Feb 14
to dev mail list
Дана 26/02/14 11:00PM, Peter Valach написа:
> Thanks, I should have realized this myself, I thought there is some
> reason to use const in config ;). I'll fix it in the next release.

The reason to use const is to give a hint to a reader (programmer) that
some variable should not be changed. If you take a look at eg. st's
config.def.h, it has some variables with const and others without it.

Aside from (indirectly?) producing a Personal Computing crisis of
unprecedented proportions since the beginnings of PC in the form of
artificially created memory shortage for home computer users, AI
generally creates worse code than humans. I find it more efficient and
easier to write a program from scratch than to have to review and fix
someone else's code, including AI. The main idea of suckless movement
is to write efficient, frugal code without cruft that is currently
characteristic for mainstream software, and AI just reinforces that
mainstream pattern.

Personally, I'm hoping for the "AI bubble" to burst as soon as
possible, despite the implications.

Peter Valach

unread,
11:12 AM (1 hour ago) 11:12 AM
to dev mail list
On Sat, Feb 14, 2026 at 10:37:49PM +0000, NRK wrote:
> On Sat, Feb 14, 2026 at 10:46:01PM +0100, Peter Valach wrote:
> > My first plan was to make sure that whole menu fits on the screen, [..]
>
> You can use XWarpPointer() to automagically move the cursor over to the
> center in those edge cases. Though maybe that could be a bit jarring to
> have your cursor jump over, you'll need to test it out and judge for
> yourself.

Thanks, that didn't even cross my mind :), I'll try to play with it,
when I'll have some time (probably in a few weeks).

- PVx

Reply all
Reply to author
Forward
0 new messages