-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REQUEST] Document which values of menu_retv
can be passed to mode_result
#1614
Comments
I am completely lost what the request/question is. But Ill try to answer, might be the wrong answer. MenuReturn (that is passed to menu_retv) consists of 2 parts: Higher bits are documented in The lower bits (contained by MENU_LOWER_MASK) are used to pass extra parameters, this is used in QUICK_SWITCH and CUSTOM_COMMAND to indicate an index. Example in script mode: https://github.com/davatorium/rofi/blob/next/source/modes/script.c#L292 here this allows you to send Normally this is filtered out and passed as result (https://github.com/davatorium/rofi/blob/next/source/modes/help-keys.c#L71). See next reply for what that does. |
The same goes for ModeMode. This should be cleaned up, but would mean breaking plugins. |
What is it you are trying to do in your plugin? that might help me answer the question better? |
I guess this is the goal? https://github.com/SabrinaJewson/rofi-plugin-sys.rs |
For binding the Moving rofi (partially) over to rust is on my to-do, this would make a nice first start. |
Thank you for the response! My other question was whether it's possible for |
That binding is actually complete now, I ported over all the header files. Since it's so raw I didn't need to know the exact semantics of the functions, just their C types. But now I'm working on a higher-level binding and it would be useful to know exactly which values can/can't be passed into that function so I can define a correct enumeration of all the possible values.
That's nice to hear 😄 |
As you noticed, this is a lot of legacy code where a lot of stuff got bolted on top of it, trying to force new features in. |
I see how it is done, in mode.c line 93 it catches MENU_NEXT, MENU_PREV and MENU_QUICK_SWITCH before calling the Mode::mode_result . So in theory it can be passed to it, but I seem to have avoided every mode needing to handle this separately . |
this is a bit out of date, but was my 'plugin' template: |
Oh thank you very much, I don't know how I didn't spot that earlier!
Yes, I read through that and it was very helpful. |
Might be important for binding, mode_token_match can be called from multiple threads at the same time. |
I was trail running a discord: https://discord.gg/64ycuVPf might be useful if we need to have a discussion. |
By the way, I finished the library now: https://docs.rs/rofi-mode. I'm pretty pleased with it, it allows creating Rofi plugins from purely safe Rust :D |
neat, I am gonna play with it when I get some time. |
Before opening a feature request
What is the user problem or growth opportunity you want to see solved?
It's not made clear in the documentation what values of
menu_retv
can be legally passed tomode_result
, or whatmenu_retv
even is. I initially assumed that anyMENU_*
constant can be passed into it, but after reading the source code I'm unsure:MENU_NEXT
andMENU_PREVIOUS
to be passed in there, since those events are only generated as a response to a keypress which doesn't trigger therofi_view_maybe_update
function. I haven't dived into the code for some of the other variants but I imagine it's true for some of them as well.MENU_*
values seem to implicitly come with other bits set containing other state, but it's not clear which ones. This should probably be documented inmode.h
.So this feature request doubles up as a question and a request for documentation. If you answer the question I would also be happy to submit a PR to update the documentation.
How do you know that this problem exists today? Why is this important?
As far as I can tell this is not documented anywhere.
Who will benefit from it?
Plugin authors
Rofi version (rofi -v)
1.7.3
Configuration
N/A
Additional information
No response
The text was updated successfully, but these errors were encountered: