[GH-ISSUE #86] Feature: Global Menu Primitive #64

Closed
opened 2026-03-04 01:01:36 +03:00 by kerem · 3 comments
Owner

Originally created by @muesli on GitHub (Mar 24, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/86

I've started working on a little Menu primitive, which I seem to need rather often in my apps. I'm wondering if it's a common enough feature, that would warrant integrating something like it directly in tview.

This would allow for a tighter integration with tview.Application, the fullscreen layout/screen and global shortcuts.

Link to my (still bare-bone) implementation: https://github.com/muesli/service-tools/blob/master/service-monitor/menu.go

Originally created by @muesli on GitHub (Mar 24, 2018). Original GitHub issue: https://github.com/rivo/tview/issues/86 I've started working on a little Menu primitive, which I seem to need rather often in my apps. I'm wondering if it's a common enough feature, that would warrant integrating something like it directly in tview. This would allow for a tighter integration with `tview.Application`, the fullscreen layout/screen and global shortcuts. Link to my (still bare-bone) implementation: https://github.com/muesli/service-tools/blob/master/service-monitor/menu.go
kerem closed this issue 2026-03-04 01:01:37 +03:00
Author
Owner

@rivo commented on GitHub (Mar 25, 2018):

Originally, the List primitive was implemented as a kind of menu. That's why it has shortcuts to select list items. Unless you're adding sub-menus etc., I don't see the difference between this and a List yet.

<!-- gh-comment-id:375962871 --> @rivo commented on GitHub (Mar 25, 2018): Originally, the `List` primitive was implemented as a kind of menu. That's why it has shortcuts to select list items. Unless you're adding sub-menus etc., I don't see the difference between this and a `List` yet.
Author
Owner

@muesli commented on GitHub (Mar 25, 2018):

But that doesn't feature global shortcuts and is usually a focusable UI component you control with your cursor keys. Have you checked out my example? Is this something you can achieve with List as well?

A live thingy I use this Primitive in would be: https://github.com/muesli/service-tools/tree/master/service-monitor

<!-- gh-comment-id:375984185 --> @muesli commented on GitHub (Mar 25, 2018): But that doesn't feature global shortcuts and is usually a focusable UI component you control with your cursor keys. Have you checked out my example? Is this something you can achieve with List as well? A live thingy I use this Primitive in would be: https://github.com/muesli/service-tools/tree/master/service-monitor
Author
Owner

@rivo commented on GitHub (Mar 26, 2018):

I just had a brief look at the code. Didn't realize it installs a global key listener.

This use case is exactly what app.SetInputCapture() is for. I use it in the presentation demo, too. You could use that to call SetCurrentItem() on a List. I update a TextView component with it. I guess everybody has a different idea of what such a menu could look like.

It's conceivable to extend the List primitive to draw the list items horizontally. But it doesn't feel right to introduce a primitive that has global effects, potentially conflicting ones with other primitives.

<!-- gh-comment-id:376219490 --> @rivo commented on GitHub (Mar 26, 2018): I just had a brief look at the code. Didn't realize it installs a global key listener. This use case is exactly what `app.SetInputCapture()` is for. I use it in the presentation demo, too. You could use that to call `SetCurrentItem()` on a `List`. I update a `TextView` component with it. I guess everybody has a different idea of what such a menu could look like. It's conceivable to extend the `List` primitive to draw the list items horizontally. But it doesn't feel right to introduce a primitive that has global effects, potentially conflicting ones with other primitives.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#64
No description provided.