feat(custom) Implement dropdown menu support for custom modules#71
feat(custom) Implement dropdown menu support for custom modules#71koshea wants to merge 3 commits intowayle-rs:masterfrom
Conversation
|
I really liked the idea here, and wanted a similar feature for a custom module that i "hacked" in a dropdown with wofi. I wrote up my own solution for this in #83 that i think is more idiomatic and scalable for other usecases and I considered your kubectl usecase as well to see if my solution would enable you as well. take a look! i'd love to collaborate with you on a solution that works well and is extensible for more/future wayle usecases. |
Hi @agrahamlincoln glad to hear I am not the only one who wanted this functionality. I don't have a strong case on whether these should be rolled up into the dropdown registry. They seemed less likely to be re-usable to me hence keeping in the module. Appreciate the other improvements you made and happy to collaborate to get one or the other version merged. |
Objective
Enable custom modules to show an inline dropdown picker for context-switching use cases (kubectl, gcloud, etc.) without requiring new Rust code per widget, pure config only.
Solution
Added three new config fields to CustomModuleDefinition:
left-click = "dropdown" (bare, no colon) opens the module's own inline popover. A new ClickAction::InlineDropdown variant handles parsing; the registry dispatcher treats it as a no-op since the custom module handles it directly.
The dropdown picker (CustomDropdownPicker) follows the existing DevicePicker pattern: ListBox + FactoryVecDeque, single-click activation, checkmark on the active item (matched by exact trimmed text against the module's current output). The popover uses the standard .dropdown wrapper, autohide, position detection, and shadow styling.
A BarButtonInput::SetEllipsize message was added to allow modules to override the label truncation mode without changing BarButtonBehavior.
Additional robustness:
Example config:
Test Plan