Tray Icons
wv-tray%
activated
message-clicked
menu-item-chosen
unhandled-event
show
hide
close
set-icon!
set-tooltip!
show-message
set-menu!
connect-menu!
disconnect-menu!
handle
9.1

Tray Icons🔗ℹ

Hans Dijkema <hans@dijkewijk.nl>

 (require (file "../wv-tray.rkt")) package: base

The (file "../wv-tray.rkt") module provides the wv-tray% class. A tray object represents a native system tray icon backed by the webview runtime.

class

wv-tray% : class?

  superclass: object%

Creates a native tray icon.
Initialization fields
  • icon — mandatory

  • tooltip — default ""

  • menu — default #f

If a menu is provided, it is installed during initialization.
Events
These methods can be overridden.

method

(send a-wv-tray activated reason)  any/c

  reason : symbol?
Called when the tray icon is activated. The reason is derived from the native event.

method

(send a-wv-tray message-clicked)  any/c

Called when a tray message is clicked.

method

(send a-wv-tray menu-item-chosen id)  any/c

  id : symbol?
Called when a menu item is chosen without a registered callback.

method

(send a-wv-tray unhandled-event evt)  any/c

  evt : hash?
Called for unhandled native events.

Commands

method

(send a-wv-tray show)  (is-a?/c wv-tray%)

Shows the tray icon and returns the tray object.

method

(send a-wv-tray hide)  (is-a?/c wv-tray%)

Hides the tray icon and returns the tray object.

method

(send a-wv-tray close)  (is-a?/c wv-tray%)

Closes the tray icon and returns the tray object.

method

(send a-wv-tray set-icon! icon-file)  (is-a?/c wv-tray%)

  icon-file : path-string?
Changes the tray icon and returns the tray object.

method

(send a-wv-tray set-tooltip! text)  (is-a?/c wv-tray%)

  text : string?
Changes the tooltip and returns the tray object.

method

(send a-wv-tray show-message title message)  (is-a?/c wv-tray%)

  title : string?
  message : string?
Shows a native tray message and returns the tray object.

method

(send a-wv-tray set-menu! menu-def)  (is-a?/c wv-tray%)

  menu-def : any/c
Installs a tray menu and returns the tray object.

method

(send a-wv-tray connect-menu! id callback)  (is-a?/c wv-tray%)

  id : symbol?
  callback : procedure?
Registers a callback for a menu item and returns the tray object.

method

(send a-wv-tray disconnect-menu! id)  (is-a?/c wv-tray%)

  id : symbol?
Removes a menu callback and returns the tray object.

method

(send a-wv-tray handle)  any/c

Returns the native tray handle.