Skip to content

Commit

Permalink
chore: fix wrong reference to menu receiver in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Jul 28, 2023
1 parent 22f360f commit 9d3ffa0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ tray-icon lets you create tray icons for desktop applications.

- `common-controls-v6`: Use `TaskDialogIndirect` API from `ComCtl32.dll` v6 on Windows for showing the predefined `About` menu item dialog.
- `libxdo`: Enables linking to `libxdo` which is used for the predfined `Copy`, `Cut`, `Paste` and `SelectAll` menu item, see https://github.com/tauri-apps/muda#cargo-features
- `serde`:Enables de/serializing the dpi types.

## Dependencies (Linux Only)

Expand Down Expand Up @@ -64,23 +65,23 @@ let tray_icon = TrayIconBuilder::new()

## Processing tray events

You can use `TrayEvent::receiver` to get a reference to the `TrayEventReceiver`
You can use `TrayIconEvent::receiver` to get a reference to the `TrayIconEventReceiver`
which you can use to listen to events when a click happens on the tray icon

```rs
use tray_icon::TrayEvent;
use tray_icon::TrayIconEvent;

if let Ok(event) = TrayEvent::receiver().try_recv() {
if let Ok(event) = TrayIconEvent::receiver().try_recv() {
println!("{:?}", event);
}
```

You can also listen for the menu events using `TrayEvent::receiver` to get events for the tray context menu.
You can also listen for the menu events using `MenuEvent::receiver` to get events for the tray context menu.

```rs
use tray_icon::{TrayEvent, menu::{MenuEvent}};
use tray_icon::{TrayIconEvent, menu::{MenuEvent}};

if let Ok(event) = TrayEvent::receiver().try_recv() {
if let Ok(event) = TrayIconEvent::receiver().try_recv() {
println!("tray event: {:?}", event);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
//! }
//! ```
//!
//! You can also listen for the menu events using [`TrayIconEvent::receiver`] to get events for the tray context menu.
//! You can also listen for the menu events using [`MenuEvent::receiver`] to get events for the tray context menu.
//!
//! ```no_run
//! use tray_icon::{TrayIconEvent, menu::MenuEvent};
Expand Down

0 comments on commit 9d3ffa0

Please sign in to comment.