vivaldi.menubarMenu Modders API Reference
Use the vivaldi.menubarMenu
API to show a menubar menu for windows and linux.
Types
#ContainerType
ENUM
Defines content of a container.
- bookmarks
- history
#SortOrder
ENUM
Defines how to sort container items.
- ascending
- descending
#SortField
ENUM
Defines what element to use as sort key.
- title
- url
- nickname
- description
- dateAdded
#Edge
ENUM
Defines position of menu items added in chrome code wrt container items.
- above
- below
- off
#ItemType
ENUM
What kind of item.
- command
- checkbox
- radio
- folder
#Rect
Position and size of element in menu bar.
Properties:
- x
integer
Left position of item that opens menu, screen coordinates.
- y
integer
Top position of item that opens menu, screen coordinates.
- width
integer
Width of item that opens menu.
- height
integer
Height of item that opens menu.
#Icons
- Icons
Icons encoded as base64.
Array
of:- string
#Item
One menu item.
Properties:
- id
integer
The unique id of item.
- name
string
Text in item.
- type
ItemType
Defaults to 'normal'.
- selected
- (optional)
boolean
Whether item is initially selected. Default to false.
- enabled
- (optional)
boolean
Whether item is enabled or not (grayed out) . Defaults to true.
- visible
- (optional)
boolean
Whether item is visible or not. Defaults to true.
- checked
- (optional)
boolean
true if the checkbox is checked. Ignored unless type is 'checkbox' or 'radiobutton'.
- radiogroup
- (optional)
integer
The radiobutton group this item belongs to. Must be present for a radio button.
- persistent
- (optional)
boolean
If true the menu item will remain open after menu item is clicked with mouse.
- shortcut
- (optional)
string
Shortcut to be displayed next to label.
- url
- (optional)
string
Url that can be used to determine a corresponding icon.
- icons
- (optional)
Icons
Icons for light and dark menus. There must be two icons and the last shall be for menus with a dark background.
#Separator
One separator
Properties:
- label
- (optional)
string
Text in item.
#Container
A collection of items set up and expanded from chrome.
Properties:
- id
string
Parent id of data to display.
- type
ContainerType
What kind of data to expand in this container.
- offset
integer
Offset into folder/parent data.
- groupFolders
boolean
If sorted, this flag will group any subfolders together.
- edge
Edge
Where to place extra menu items
- sortField
- (optional)
SortField
Sort key for elements.
- sortOrder
- (optional)
SortOrder
Sort order for elements.
#Element
One element in menu. All optional, but one and only one of 'item', 'separator' or 'container' should be set. 'children' is only considered when 'item' is set.
Properties:
- item
- (optional)
Item
⚠ NO DESCRIPTION PROVIDED
- separator
- (optional)
Separator
⚠ NO DESCRIPTION PROVIDED
- container
- (optional)
Container
⚠ NO DESCRIPTION PROVIDED
- children
- (optional)
Child menu items.
Array
of:- Element
#Menu
One menu with origin rect and a list if children.
Properties:
- id
integer
⚠ NO DESCRIPTION PROVIDED
- rect
Rect
⚠ NO DESCRIPTION PROVIDED
- children
⚠ NO DESCRIPTION PROVIDED
Array
of:- Element
#EventState
Describes keyboard modifiers and mouse button state.
Properties:
- ctrl
boolean
true if the Ctrl key is pressed when activating the menu.
- shift
boolean
true if the Shift key is pressed when activating the menu.
- alt
boolean
true if the Alt key is pressed when activating the menu.
- command
boolean
true if the Command key (Mac) is pressed when activating the menu.
- left
boolean
true if the left mouse button activated the menu.
- right
boolean
true if the right mouse button activated the menu.
- center
boolean
true if the center mouse button activated the menu.
#Disposition
ENUM
Defines where a bookmark should be opened.
- setting
- current
- new-tab
- new-window
- new-private-window
#BookmarkCommand
ENUM
Defines a non-navigation bookmark action.
- edit
- addactivetab
- addfolder
- addbookmark
- addseparator
- cut
- copy
- paste
#BookmarkAction
Passed with bookmark activation
Properties:
- id
string
⚠ NO DESCRIPTION PROVIDED
- command
BookmarkCommand
If set, disposition and background is ignored.
- disposition
Disposition
⚠ NO DESCRIPTION PROVIDED
- background
boolean
Extends disposition with a background option.
- state
EventState
⚠ NO DESCRIPTION PROVIDED
#Action
Passed with menu activation.
Properties:
- id
integer
Command id.
- state
EventState
⚠ NO DESCRIPTION PROVIDED
Listeners
How to use listeners
Each listener type has the same functions, used for each listener API in the same way:
.addListener(function
callback)
Adds a function to a listener for an event
.removeListener(function
callback)
Removes a function to a listener for an event
.hasListener(function
callback)
Returns a boolean if a function is attached to a listener for an event
.hasListeners()
Returns a boolean if a listener has any attached functions
.dispatch()
Returns array of promises dispatched to the listener
#onOpen
Fires before menu opens.
Parameters:
- id
integer
Menu id of the menu that opens.
#onClose
Fires before menu closes.
#onAction
Fired when menu item is activated.
Parameters:
- action
Action
What action to execute.
#onOpenBookmark
Fired when bookmark menu item is activated.
Parameters:
- windowId
integer
Window where action occurs.
- action
BookmarkAction
⚠ NO DESCRIPTION PROVIDED
#onBookmarkAction
Fired when bookmark command is activated.
Parameters:
- windowId
integer
Window where action occurs.
- action
BookmarkAction
⚠ NO DESCRIPTION PROVIDED
#onHover
Fired when a menu item with a url is highlighted.
Parameters:
- windowId
integer
Window where hover occurs.
- url
string
Url in menu item.
#onError
Fired if an error condtion occurs that can not be routed with a callback.
Parameters:
- text
string
Error message for logging purposes.
Methods
#show
Shows a context menu.
Parameters:
- properties
object
⚠ NO DESCRIPTION PROVIDED
Object Properties:
- windowId
integer
⚠ NO DESCRIPTION PROVIDED
- id
integer
Id of the menu in the 'siblings' list to open.
- siblings
List of menu entries.
Array
of:- Menu
- icons
Icons
Default and folder icons.
#getMaxId
Returns the maximium id (elements) a menu can use.