diff --git a/src/accelerator.rs b/src/accelerator.rs index 57b21bd..4e5b2c5 100644 --- a/src/accelerator.rs +++ b/src/accelerator.rs @@ -30,6 +30,11 @@ pub use keyboard_types::{Code, Modifiers}; use std::{borrow::Borrow, hash::Hash, str::FromStr}; +#[cfg(target_os = "macos")] +pub const CMD_OR_CTRL: Modifiers = Modifiers::SUPER; +#[cfg(not(target_os = "macos"))] +pub const CMD_OR_CTRL: Modifiers = Modifiers::CONTROL; + /// A keyboard shortcut that consists of an optional combination /// of modifier keys (provided by [`Modifiers`](crate::accelerator::Modifiers)) and /// one key ([`Code`](crate::accelerator::Code)). diff --git a/src/items/predefined.rs b/src/items/predefined.rs index d2b9de9..96e8cf1 100644 --- a/src/items/predefined.rs +++ b/src/items/predefined.rs @@ -4,14 +4,12 @@ use std::{cell::RefCell, rc::Rc}; -use crate::{accelerator::Accelerator, AboutMetadata, IsMenuItem, MenuItemType}; +use crate::{ + accelerator::{Accelerator, CMD_OR_CTRL}, + AboutMetadata, IsMenuItem, MenuItemType, +}; use keyboard_types::{Code, Modifiers}; -#[cfg(target_os = "macos")] -pub const CMD_OR_CTRL: Modifiers = Modifiers::META; -#[cfg(not(target_os = "macos"))] -pub const CMD_OR_CTRL: Modifiers = Modifiers::CONTROL; - /// A predefined (native) menu item which has a predfined behavior by the OS or by this crate. pub struct PredefinedMenuItem(pub(crate) Rc>);