new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Electron · API · all subjects

dock & app menu

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Context menu default behavior in Electron

No context menu will appear by default in Electron. Context menus must be created explicitly using the menu.popup function on a Menu instance.

Two ways to listen for context menu events

Context menu events can be listened to in two ways: via the main process through webContents using the context-menu event, or in the renderer process via the contextmenu web event on DOM elements.

context-menu event in main process

Whenever a right-click is detected within the bounds of a specific WebContents instance, a context-menu event is triggered. The params object passed to the listener provides an extensive list of attributes to distinguish which type of element is receiving the event, such as linkURL for links and isEditable for editable elements like textarea.

contextmenu event in renderer process

The contextmenu event is available on DOM elements in the renderer process and can be used to call the menu.popup function via IPC to show context menus.

macOS Writing Tools, AutoFill, and Services in context menus

On macOS, Writing Tools, AutoFill, and Services menu items are disabled by default for context menus in Electron. To enable these features, pass the WebFrameMain associated to the target webContents to the frame parameter in menu.popup.

menu.popup frame parameter for macOS features

The menu.popup function accepts a frame parameter that should be set to params.frame from the context-menu event to enable Writing Tools, AutoFill, and Services on macOS.

Context menu trigger on Windows

Context menus are triggered by right-clicking or pressing a shortcut such as Shift + F10 on Windows.

Give your agent this brain