Skip to content

Commit d86aacc

Browse files
authored
enhance: allow show_menu_on_left_click on Windows (#11729)
1 parent 93a3a04 commit d86aacc

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri": patch:bug
3+
---
4+
5+
Support for `set_show_menu_on_left_click` was implemented on Windows too. So it
6+
should not be macOS anymore. [tauri-apps/tray-icon#199](https://github.com/tauri-apps/tray-icon/pull/199)

crates/tauri/src/tray/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl<R: Runtime> TrayIconBuilder<R> {
307307
self
308308
}
309309

310-
/// Whether to show the tray menu on left click or not, default is `true`. **macOS only**.
310+
/// Whether to show the tray menu on left click or not, default is `true`. **macOS & Windows only**.
311311
pub fn menu_on_left_click(mut self, enable: bool) -> Self {
312312
self.inner = self.inner.with_menu_on_left_click(enable);
313313
self
@@ -549,9 +549,9 @@ impl<R: Runtime> TrayIcon<R> {
549549
Ok(())
550550
}
551551

552-
/// Disable or enable showing the tray menu on left click. **macOS only**.
552+
/// Disable or enable showing the tray menu on left click. **macOS & Windows only**.
553553
pub fn set_show_menu_on_left_click(&self, #[allow(unused)] enable: bool) -> crate::Result<()> {
554-
#[cfg(target_os = "macos")]
554+
#[cfg(any(target_os = "macos", target_os = "windows"))]
555555
run_item_main_thread!(self, |self_: Self| self_
556556
.inner
557557
.set_show_menu_on_left_click(enable))?;

packages/api/src/tray.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export interface TrayIconOptions {
113113
* Use the icon as a [template](https://developer.apple.com/documentation/appkit/nsimage/1520017-template?language=objc). **macOS only**.
114114
*/
115115
iconAsTemplate?: boolean
116-
/** Whether to show the tray menu on left click or not, default is `true`. **macOS only**. */
116+
/** Whether to show the tray menu on left click or not, default is `true`. **macOS & Windows only**. */
117117
menuOnLeftClick?: boolean
118118
/** A handler for an event on the tray icon. */
119119
action?: (event: TrayIconEvent) => void
@@ -278,7 +278,7 @@ export class TrayIcon extends Resource {
278278
})
279279
}
280280

281-
/** Disable or enable showing the tray menu on left click. **macOS only**. */
281+
/** Disable or enable showing the tray menu on left click. **macOS & Windows only**. */
282282
async setMenuOnLeftClick(onLeft: boolean): Promise<void> {
283283
return invoke('plugin:tray|set_show_menu_on_left_click', {
284284
rid: this.rid,

0 commit comments

Comments
 (0)