Conversation
|
Hi Misko, it's a useful addition.
So, this would be used in 'yad --paned ' as one of the two plugs, right? Or
standalone operating on another focused yad widget, right?
…On Sat, 20 Dec 2025, 09:15 Милош Павловић, ***@***.***> wrote:
*Misko-2083* left a comment (v1cont/yad#325)
<#325 (comment)>
yad --menubar="File;;, \ New|item-new|document-new, \ Open|item-open|document-open, \ Save|item-save|document-save, \ , \ Exit|echo $YAD_PID|application-exit, \Edit;;, \ Cut|item-cut|edit-cut, \ Copy|item-copy|edit-copy, \ Advanced|, \ Clean Buffers|item-clean|edit-clear, \ Optimize|item-opt|system-run, \ , \ View;;, \ Status Bar|item-stat|check, \ Tool Bar|item-tool|check, \Help;;, \ Docs|xdg-open https://github.com/v1cont/yad|help-browser, \ About|yad --about|help-about" --scale
yad-menubar-file.png (view on web)
<https://github.com/user-attachments/assets/53be1d64-4860-462e-8f25-8d4831b7533b> yad-menubar-scale.png
(view on web)
<https://github.com/user-attachments/assets/8a43c189-274f-4ea3-8517-d967c46a9a2a>
—
Reply to this email directly, view it on GitHub
<#325 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/APRODEUV6QF5JEJE3IFLQS34CSPKPAVCNFSM6AAAAACPS7BSX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMNZXGE2TQNBSG4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
yad --form --field="Menu":mb ...
…On Sat, 20 Dec 2025, 13:03 MC MC, ***@***.***> wrote:
Hi Misko, it's a useful addition.
So, this would be used in 'yad --paned ' as one of the two plugs, right?
Or standalone operating on another focused yad widget, right?
On Sat, 20 Dec 2025, 09:15 Милош Павловић, ***@***.***>
wrote:
> *Misko-2083* left a comment (v1cont/yad#325)
> <#325 (comment)>
>
> yad --menubar="File;;, \ New|item-new|document-new, \ Open|item-open|document-open, \ Save|item-save|document-save, \ , \ Exit|echo $YAD_PID|application-exit, \Edit;;, \ Cut|item-cut|edit-cut, \ Copy|item-copy|edit-copy, \ Advanced|, \ Clean Buffers|item-clean|edit-clear, \ Optimize|item-opt|system-run, \ , \ View;;, \ Status Bar|item-stat|check, \ Tool Bar|item-tool|check, \Help;;, \ Docs|xdg-open https://github.com/v1cont/yad|help-browser, \ About|yad --about|help-about" --scale
>
> yad-menubar-file.png (view on web)
> <https://github.com/user-attachments/assets/53be1d64-4860-462e-8f25-8d4831b7533b> yad-menubar-scale.png
> (view on web)
> <https://github.com/user-attachments/assets/8a43c189-274f-4ea3-8517-d967c46a9a2a>
>
> —
> Reply to this email directly, view it on GitHub
> <#325 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/APRODEUV6QF5JEJE3IFLQS34CSPKPAVCNFSM6AAAAACPS7BSX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMNZXGE2TQNBSG4>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
|
|
No, menubar will be added only on the main notebook/paned window. #!/bin/bash
KEY=$RANDOM
yad --plug=$KEY --tabnum=1 --text="first tab with text" &
yad --plug=$KEY --tabnum=2 --text="second tab" --entry &
yad --paned --key=$KEY --tab="Tab 1" --tab="Tab 2" \
--menubar="_File;;_New|touch n.txt|document-new, \
_Quit|exit|gtk-quit, _Edit;;_Undo|undo-cmd|edit-undo"
KEY=$RANDOM
yad --plug=$KEY --tabnum=1 --text="first tab with text" &
yad --plug=$KEY --tabnum=2 --text="second tab" --entry &
yad --notebook --key=$KEY --tab="Tab 1" --tab="Tab 2" \
--menubar="_File;;_New|touch n.txt|document-new, \
_Quit|exit|gtk-quit, _Edit;;_Undo|undo-cmd|edit-undo"
It's not a form field. It works as a general option: yad --menubar="Menu;;_Quit|exit|gtk-quit" --form --field="Menu":TXTLike --text or image: |
|
Nice. Quickly looking at the code it appears:
None of the above is meant to criticize @Misko-208's proposal. It's just a list of the features I noticed. Therefore |
Removed CSS loading function and adjusted menu item activation logic. Improved handling of command execution and menu item creation.
Yes it's the same as button View;; \
Status Bar|echo status|check, \
Tool Bar|echo tool|check,Currently it’s just a visual on/off switch that runs a command. |
Uses local #pragma now



The Menubar in YAD option lets you create pretty sophisticated menu systems right from a single string in your script. It's super useful for building dynamic, interactive dialogs without needing a full-blown GUI toolkit. Here's what it can do:
Deep nesting: You can have as many submenu levels as you want, no practical limits.
Stateful toggles: Checkboxes that actually remember their state and show checked/unchecked icons.
Action binding: Items can run shell commands directly.
Visual stuff: It pulls in theme icons where possible, or you can embed custom ones.
How It's Built (The Parsing Logic)Under the hood, YAD uses a straightforward stack-based parser to handle the menu string. It's linear, it just goes left to right through the comma-separated items without any fancy recursion. They use a parent stack to keep track of the current menu level.
Here's roughly how it works:
The input string: Everything's separated by commas, and each item is typically in the format Label|Command|Type (or variations with icons, etc.).
The stack: Starts with the main menubar as the only parent. This tracks the current container you're adding items to.
Opening a submenu: If a label ends with ;; (or whatever marker they're using internally), it creates a new GtkMenu, attaches it as a submenu to the current parent, and pushes it onto the stack. From then on, new items go into that submenu.
Closing a submenu: An empty entry (like a double comma ,,) pops the top off the stack, so you're back to adding to the previous level.
Label part: A proper GTK label that supports mnemonics (like _File for Alt+F shortcuts).
Example:
yad --menubar="_File;;_New|notify-send 'New'|document-new,_Open|notify-send 'Open'|document-open,,_Quit|quit|application-exit,_Settings;;_Network|_Ethernet|notify-send 'Eth'|network-wired,_Wifi|notify-send 'Wifi'|network-wireless,,_Display|notify-send 'Display'|video-display,_Sound|notify-send 'Sound'|audio-volume-high,_Advanced|Hardw_are|notify-send 'HW'|check,Software|notify-send 'SW'|check" --text-info