Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish New Versions #413

Merged
merged 1 commit into from
Jun 14, 2022
Merged

Publish New Versions #413

merged 1 commit into from
Jun 14, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jun 1, 2022

Version Updates

Merging this PR will release new versions of the following packages based on your change files.

tao

[0.11.0]

  • Breaking change SystemTrayBuilder::new and SystemTray::set_icon now takes system_tray::Icon on all platforms.
  • Allow to disable system tray menu only on Left Click.
    • 0858356f feat(macos): allow to disable system tray menu on left click, closes #317 (#329) on 2022-06-09
  • Connect mouse wheel event with GTK window.
    • f9e0b734 connect mouse wheel event with GTK window (#412) on 2022-06-08
  • Support child window on Linux.
    • f1e8d755 feat: support child window on linux, closes #273 (#415) on 2022-06-13
  • Support theme on macOS.
    • 8af4d8f0 feat: support theme on macOS (#408) on 2022-06-01
  • Add Window::set_ignore_cursor_events
    • 4fa87617 feat: Window::set_ignore_cursor_events, closes #184 (#421) on 2022-06-13

@github-actions github-actions bot requested a review from a team as a code owner June 1, 2022 12:12
@github-actions github-actions bot force-pushed the release branch 4 times, most recently from fb91aa2 to 859b1b2 Compare June 9, 2022 12:51
@awkj
Copy link

awkj commented Jun 9, 2022

Hello, I notice new tray_icon have the code snippest
0a98eb3

fn create_button_with_icon(&self) {
    const ICON_WIDTH: f64 = 18.0;
    const ICON_HEIGHT: f64 = 18.0;

    let icon = self.icon.inner.to_png();

    unsafe {
      let status_item = self.ns_status_bar;
      let button = status_item.button();

      // build our icon
      let nsdata = NSData::dataWithBytes_length_(
        nil,
        icon.as_ptr() as *const std::os::raw::c_void,
        icon.len() as u64,
      );

      let nsimage = NSImage::initWithData_(NSImage::alloc(nil), nsdata);
      let new_size = NSSize::new(ICON_WIDTH, ICON_HEIGHT);

      button.setImage_(nsimage);
      let _: () = msg_send![nsimage, setSize: new_size];
      let is_template = match self.icon_is_template {
        true => YES,
        false => NO,
      };
      let _: () = msg_send![nsimage, setTemplate: is_template];
    }
  }

but commnet tell me ,icon is from let icon = Icon::from_rgba(icon_rgba, icon_width, icon_height);

// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0

//! **UNSTABLE** -- The `SystemTray` struct and associated types.
//!
//! Use [SystemTrayBuilder][tray_builder] to create your tray instance.
//!
//! [ContextMenu][context_menu] is used to created a Window menu on Windows and Linux. On macOS it's used in the menubar.
//!
//! ```rust,ignore
//! # let icon_rgba = Vec::<u8>::new();
//! # let icon_width = 0;
//! # let icon_height = 0;
//! let mut tray_menu = ContextMenu::new();
//! let icon = Icon::from_rgba(icon_rgba, icon_width, icon_height);
//!
//! tray_menu.add_item(MenuItemAttributes::new("My menu item"));
//!
//! let mut system_tray = SystemTrayBuilder::new(icon, Some(tray_menu))
//!   .build(&event_loop)
//!   .unwrap();
//! ```
//!
//! # Linux
//! A menu is required or the tray return an error containing `assertion 'G_IS_DBUS_CONNECTION (connection)'`.
//!
//! [tray_builder]: crate::system_tray::SystemTrayBuilder
//! [menu_bar]: crate::menu::MenuBar
//! [context_menu]: crate::menu::ContextMenu

the mean will only set_icon lenght and height only "18.0" on macOS, because it not use Icon.hegith and Icon.width, and it will don't let user create canvas icon (bigger than 18.0)

@amrbashir
Copy link
Member

amrbashir commented Jun 9, 2022

@awkj ideal sizes for tray icons, are 16x16 on windows and linux, and 18x18 on macOS. Try using 32x32 it should be rendered correctly on all platforms.

@awkj
Copy link

awkj commented Jun 9, 2022

@awkj ideal sizes for tray icons, are 16x16 on windows and linux, and 18x18 on macOS. Try using 32x32 it should be rendered correctly on all platforms.

macos tray allow set any weight icon, network speed app use it to complete a rectangle icon, I thinke should open the API
image

@amrbashir
Copy link
Member

That's not an icon, that's a text, which is a different api.

@wusyong wusyong merged commit a41c2d6 into dev Jun 14, 2022
@wusyong wusyong deleted the release branch June 14, 2022 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants