phillbush / xmenu

a x11 menu utility
Other
296 stars 26 forks source link

[Feature request] non-operational labels #52

Closed vaygr closed 11 months ago

vaygr commented 11 months ago

It would be nice to have non-operational labels in xmenu for the purpose of creating dialog prompts.

For example: "Close window?", "Yes", "No". The idea is taken from fluxbox:

 [nop] (label) <'icon'>

    Insert a non-operational item into the current menu. This is much like [separator],
but instead of a line, it inserts a label. This can be used to help format the menu into
blocks or sections if so desired. The label is optional, and if omitted a blank item will
be inserted.

In terms of what it could look like in xmenu, maybe prefix non-operational labels with a dot?:

printf '.Confirm?\n\nYes\tyes\nNo\tno' | xmenu
vaygr commented 11 months ago

Seems like this has been implemented already in e9c3095, with a slightly different syntax, such as <label>\t:.

phillbush commented 11 months ago

Hi. Yeah, it has already been implemented. A description for such behavior was also added on the manual:

The output is the string that will be output after selecting the item. If an item does not have tabs after the label, its label is used as its output. If the output is empty or is a colon (:), the item cannot be selected.

I made colon as an "empty entry" in a previous commit. For example, separators (which are entries without labels) can be specified in the standard input either as an empty line or as a line with only a :.

vaygr commented 11 months ago

@phillbush would it be hard to backport that functionality to 4.6.1 as it seems rewrite is still in progress?

Current is not working as expected (for example, keys up/down just close the menu, some xresources changed). I tried to take a look at it yesterday, but didn't succeed. I'm wondering how much effort it would be to patch last stable.

vaygr commented 11 months ago

Turns out they were the segfaults:

[50702.480244] xmenu[3477985]: segfault at 30 ip 000055cf3a8f94ec sp 00007fff338c65f0 error 4 cpu 1 in xmenu[55cf3a8f2000+a000] likely on CPU 1 (core 1, socket 0)
[50702.480259] Code: 15 f1 2f 00 00 48 01 d0 ff e0 48 8b 45 d8 48 8b 40 18 48 89 45 e8 48 8b 45 d8 48 8b 40 20 48 89 45 f0 48 8b 45 d8 48 8b 40 10 <48> 8b 40 30 48 89 45 f8 48 8b 45 d8 8b 40 40 89 45 cc 44 8b 45 cc
[50715.508323] xmenu[3478973]: segfault at 30 ip 000056331ef714ec sp 00007ffe0f808400 error 4 cpu 2 in xmenu[56331ef6a000+a000] likely on CPU 2 (core 2, socket 0)
[50715.508340] Code: 15 f1 2f 00 00 48 01 d0 ff e0 48 8b 45 d8 48 8b 40 18 48 89 45 e8 48 8b 45 d8 48 8b 40 20 48 89 45 f0 48 8b 45 d8 48 8b 40 10 <48> 8b 40 30 48 89 45 f8 48 8b 45 d8 8b 40 40 89 45 cc 44 8b 45 cc
[50717.262368] xmenu[3479104]: segfault at 30 ip 0000563bb47264ec sp 00007ffccafbde60 error 4 cpu 2 in xmenu[563bb471f000+a000] likely on CPU 2 (core 2, socket 0)
[50717.262391] Code: 15 f1 2f 00 00 48 01 d0 ff e0 48 8b 45 d8 48 8b 40 18 48 89 45 e8 48 8b 45 d8 48 8b 40 20 48 89 45 f0 48 8b 45 d8 48 8b 40 10 <48> 8b 40 30 48 89 45 f8 48 8b 45 d8 8b 40 40 89 45 cc 44 8b 45 cc
[50727.209224] xmenu[3479763]: segfault at 30 ip 0000555749f404ec sp 00007ffd77114ef0 error 4 cpu 5 in xmenu[555749f39000+a000] likely on CPU 5 (core 1, socket 0)
[50727.209242] Code: 15 f1 2f 00 00 48 01 d0 ff e0 48 8b 45 d8 48 8b 40 18 48 89 45 e8 48 8b 45 d8 48 8b 40 20 48 89 45 f0 48 8b 45 d8 48 8b 40 10 <48> 8b 40 30 48 89 45 f8 48 8b 45 d8 8b 40 40 89 45 cc 44 8b 45 cc
[50729.044270] xmenu[3479924]: segfault at 30 ip 000055ceec19d4ec sp 00007ffdc0f7f870 error 4 cpu 6 in xmenu[55ceec196000+a000] likely on CPU 6 (core 2, socket 0)
[50729.044288] Code: 15 f1 2f 00 00 48 01 d0 ff e0 48 8b 45 d8 48 8b 40 18 48 89 45 e8 48 8b 45 d8 48 8b 40 20 48 89 45 f0 48 8b 45 d8 48 8b 40 10 <48> 8b 40 30 48 89 45 f8 48 8b 45 d8 8b 40 40 89 45 cc 44 8b 45 cc
[50730.814288] xmenu[3480047]: segfault at 30 ip 000055f1097944ec sp 00007ffdd43cdd90 error 4 cpu 0 in xmenu[55f10978d000+a000] likely on CPU 0 (core 0, socket 0)
[50730.814313] Code: 15 f1 2f 00 00 48 01 d0 ff e0 48 8b 45 d8 48 8b 40 18 48 89 45 e8 48 8b 45 d8 48 8b 40 20 48 89 45 f0 48 8b 45 d8 48 8b 40 10 <48> 8b 40 30 48 89 45 f8 48 8b 45 d8 8b 40 40 89 45 cc 44 8b 45 cc
vaygr commented 9 months ago

@phillbush ping re: https://github.com/phillbush/xmenu/issues/52#issuecomment-1760119761?