diff --git a/atom/browser/api/atom_api_tray.cc b/atom/browser/api/atom_api_tray.cc index 82f78519aeb3..0f07737da2bf 100644 --- a/atom/browser/api/atom_api_tray.cc +++ b/atom/browser/api/atom_api_tray.cc @@ -136,6 +136,7 @@ v8::Local Tray::ModifiersToObject(v8::Isolate* isolate, obj.Set("shiftKey", static_cast(modifiers & ui::EF_SHIFT_DOWN)); obj.Set("ctrlKey", static_cast(modifiers & ui::EF_CONTROL_DOWN)); obj.Set("altKey", static_cast(modifiers & ui::EF_ALT_DOWN)); + obj.Set("metaKey", static_cast(modifiers & ui::EF_COMMAND_DOWN)); return obj.GetHandle(); } diff --git a/atom/browser/ui/win/notify_icon_host.cc b/atom/browser/ui/win/notify_icon_host.cc index c34e14375e76..2c84837e714d 100644 --- a/atom/browser/ui/win/notify_icon_host.cc +++ b/atom/browser/ui/win/notify_icon_host.cc @@ -5,6 +5,7 @@ #include "atom/browser/ui/win/notify_icon_host.h" #include +#include #include "atom/browser/ui/win/notify_icon.h" #include "base/bind.h" @@ -28,6 +29,11 @@ const UINT kBaseIconId = 2; const wchar_t kNotifyIconHostWindowClass[] = L"Electron_NotifyIconHostWindow"; +bool IsWinPressed() { + return ((::GetKeyState(VK_LWIN) & 0x8000) == 0x8000) || + ((::GetKeyState(VK_RWIN) & 0x8000) == 0x8000); +} + int GetKeyboardModifers() { int modifiers = ui::EF_NONE; if (base::win::IsShiftPressed()) @@ -36,6 +42,8 @@ int GetKeyboardModifers() { modifiers |= ui::EF_CONTROL_DOWN; if (base::win::IsAltPressed()) modifiers |= ui::EF_ALT_DOWN; + if (IsWinPressed()) + modifiers |= ui::EF_COMMAND_DOWN; return modifiers; } diff --git a/docs/api/tray.md b/docs/api/tray.md index 5c8c88018f71..3d3ebc280f5a 100644 --- a/docs/api/tray.md +++ b/docs/api/tray.md @@ -51,6 +51,7 @@ Creates a new tray icon associated with the `image`. * `altKey` Boolean * `shiftKey` Boolean * `ctrlKey` Boolean + * `metaKey` Boolean * `bounds` Object - the bounds of tray icon * `x` Integer * `y` Integer @@ -67,6 +68,7 @@ __Note:__ The `bounds` payload is only implemented on OS X and Windows 7 or newe * `altKey` Boolean * `shiftKey` Boolean * `ctrlKey` Boolean + * `metaKey` Boolean * `bounds` Object - the bounds of tray icon * `x` Integer * `y` Integer @@ -83,6 +85,7 @@ __Note:__ This is only implemented on OS X and Windows. * `altKey` Boolean * `shiftKey` Boolean * `ctrlKey` Boolean + * `metaKey` Boolean * `bounds` Object - the bounds of tray icon * `x` Integer * `y` Integer