Skip to content
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

Get item actions from callback #1032

Closed
itsmeipg opened this issue Dec 12, 2024 · 4 comments
Closed

Get item actions from callback #1032

itsmeipg opened this issue Dec 12, 2024 · 4 comments

Comments

@itsmeipg
Copy link

Would it be possible to access a selected item's actions in callback? Just by hovering over the main item, instead of selecting/hovering over the item's action(s).

@tomasklaen
Copy link
Owner

tomasklaen commented Dec 12, 2024

There are no hover/selected events currently. Not sure if it's a good idea adding them. That would be a lot of noise. What is the use case?

@itsmeipg
Copy link
Author

image
I have multiple items in multiple submenus that control number properties (colors, deband, etc) and in my callback function, I want to listen to event.type == "key" (ctrl+left/right) to decrease/increase rapidly, instead of having to hover over an action and hold enter. selected_item only gives info about the item value, which none of these items have, so the only way to get info about the selected item is by using the item value in a way its not supposed to be used, or by doing some complicated calculations with menu_id and selected_item.index. It would be great if I could just link the key combo to the item's actions directly.

@tomasklaen
Copy link
Owner

so the only way to get info about the selected item is by using the item value in a way its not supposed to be used

In non-callback menus, value is used as an mpv command. In callback menus, it's just passed to you, so it can be whatever you need it to be.

If I understand correctly, you want ctrl+left/right to increase/decrease some variable. So use item.value as the name/identifier of that variable, and edit it during a key event based on waht key was pressed.

@itsmeipg
Copy link
Author

I should have thought this out more before making this issue... I'll paste my actions into the value. Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants