phillbush/xprompt

Custom actions

Jemi opened this issue · 2 comments

Jemi commented

I haven't tried xprompt yet, but I was looking through the raw manpage on github, and it looks like the keybindings are just geared towards specifying the actions that xprompt itself knows how to perform. Xprompt should also also allow specifying a separate, fully custom set of keychords which, when triggered, send a custom piece of data back to the wrapper script so that it can take an appropriate action. Implementing this would fill in a big hole in dmenu functionality.

These custom actions could be implemented as environment variables with multiple fields, e.g. like this (in bash syntax):

XPROMPTCUSTACTION01='CTRL-r:BOBSYOURUNCLE'
XPROMPTCUSTACTION02='ALT-4:LIFETHEUNIVERSEANDEVERYTHING'
XPROMPTCUSTACTION03='CTRL-!:ONCE, UPON A MIDNIGHT DREARY AS I PONDERED WEAK AND WEARY'
XPROMPTCUSTACTION04='ALT-B:' #<- where data is arbitrary data, whether or not it fits into the UTF-8 character set, although you could use null as the terminator for these data strings if you really had to, as null is pretty commonly avoided in environment variables anyway.

That's an interesting idea.
I think I'll implement custom keybindings in the input itself, rather than in environment variables.
I'm gonna implement it probably in the next week.

Jemi commented

You mean like the handler program emits a DSL for keybindings mixed with the list it's outputting à lá dzen, or as command line args? It seems to me the latter would be better normally, as the former gets kind of complicated. The former makes sense only for context sensitive keybindings, and should have it's own switch.