Pear release 1.11.1 docs (#169)

* Add `data` cli command & info about `apps` subcommand

* Add `pear reset` cli command for resetting a Pear application

Added a warning in the description as the command can result in lost
data and users should be cautious when using it.

* Remove leading spaces for `data` command flags

* Add note about dumping paths from `pear://` links in `dump` command

* Add `Pear.tray()` to Pear API docs

* Add supported formats for tray icon

* Remove `--unsafe-clear-preferences` from `pear run` cli doc

* Add `pear.gui.name` config option

* Edit new documentation for grammar & formatting

* Clarify `pear.gui.name` is an override & doesnt have a default

* Remove using "you" in `pear dump` doc & Correct grammar in `Pear.tray()`

Co-authored-by: David Mark Clements <huperekchunow@googlemail.com>

* Reword `pear reset` to make warning explicit

* Add note about hidden app issues when linux doesn't support `Pear.tray()`

---------

Co-authored-by: David Mark Clements <huperekchunow@googlemail.com>
This commit is contained in:
Sean Zellmer
2025-03-07 12:54:57 -06:00
committed by GitHub
parent 835fd15cb6
commit 47c6f034cb
3 changed files with 70 additions and 1 deletions

View File

@@ -451,6 +451,29 @@ Returns a `Boolean` promise for whether the call succeeded.
Desktop Applications only.
### `Pear.tray(options <Object>, listener <Async Function|Function>) => Promise<untray()>`
Configure a tray icon for the application. This method will return a promise which resolves to an `untray()` function for removing the tray.
The `listener` function is triggered whenever a menu item or the tray icon is clicked. It receives a single argument `key` that represents the menu item `key` that was clicked or the special value of `'click'` for when the menu icon itself was clicked. If no `listener` function is provided, a default listener will show the application window when triggered with `'click'` or `'show'` and quits with `'quit'`.
A Pear application must be `hideable` to support adding a tray (see [`pear.gui.hideable`](./configuration.md#pear.gui.hideable-less-than-boolean-greater-than-default-false)).
WARNING: Linux tray support varies which can cause scenarios where the application's tray doesn't work and closing the app will be hidden and inaccessible. Using a tray and `hideable` on Linux is not recommended.
Desktop Applications only.
**Options**
* `icon <String>` Default: The Pear icon - The path for icon for the tray
relative to the project root. Supported formats: PNG & JPEG
* `menu <Object>` Default: ``{ show: `Show ${Pear.config.name}`, quit: 'Quit' }`` - The
tray menu items. Each property of the object is the `key` passed to the
`listener` and whose value is the text displayed in the menu.
* `os <Object>` Default: `{ win32: true, linux: true, darwin: true }` - which
platforms support using the tray menu. The platform is checked via the
`process.platform` value.
### `const win = new Pear.Window(entry <String>, options <Object>)`
Desktop Applications only.