Repository: rust-windowing/winit
Pull request #4018: Align `NamedKey` and `KeyCode` more closely with the W3C specs
Author: login: madsmtm
Labels: name: S - api
description: Design and usability
name: S - docs
description: Awareness, docs, examples, etc.
name: I - BREAKING CHANGE
Created: 2024-12-01T15:18:01Z | Merged: 2025-03-23T11:56:01Z

Remove `NamedKey::Space` and rename uses of "super" to "meta".

These differences from the W3C specifications were introduced in https://github.com/rust-windowing/winit/pull/2662, though I can't find any discussion about it other than in https://github.com/rust-windowing/winit/pull/2662#issuecomment-1410921215. It seems like it was left mostly as an unresolved question?

I don't have any preference for either name, but I believe it is more confusing than helping that Winit is diverging and choosing to prefer "super" when the spec prefers "meta". Besides, it is blocking integration with `keyboard-types`.

Part of https://github.com/rust-windowing/winit/issues/2394.

Beware that this could break in confusing ways if someone was matching on `NamedKey::Super`, but we have `ModifiersState` for a reason, which I think most users will be using anyhow (and there it'll break loudly because `ModifiersState::SUPER` is gone).

CC @maroider @ArturKovacs @dhardy whom previously worked on this.

- [ ] Tested on all platforms changed
- [x] Added an entry to the `changelog` module if knowledge of this change could be valuable to users
- [x] Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
- [x] Created or updated an example program if it would help users understand this functionality



Diff:
diff --git a/examples/application.rs b/examples/application.rs
index 7b47865594..d0346821e3 100644
--- a/examples/application.rs
+++ b/examples/application.rs
@@ -1163,7 +1163,16 @@ fn modifiers_to_string(mods: ModifiersState) -> String {
     let mut mods_line = String::new();
     // Always add + since it's printed as a part of the bindings.
     for (modifier, desc) in [
-        (ModifiersState::SUPER, "Super+"),
+        (
+            ModifiersState::META,
+            if cfg!(target_os = "windows") {
+                "Win+"
+            } else if cfg!(target_vendor = "apple") {
+                "Cmd+"
+            } else {
+                "Super+"
+            },
+        ),
         (ModifiersState::ALT, "Alt+"),
         (ModifiersState::CONTROL, "Ctrl+"),
         (ModifiersState::SHIFT, "Shift+"),
@@ -1264,10 +1273,10 @@ const KEY_BINDINGS: &[Binding<&'static str>] = &[
     Binding::new("Z", ModifiersState::CONTROL, Action::ToggleCursorVisibility),
     // K.
     Binding::new("K", ModifiersState::empty(), Action::SetTheme(None)),
-    Binding::new("K", ModifiersState::SUPER, Action::SetTheme(Some(Theme::Light))),
+    Binding::new("K", ModifiersState::META, Action::SetTheme(Some(Theme::Light))),
     Binding::new("K", ModifiersState::CONTROL, Action::SetTheme(Some(Theme::Dark))),
     #[cfg(macos_platform)]
-    Binding::new("T", ModifiersState::SUPER, Action::CreateNewTab),
+    Binding::new("T", ModifiersState::META, Action::CreateNewTab),
     #[cfg(macos_platform)]
     Binding::new("O", ModifiersState::CONTROL, Action::CycleOptionAsAlt),
     Binding::new("S", ModifiersState::CONTROL, Action::Message),
diff --git a/src/changelog/unreleased.md b/src/changelog/unreleased.md
index df1261cb5d..21480289f0 100644
--- a/src/changelog/unreleased.md
+++ b/src/changelog/unreleased.md
@@ -194,6 +194,8 @@ changelog entry.
 - Removed `KeyEventExtModifierSupplement`, and made the fields `text_with_all_modifiers` and
   `key_without_modifiers` public on `KeyEvent` instead.
 - Move `window::Fullscreen` to `monitor::Fullscreen`.
+- Renamed "super" key to "meta", to match the naming in the W3C specification.
+  `NamedKey::Super` still exists, but it's non-functional and deprecated, `NamedKey::Meta` should be used instead.
 
 ### Removed
 
@@ -230,6 +232,7 @@ changelog entry.
 - Remove `CustomCursor::from_rgba`, use `CustomCursorSource` instead.
 - Removed `ApplicationHandler::exited`, the event loop being shut down can now be listened to in
   the `Drop` impl on the application handler.
+- Removed `NamedKey::Space`, match on `Key::Character(" ")` instead.
 
 ### Fixed
 
diff --git a/src/event.rs b/src/event.rs
index 2873a19375..c92ff1a676 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -869,12 +869,12 @@ impl Modifiers {
 
     /// The state of the left super key.
     pub fn lsuper_state(&self) -> ModifiersKeyState {
-        self.mod_state(ModifiersKeys::LSUPER)
+        self.mod_state(ModifiersKeys::LMETA)
     }
 
     /// The state of the right super key.
     pub fn rsuper_state(&self) -> ModifiersKeyState {
-        self.mod_state(ModifiersKeys::RSUPER)
+        self.mod_state(ModifiersKeys::RMETA)
     }
 
     fn mod_state(&self, modifier: ModifiersKeys) -> ModifiersKeyState {
diff --git a/src/keyboard.rs b/src/keyboard.rs
index da501b2dfc..9b9127dd16 100644
--- a/src/keyboard.rs
+++ b/src/keyboard.rs
@@ -1,4 +1,5 @@
 //! Types related to the keyboard.
+#![cfg_attr(feature = "serde", allow(deprecated))] // https://github.com/serde-rs/serde/issues/2195
 
 // This file contains a substantial portion of the UI Events Specification by the W3C. In
 // particular, the variant names within `Key` and `KeyCode` and their documentation are modified
@@ -283,11 +284,7 @@ impl PartialEq<PhysicalKey> for NativeKeyCode {
 
 /// Code representing the location of a physical key
 ///
-/// This mostly conforms to the UI Events Specification's [`KeyboardEvent.code`] with a few
-/// exceptions:
-/// - The keys that the specification calls "MetaLeft" and "MetaRight" are named "SuperLeft" and
-///   "SuperRight" here.
-/// - The key that the specification calls "Super" is reported as `Unidentified` here.
+/// This conforms to the UI Events Specification's [`KeyboardEvent.code`].
 ///
 /// [`KeyboardEvent.code`]: https://w3c.github.io/uievents-code/#code-value-tables
 #[non_exhaustive]
@@ -420,7 +417,7 @@ pub enum KeyCode {
     /// <kbd>CapsLock</kbd> or <kbd>⇪</kbd>
     CapsLock,
     /// The application context menu key, which is typically found between the right
-    /// <kbd>Super</kbd> key and the right <kbd>Control</kbd> key.
+    /// <kbd>Meta</kbd> key and the right <kbd>Control</kbd> key.
     ContextMenu,
     /// <kbd>Control</kbd> or <kbd>⌃</kbd>
     ControlLeft,
@@ -429,9 +426,9 @@ pub enum KeyCode {
     /// <kbd>Enter</kbd> or <kbd>↵</kbd>. Labeled <kbd>Return</kbd> on Apple keyboards.
     Enter,
     /// The Windows, <kbd>⌘</kbd>, <kbd>Command</kbd>, or other OS symbol key.
-    SuperLeft,
+    MetaLeft,
     /// The Windows, <kbd>⌘</kbd>, <kbd>Command</kbd>, or other OS symbol key.
-    SuperRight,
+    MetaRight,
     /// <kbd>Shift</kbd> or <kbd>⇧</kbd>
     ShiftLeft,
     /// <kbd>Shift</kbd> or <kbd>⇧</kbd>
@@ -613,9 +610,11 @@ pub enum KeyCode {
     AudioVolumeMute,
     AudioVolumeUp,
     WakeUp,
-    // Legacy modifier key. Also called "Super" in certain places.
-    Meta,
     // Legacy modifier key.
+    #[deprecated = "marked as legacy in the spec, use Meta instead"]
+    Super,
+    // Legacy modifier key.
+    #[deprecated = "marked as legacy in the spec, use Meta instead"]
     Hyper,
     Turbo,
     Abort,
@@ -741,12 +740,7 @@ pub enum KeyCode {
 
 /// A [`Key::Named`] value
 ///
-/// This mostly conforms to the UI Events Specification's [`KeyboardEvent.key`] with a few
-/// exceptions:
-/// - The `Super` variant here, is named `Meta` in the aforementioned specification. (There's
-///   another key which the specification calls `Super`. That does not exist here.)
-/// - The `Space` variant here, can be identified by the character it generates in the
-///   specification.
+/// This conforms to the UI Events Specification's [`KeyboardEvent.key`].
 ///
 /// [`KeyboardEvent.key`]: https://w3c.github.io/uievents-key/
 #[non_exhaustive]
@@ -791,24 +785,22 @@ pub enum NamedKey {
     /// The Symbol modifier key (used on some virtual keyboards).
     Symbol,
     SymbolLock,
-    // Legacy modifier key. Also called "Super" in certain places.
-    Meta,
     // Legacy modifier key.
+    #[deprecated = "marked as legacy in the spec, use Meta instead"]
+    Super,
+    // Legacy modifier key.
+    #[deprecated = "marked as legacy in the spec, use Meta instead"]
     Hyper,
-    /// Used to enable "super" modifier function for interpreting concurrent or subsequent keyboard
+    /// Used to enable "meta" modifier function for interpreting concurrent or subsequent keyboard
     /// input. This key value is used for the "Windows Logo" key and the Apple `Command` or `⌘`
     /// key.
-    ///
-    /// Note: In some contexts (e.g. the Web) this is referred to as the "Meta" key.
-    Super,
+    Meta,
     /// The `Enter` or `↵` key. Used to activate current selection or accept current input. This
     /// key value is also used for the `Return` (Macintosh numpad) key. This key value is also
     /// used for the Android `KEYCODE_DPAD_CENTER`.
     Enter,
     /// The Horizontal Tabulation `Tab` key.
     Tab,
-    /// Used in text to insert a space between words. Usually located below the character keys.
-    Space,
     /// Navigate or traverse downward. (`KEYCODE_DPAD_DOWN`)
     ArrowDown,
     /// Navigate or traverse leftward. (`KEYCODE_DPAD_LEFT`)
@@ -864,7 +856,7 @@ pub enum NamedKey {
     Attn,
     Cancel,
     /// Show the application’s context menu.
-    /// This key is commonly found between the right `Super` key and the right `Control` key.
+    /// This key is commonly found between the right `Meta` key and the right `Control` key.
     ContextMenu,
     /// The `Esc` key. This key was originally used to initiate an escape sequence, but is
     /// now more generally used to exit or "escape" the current context, such as closing a dialog
@@ -1583,7 +1575,6 @@ impl NamedKey {
             NamedKey::Enter => Some("\r"),
             NamedKey::Backspace => Some("\x08"),
             NamedKey::Tab => Some("\t"),
-            NamedKey::Space => Some(" "),
             NamedKey::Escape => Some("\x1b"),
             _ => None,
         }
@@ -1709,7 +1700,9 @@ bitflags! {
         /// The "alt" key.
         const ALT = 0b100 << 6;
         /// This is the "windows" key on PC and "command" key on Mac.
-        const SUPER = 0b100 << 9;
+        const META = 0b100 << 9;
+        #[deprecated = "use META instead"]
+        const SUPER = Self::META.bits();
     }
 }
 
@@ -1729,9 +1722,9 @@ impl ModifiersState {
         self.intersects(Self::ALT)
     }
 
-    /// Returns `true` if the super key is pressed.
-    pub fn super_key(&self) -> bool {
-        self.intersects(Self::SUPER)
+    /// Returns `true` if the meta key is pressed.
+    pub fn meta_key(&self) -> bool {
+        self.intersects(Self::META)
     }
 }
 
@@ -1764,7 +1757,11 @@ bitflags! {
         const RCONTROL = 0b0000_1000;
         const LALT     = 0b0001_0000;
         const RALT     = 0b0010_0000;
-        const LSUPER   = 0b0100_0000;
-        const RSUPER   = 0b1000_0000;
+        const LMETA    = 0b0100_0000;
+        const RMETA    = 0b1000_0000;
+        #[deprecated = "use LMETA instead"]
+        const LSUPER   = Self::LMETA.bits();
+        #[deprecated = "use RMETA instead"]
+        const RSUPER   = Self::RMETA.bits();
     }
 }
diff --git a/src/platform_impl/android/keycodes.rs b/src/platform_impl/android/keycodes.rs
index 207d549f3d..e1f77fe00e 100644
--- a/src/platform_impl/android/keycodes.rs
+++ b/src/platform_impl/android/keycodes.rs
@@ -143,8 +143,8 @@ pub fn to_physical_key(keycode: Keycode) -> PhysicalKey {
         Keycode::AltLeft => KeyCode::AltLeft,
         Keycode::AltRight => KeyCode::AltRight,
 
-        Keycode::MetaLeft => KeyCode::SuperLeft,
-        Keycode::MetaRight => KeyCode::SuperRight,
+        Keycode::MetaLeft => KeyCode::MetaLeft,
+        Keycode::MetaRight => KeyCode::MetaRight,
 
         Keycode::LeftBracket => KeyCode::BracketLeft,
         Keycode::RightBracket => KeyCode::BracketRight,
@@ -309,7 +309,7 @@ pub fn to_logical(key_char: Option<KeyMapChar>, keycode: Keycode) -> Key {
             ShiftLeft => Key::Named(NamedKey::Shift),
             ShiftRight => Key::Named(NamedKey::Shift),
             Tab => Key::Named(NamedKey::Tab),
-            Space => Key::Named(NamedKey::Space),
+            Space => Key::Character(" ".into()),
             Sym => Key::Named(NamedKey::Symbol),
             Explorer => Key::Named(NamedKey::LaunchWebBrowser),
             Envelope => Key::Named(NamedKey::LaunchMail),
@@ -340,8 +340,8 @@ pub fn to_logical(key_char: Option<KeyMapChar>, keycode: Keycode) -> Key {
             CtrlRight => Key::Named(NamedKey::Control),
             CapsLock => Key::Named(NamedKey::CapsLock),
             ScrollLock => Key::Named(NamedKey::ScrollLock),
-            MetaLeft => Key::Named(NamedKey::Super),
-            MetaRight => Key::Named(NamedKey::Super),
+            MetaLeft => Key::Named(NamedKey::Meta),
+            MetaRight => Key::Named(NamedKey::Meta),
             Function => Key::Named(NamedKey::Fn),
             Sysrq => Key::Named(NamedKey::PrintScreen),
             Break => Key::Named(NamedKey::Pause),
diff --git a/src/platform_impl/apple/appkit/event.rs b/src/platform_impl/apple/appkit/event.rs
index 59bbf54e05..acde964a8a 100644
--- a/src/platform_impl/apple/appkit/event.rs
+++ b/src/platform_impl/apple/appkit/event.rs
@@ -168,11 +168,11 @@ pub fn code_to_key(key: PhysicalKey, scancode: u16) -> Key {
     Key::Named(match code {
         KeyCode::Enter => NamedKey::Enter,
         KeyCode::Tab => NamedKey::Tab,
-        KeyCode::Space => NamedKey::Space,
+        KeyCode::Space => return Key::Character(" ".into()),
         KeyCode::Backspace => NamedKey::Backspace,
         KeyCode::Escape => NamedKey::Escape,
-        KeyCode::SuperRight => NamedKey::Super,
-        KeyCode::SuperLeft => NamedKey::Super,
+        KeyCode::MetaRight => NamedKey::Meta,
+        KeyCode::MetaLeft => NamedKey::Meta,
         KeyCode::ShiftLeft => NamedKey::Shift,
         KeyCode::AltLeft => NamedKey::Alt,
         KeyCode::ControlLeft => NamedKey::Control,
@@ -242,8 +242,8 @@ pub fn code_to_location(key: PhysicalKey) -> KeyLocation {
     };
 
     match code {
-        KeyCode::SuperRight => KeyLocation::Right,
-        KeyCode::SuperLeft => KeyLocation::Left,
+        KeyCode::MetaRight => KeyLocation::Right,
+        KeyCode::MetaLeft => KeyLocation::Left,
         KeyCode::ShiftLeft => KeyLocation::Left,
         KeyCode::AltLeft => KeyLocation::Left,
         KeyCode::ControlLeft => KeyLocation::Left,
@@ -326,9 +326,9 @@ pub(super) fn event_mods(event: &NSEvent) -> Modifiers {
     pressed_mods.set(ModifiersKeys::LALT, flags.contains(NX_DEVICELALTKEYMASK));
     pressed_mods.set(ModifiersKeys::RALT, flags.contains(NX_DEVICERALTKEYMASK));
 
-    state.set(ModifiersState::SUPER, flags.contains(NSEventModifierFlags::Command));
-    pressed_mods.set(ModifiersKeys::LSUPER, flags.contains(NX_DEVICELCMDKEYMASK));
-    pressed_mods.set(ModifiersKeys::RSUPER, flags.contains(NX_DEVICERCMDKEYMASK));
+    state.set(ModifiersState::META, flags.contains(NSEventModifierFlags::Command));
+    pressed_mods.set(ModifiersKeys::LMETA, flags.contains(NX_DEVICELCMDKEYMASK));
+    pressed_mods.set(ModifiersKeys::RMETA, flags.contains(NX_DEVICERCMDKEYMASK));
 
     Modifiers { state, pressed_mods }
 }
@@ -409,8 +409,8 @@ pub(crate) fn physicalkey_to_scancode(physical_key: PhysicalKey) -> Option<u32>
         KeyCode::Backquote => Some(0x32),
         KeyCode::Backspace => Some(0x33),
         KeyCode::Escape => Some(0x35),
-        KeyCode::SuperRight => Some(0x36),
-        KeyCode::SuperLeft => Some(0x37),
+        KeyCode::MetaRight => Some(0x36),
+        KeyCode::MetaLeft => Some(0x37),
         KeyCode::ShiftLeft => Some(0x38),
         KeyCode::CapsLock => Some(0x39),
         KeyCode::AltLeft => Some(0x3a),
@@ -555,8 +555,8 @@ pub(crate) fn scancode_to_physicalkey(scancode: u32) -> PhysicalKey {
         0x33 => KeyCode::Backspace,
         // 0x34 => unknown, // kVK_Powerbook_KeypadEnter
         0x35 => KeyCode::Escape,
-        0x36 => KeyCode::SuperRight,
-        0x37 => KeyCode::SuperLeft,
+        0x36 => KeyCode::MetaRight,
+        0x37 => KeyCode::MetaLeft,
         0x38 => KeyCode::ShiftLeft,
         0x39 => KeyCode::CapsLock,
         0x3a => KeyCode::AltLeft,
diff --git a/src/platform_impl/apple/appkit/view.rs b/src/platform_impl/apple/appkit/view.rs
index 9ce7c3fcf5..b836ec2ce2 100644
--- a/src/platform_impl/apple/appkit/view.rs
+++ b/src/platform_impl/apple/appkit/view.rs
@@ -81,7 +81,7 @@ fn key_to_modifier(key: &Key) -> Option<ModifiersState> {
     match key {
         Key::Named(NamedKey::Alt) => Some(ModifiersState::ALT),
         Key::Named(NamedKey::Control) => Some(ModifiersState::CONTROL),
-        Key::Named(NamedKey::Super) => Some(ModifiersState::SUPER),
+        Key::Named(NamedKey::Meta) => Some(ModifiersState::META),
         Key::Named(NamedKey::Shift) => Some(ModifiersState::SHIFT),
         _ => None,
     }
@@ -92,7 +92,7 @@ fn get_right_modifier_code(key: &Key) -> KeyCode {
         Key::Named(NamedKey::Alt) => KeyCode::AltRight,
         Key::Named(NamedKey::Control) => KeyCode::ControlRight,
         Key::Named(NamedKey::Shift) => KeyCode::ShiftRight,
-        Key::Named(NamedKey::Super) => KeyCode::SuperRight,
+        Key::Named(NamedKey::Meta) => KeyCode::MetaRight,
         _ => unreachable!(),
     }
 }
@@ -102,7 +102,7 @@ fn get_left_modifier_code(key: &Key) -> KeyCode {
         Key::Named(NamedKey::Alt) => KeyCode::AltLeft,
         Key::Named(NamedKey::Control) => KeyCode::ControlLeft,
         Key::Named(NamedKey::Shift) => KeyCode::ShiftLeft,
-        Key::Named(NamedKey::Super) => KeyCode::SuperLeft,
+        Key::Named(NamedKey::Meta) => KeyCode::MetaLeft,
         _ => unreachable!(),
     }
 }
@@ -1103,7 +1103,7 @@ fn replace_event(event: &NSEvent, option_as_alt: OptionAsAlt) -> Retained<NSEven
         OptionAsAlt::Both if ev_mods.alt_key() => true,
         _ => false,
     } && !ev_mods.control_key()
-        && !ev_mods.super_key();
+        && !ev_mods.meta_key();
 
     if ignore_alt_characters {
         let ns_chars = unsafe {
diff --git a/src/platform_impl/linux/common/xkb/keymap.rs b/src/platform_impl/linux/common/xkb/keymap.rs
index d9ac1838ef..7e80bdcf1a 100644
--- a/src/platform_impl/linux/common/xkb/keymap.rs
+++ b/src/platform_impl/linux/common/xkb/keymap.rs
@@ -166,8 +166,8 @@ pub fn scancode_to_physicalkey(scancode: u32) -> PhysicalKey {
         122 => KeyCode::Lang1,
         123 => KeyCode::Lang2,
         124 => KeyCode::IntlYen,
-        125 => KeyCode::SuperLeft,
-        126 => KeyCode::SuperRight,
+        125 => KeyCode::MetaLeft,
+        126 => KeyCode::MetaRight,
         127 => KeyCode::ContextMenu,
         128 => KeyCode::BrowserStop,
         129 => KeyCode::Again,
@@ -419,8 +419,8 @@ pub fn physicalkey_to_scancode(key: PhysicalKey) -> Option<u32> {
         KeyCode::Lang1 => Some(122),
         KeyCode::Lang2 => Some(123),
         KeyCode::IntlYen => Some(124),
-        KeyCode::SuperLeft => Some(125),
-        KeyCode::SuperRight => Some(126),
+        KeyCode::MetaLeft => Some(125),
+        KeyCode::MetaRight => Some(126),
         KeyCode::ContextMenu => Some(127),
         KeyCode::BrowserStop => Some(128),
         KeyCode::Again => Some(129),
@@ -622,16 +622,20 @@ pub fn keysym_to_key(keysym: u32) -> Key {
         keysyms::Control_R => NamedKey::Control,
         keysyms::Caps_Lock => NamedKey::CapsLock,
         // keysyms::Shift_Lock => NamedKey::ShiftLock,
-
-        // keysyms::Meta_L => NamedKey::Meta,
-        // keysyms::Meta_R => NamedKey::Meta,
         keysyms::Alt_L => NamedKey::Alt,
         keysyms::Alt_R => NamedKey::Alt,
-        keysyms::Super_L => NamedKey::Super,
-        keysyms::Super_R => NamedKey::Super,
+        #[allow(deprecated)]
         keysyms::Hyper_L => NamedKey::Hyper,
+        #[allow(deprecated)]
         keysyms::Hyper_R => NamedKey::Hyper,
 
+        // Browsers map X11's Super keys to Meta, so we do that as well.
+        keysyms::Super_L => NamedKey::Meta,
+        keysyms::Super_R => NamedKey::Meta,
+        // The actual Meta keys do not seem to be used by browsers, so we don't do that either.
+        // keysyms::Meta_L => NamedKey::Super,
+        // keysyms::Meta_R => NamedKey::Super,
+
         // XKB function and modifier keys
         // keysyms::ISO_Lock => NamedKey::IsoLock,
         // keysyms::ISO_Level2_Latch => NamedKey::IsoLevel2Latch,
@@ -724,7 +728,7 @@ pub fn keysym_to_key(keysym: u32) -> Key {
         keysyms::_3270_PrintScreen => NamedKey::PrintScreen,
         keysyms::_3270_Enter => NamedKey::Enter,
 
-        keysyms::space => NamedKey::Space,
+        keysyms::space => return Key::Character(" ".into()),
         // exclam..Sinh_kunddaliya
 
         // XFree86
diff --git a/src/platform_impl/linux/common/xkb/state.rs b/src/platform_impl/linux/common/xkb/state.rs
index 27c055aa20..31bcec8b3f 100644
--- a/src/platform_impl/linux/common/xkb/state.rs
+++ b/src/platform_impl/linux/common/xkb/state.rs
@@ -183,7 +183,7 @@ impl From<ModifiersState> for crate::keyboard::ModifiersState {
         to_mods.set(crate::keyboard::ModifiersState::SHIFT, mods.shift);
         to_mods.set(crate::keyboard::ModifiersState::CONTROL, mods.ctrl);
         to_mods.set(crate::keyboard::ModifiersState::ALT, mods.alt);
-        to_mods.set(crate::keyboard::ModifiersState::SUPER, mods.logo);
+        to_mods.set(crate::keyboard::ModifiersState::META, mods.logo);
         to_mods
     }
 }
diff --git a/src/platform_impl/orbital/event_loop.rs b/src/platform_impl/orbital/event_loop.rs
index 0eef8a8db5..4e7c9a43e6 100644
--- a/src/platform_impl/orbital/event_loop.rs
+++ b/src/platform_impl/orbital/event_loop.rs
@@ -118,8 +118,8 @@ fn convert_scancode(scancode: u8) -> (PhysicalKey, Option<NamedKey>) {
         orbclient::K_RIGHT_SHIFT => (KeyCode::ShiftRight, Some(NamedKey::Shift)),
         orbclient::K_SEMICOLON => (KeyCode::Semicolon, None),
         orbclient::K_SLASH => (KeyCode::Slash, None),
-        orbclient::K_SPACE => (KeyCode::Space, Some(NamedKey::Space)),
-        orbclient::K_SUPER => (KeyCode::SuperLeft, Some(NamedKey::Super)),
+        orbclient::K_SPACE => (KeyCode::Space, None),
+        orbclient::K_SUPER => (KeyCode::MetaLeft, Some(NamedKey::Meta)),
         orbclient::K_TAB => (KeyCode::Tab, Some(NamedKey::Tab)),
         orbclient::K_TICK => (KeyCode::Backquote, None),
         orbclient::K_UP => (KeyCode::ArrowUp, Some(NamedKey::ArrowUp)),
@@ -149,8 +149,8 @@ bitflags! {
         const RCTRL = 1 << 3;
         const LALT = 1 << 4;
         const RALT = 1 << 5;
-        const LSUPER = 1 << 6;
-        const RSUPER = 1 << 7;
+        const LMETA = 1 << 6;
+        const RMETA = 1 << 7;
     }
 }
 
@@ -200,8 +200,8 @@ impl EventState {
             KeyCode::ControlRight => self.keyboard.set(KeyboardModifierState::RCTRL, pressed),
             KeyCode::AltLeft => self.keyboard.set(KeyboardModifierState::LALT, pressed),
             KeyCode::AltRight => self.keyboard.set(KeyboardModifierState::RALT, pressed),
-            KeyCode::SuperLeft => self.keyboard.set(KeyboardModifierState::LSUPER, pressed),
-            KeyCode::SuperRight => self.keyboard.set(KeyboardModifierState::RSUPER, pressed),
+            KeyCode::MetaLeft => self.keyboard.set(KeyboardModifierState::LMETA, pressed),
+            KeyCode::MetaRight => self.keyboard.set(KeyboardModifierState::RMETA, pressed),
             _ => (),
         }
     }
@@ -259,14 +259,14 @@ impl EventState {
         pressed_mods.set(ModifiersKeys::LALT, self.keyboard.contains(KeyboardModifierState::LALT));
         pressed_mods.set(ModifiersKeys::RALT, self.keyboard.contains(KeyboardModifierState::RALT));
 
-        if self.keyboard.intersects(KeyboardModifierState::LSUPER | KeyboardModifierState::RSUPER) {
-            state |= ModifiersState::SUPER
+        if self.keyboard.intersects(KeyboardModifierState::LMETA | KeyboardModifierState::RMETA) {
+            state |= ModifiersState::META
         }
 
         pressed_mods
-            .set(ModifiersKeys::LSUPER, self.keyboard.contains(KeyboardModifierState::LSUPER));
+            .set(ModifiersKeys::LMETA, self.keyboard.contains(KeyboardModifierState::LMETA));
         pressed_mods
-            .set(ModifiersKeys::RSUPER, self.keyboard.contains(KeyboardModifierState::RSUPER));
+            .set(ModifiersKeys::RMETA, self.keyboard.contains(KeyboardModifierState::RMETA));
 
         Modifiers { state, pressed_mods }
     }
diff --git a/src/platform_impl/web/keyboard.rs b/src/platform_impl/web/keyboard.rs
index 59c16d7617..e1b0e7e6bd 100644
--- a/src/platform_impl/web/keyboard.rs
+++ b/src/platform_impl/web/keyboard.rs
@@ -18,11 +18,13 @@ impl Key {
             "Shift" => NamedKey::Shift,
             "Symbol" => NamedKey::Symbol,
             "SymbolLock" => NamedKey::SymbolLock,
+            #[allow(deprecated)]
+            "Super" => NamedKey::Super,
+            #[allow(deprecated)]
             "Hyper" => NamedKey::Hyper,
-            "Meta" => NamedKey::Super,
+            "Meta" => NamedKey::Meta,
             "Enter" => NamedKey::Enter,
             "Tab" => NamedKey::Tab,
-            " " => NamedKey::Space,
             "ArrowDown" => NamedKey::ArrowDown,
             "ArrowLeft" => NamedKey::ArrowLeft,
             "ArrowRight" => NamedKey::ArrowRight,
@@ -378,8 +380,8 @@ impl PhysicalKey {
             "ControlLeft" => KeyCode::ControlLeft,
             "ControlRight" => KeyCode::ControlRight,
             "Enter" => KeyCode::Enter,
-            "MetaLeft" => KeyCode::SuperLeft,
-            "MetaRight" => KeyCode::SuperRight,
+            "MetaLeft" => KeyCode::MetaLeft,
+            "MetaRight" => KeyCode::MetaRight,
             "ShiftLeft" => KeyCode::ShiftLeft,
             "ShiftRight" => KeyCode::ShiftRight,
             "Space" => KeyCode::Space,
@@ -462,7 +464,11 @@ impl PhysicalKey {
             "AudioVolumeMute" => KeyCode::AudioVolumeMute,
             "AudioVolumeUp" => KeyCode::AudioVolumeUp,
             "WakeUp" => KeyCode::WakeUp,
+            #[allow(deprecated)]
+            "Super" => KeyCode::Super,
+            #[allow(deprecated)]
             "Hyper" => KeyCode::Hyper,
+            #[allow(deprecated)]
             "Turbo" => KeyCode::Turbo,
             "Abort" => KeyCode::Abort,
             "Resume" => KeyCode::Resume,
diff --git a/src/platform_impl/web/web_sys/event.rs b/src/platform_impl/web/web_sys/event.rs
index ed7f03ba8a..dbecbf395e 100644
--- a/src/platform_impl/web/web_sys/event.rs
+++ b/src/platform_impl/web/web_sys/event.rs
@@ -184,7 +184,6 @@ pub fn key_text(event: &KeyboardEvent) -> Option<SmolStr> {
         Key::Character(text) => Some(text.clone()),
         Key::Named(NamedKey::Tab) => Some(SmolStr::new("\t")),
         Key::Named(NamedKey::Enter) => Some(SmolStr::new("\r")),
-        Key::Named(NamedKey::Space) => Some(SmolStr::new(" ")),
         _ => None,
     }
     .map(SmolStr::new)
@@ -216,7 +215,7 @@ pub fn keyboard_modifiers(event: &KeyboardEvent) -> ModifiersState {
         state |= ModifiersState::ALT;
     }
     if event.meta_key() {
-        state |= ModifiersState::SUPER;
+        state |= ModifiersState::META;
     }
 
     state
@@ -235,7 +234,7 @@ pub fn mouse_modifiers(event: &MouseEvent) -> ModifiersState {
         state |= ModifiersState::ALT;
     }
     if event.meta_key() {
-        state |= ModifiersState::SUPER;
+        state |= ModifiersState::META;
     }
 
     state
diff --git a/src/platform_impl/windows/keyboard.rs b/src/platform_impl/windows/keyboard.rs
index bb16d946b2..1f85088c87 100644
--- a/src/platform_impl/windows/keyboard.rs
+++ b/src/platform_impl/windows/keyboard.rs
@@ -535,7 +535,8 @@ impl PartialKeyEventInfo {
 
         let preliminary_logical_key =
             layout.get_key(mods_without_ctrl, num_lock_on, vkey, &physical_key);
-        let key_is_char = matches!(preliminary_logical_key, Key::Character(_));
+        // FIXME(madsmtm): Is the `chars != " "` check desired here?
+        let key_is_char = matches!(&preliminary_logical_key, Key::Character(chars) if chars != " ");
         let is_pressed = state == ElementState::Pressed;
 
         let logical_key = if let Some(key) = code_as_key.clone() {
@@ -975,8 +976,8 @@ pub(crate) fn physicalkey_to_scancode(physical_key: PhysicalKey) -> Option<u32>
         KeyCode::ControlLeft => Some(0x001d),
         KeyCode::ControlRight => Some(0xe01d),
         KeyCode::Enter => Some(0x001c),
-        KeyCode::SuperLeft => Some(0xe05b),
-        KeyCode::SuperRight => Some(0xe05c),
+        KeyCode::MetaLeft => Some(0xe05b),
+        KeyCode::MetaRight => Some(0xe05c),
         KeyCode::ShiftLeft => Some(0x002a),
         KeyCode::ShiftRight => Some(0x0036),
         KeyCode::Space => Some(0x0039),
@@ -1158,8 +1159,8 @@ pub(crate) fn scancode_to_physicalkey(scancode: u32) -> PhysicalKey {
         0x001d => KeyCode::ControlLeft,
         0xe01d => KeyCode::ControlRight,
         0x001c => KeyCode::Enter,
-        0xe05b => KeyCode::SuperLeft,
-        0xe05c => KeyCode::SuperRight,
+        0xe05b => KeyCode::MetaLeft,
+        0xe05c => KeyCode::MetaRight,
         0x002a => KeyCode::ShiftLeft,
         0x0036 => KeyCode::ShiftRight,
         0x0039 => KeyCode::Space,
diff --git a/src/platform_impl/windows/keyboard_layout.rs b/src/platform_impl/windows/keyboard_layout.rs
index 6c2fe114e4..1abbb09486 100644
--- a/src/platform_impl/windows/keyboard_layout.rs
+++ b/src/platform_impl/windows/keyboard_layout.rs
@@ -279,7 +279,7 @@ impl LayoutCache {
         mods.set(ModifiersState::SHIFT, key_pressed(VK_SHIFT));
         mods.set(ModifiersState::CONTROL, key_pressed(VK_CONTROL) && !filter_out_altgr);
         mods.set(ModifiersState::ALT, key_pressed(VK_MENU) && !filter_out_altgr);
-        mods.set(ModifiersState::SUPER, key_pressed(VK_LWIN) || key_pressed(VK_RWIN));
+        mods.set(ModifiersState::META, key_pressed(VK_LWIN) || key_pressed(VK_RWIN));
         mods
     }
 
@@ -584,8 +584,8 @@ fn keycode_to_vkey(keycode: KeyCode, hkl: u64) -> VIRTUAL_KEY {
         KeyCode::ControlLeft => VK_LCONTROL,
         KeyCode::ControlRight => VK_RCONTROL,
         KeyCode::Enter => VK_RETURN,
-        KeyCode::SuperLeft => VK_LWIN,
-        KeyCode::SuperRight => VK_RWIN,
+        KeyCode::MetaLeft => VK_LWIN,
+        KeyCode::MetaRight => VK_RWIN,
         KeyCode::ShiftLeft => VK_RSHIFT,
         KeyCode::ShiftRight => VK_LSHIFT,
         KeyCode::Space => VK_SPACE,
@@ -670,7 +670,9 @@ fn keycode_to_vkey(keycode: KeyCode, hkl: u64) -> VIRTUAL_KEY {
         KeyCode::AudioVolumeMute => VK_VOLUME_MUTE,
         KeyCode::AudioVolumeUp => VK_VOLUME_UP,
         KeyCode::WakeUp => 0,
+        #[allow(deprecated)]
         KeyCode::Hyper => 0,
+        #[allow(deprecated)]
         KeyCode::Turbo => 0,
         KeyCode::Abort => 0,
         KeyCode::Resume => 0,
@@ -787,7 +789,7 @@ fn vkey_to_non_char_key(
         VK_NONCONVERT => Key::Named(NamedKey::NonConvert),
         VK_ACCEPT => Key::Named(NamedKey::Accept),
         VK_MODECHANGE => Key::Named(NamedKey::ModeChange),
-        VK_SPACE => Key::Named(NamedKey::Space),
+        VK_SPACE => Key::Character(" ".into()),
         VK_PRIOR => Key::Named(NamedKey::PageUp),
         VK_NEXT => Key::Named(NamedKey::PageDown),
         VK_END => Key::Named(NamedKey::End),
@@ -803,8 +805,8 @@ fn vkey_to_non_char_key(
         VK_INSERT => Key::Named(NamedKey::Insert),
         VK_DELETE => Key::Named(NamedKey::Delete),
         VK_HELP => Key::Named(NamedKey::Help),
-        VK_LWIN => Key::Named(NamedKey::Super),
-        VK_RWIN => Key::Named(NamedKey::Super),
+        VK_LWIN => Key::Named(NamedKey::Meta),
+        VK_RWIN => Key::Named(NamedKey::Meta),
         VK_APPS => Key::Named(NamedKey::ContextMenu),
         VK_SLEEP => Key::Named(NamedKey::Standby),
 


Reviews:
user: login: ArturKovacs
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-12-02T13:11:42Z
user: login: kchibisov
body: Super is the label you likely see on the keyboard. Meta is often an `Alt` on `Linux` and I don't think I've seen anyone referring to meta as `super`, so I don't see a point in renaming at this point.

One could add an alias(somehow), but I don't like to change its name at this point, especially users will likely not have a clue what it is.
state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2024-12-02T13:57:06Z
user: login: nicoburns
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2024-12-02T22:10:10Z
user: login: kchibisov
state: COMMENTED
author_association: MEMBER
submitted_at: 2024-12-02T22:18:48Z
user: login: kchibisov
state: DISMISSED
author_association: MEMBER
submitted_at: 2025-03-10T15:30:26Z
user: login: madsmtm
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-10T16:09:03Z
user: login: madsmtm
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-10T16:09:40Z
user: login: madsmtm
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-23T11:33:56Z

Review comments:
diff_hunk: @@ -791,24 +782,20 @@ pub enum NamedKey {
     /// The Symbol modifier key (used on some virtual keyboards).
     Symbol,
     SymbolLock,
-    // Legacy modifier key. Also called "Super" in certain places.
-    Meta,
+    // Legacy modifier key.
+    Super,
     // Legacy modifier key.
     Hyper,
-    /// Used to enable "super" modifier function for interpreting concurrent or subsequent keyboard
+    /// Used to enable "meta" modifier function for interpreting concurrent or subsequent keyboard
     /// input. This key value is used for the "Windows Logo" key and the Apple `Command` or `⌘`
     /// key.
-    ///
-    /// Note: In some contexts (e.g. the Web) this is referred to as the "Meta" key.
-    Super,
+    Meta,
path: src/keyboard.rs
user: login: ArturKovacs
body: I suggest adding that this is referred to as `Super` in some contexts. Having this in the documentation makes it easier to search.
created_at: 2024-12-02T13:10:16Z
author_association: CONTRIBUTOR
diff_hunk: @@ -791,24 +782,20 @@ pub enum NamedKey {
     /// The Symbol modifier key (used on some virtual keyboards).
     Symbol,
     SymbolLock,
-    // Legacy modifier key. Also called "Super" in certain places.
-    Meta,
+    // Legacy modifier key.
+    Super,
     // Legacy modifier key.
     Hyper,
-    /// Used to enable "super" modifier function for interpreting concurrent or subsequent keyboard
+    /// Used to enable "meta" modifier function for interpreting concurrent or subsequent keyboard
     /// input. This key value is used for the "Windows Logo" key and the Apple `Command` or `⌘`
     /// key.
-    ///
-    /// Note: In some contexts (e.g. the Web) this is referred to as the "Meta" key.
-    Super,
+    Meta,
path: src/keyboard.rs
user: login: nicoburns
body: We could add a doc alias of "super" so that people searching the docs for super will find it?

https://doc.rust-lang.org/rustdoc/advanced-features.html#add-aliases-for-an-item-in-documentation-search
created_at: 2024-12-02T22:10:10Z
author_association: CONTRIBUTOR
diff_hunk: @@ -791,24 +782,20 @@ pub enum NamedKey {
     /// The Symbol modifier key (used on some virtual keyboards).
     Symbol,
     SymbolLock,
-    // Legacy modifier key. Also called "Super" in certain places.
-    Meta,
+    // Legacy modifier key.
+    Super,
     // Legacy modifier key.
     Hyper,
-    /// Used to enable "super" modifier function for interpreting concurrent or subsequent keyboard
+    /// Used to enable "meta" modifier function for interpreting concurrent or subsequent keyboard
     /// input. This key value is used for the "Windows Logo" key and the Apple `Command` or `⌘`
     /// key.
-    ///
-    /// Note: In some contexts (e.g. the Web) this is referred to as the "Meta" key.
-    Super,
+    Meta,
path: src/keyboard.rs
user: login: kchibisov
body: Maybe alias it the other way (meta to super) around to not break things in the first place? Especially given that meta means so many different things on platforms and to get it wrong will be very easy.


created_at: 2024-12-02T22:18:48Z
author_association: MEMBER
diff_hunk: @@ -191,6 +191,8 @@ changelog entry.
 - Removed `KeyEventExtModifierSupplement`, and made the fields `text_with_all_modifiers` and
   `key_without_modifiers` public on `KeyEvent` instead.
 - Move `window::Fullscreen` to `monitor::Fullscreen`.
+- Renamed "super" key to "meta", to match the naming in the W3C specification. The `Super` key is
+  still kept, but deprecated, and only `Meta` will be emitted.
path: src/changelog/unreleased.md
user: login: kchibisov
body: This is wrong, the old key is not what it was. Users must change. The deprecated warning should also explicitly say so.
created_at: 2025-03-10T15:23:13Z
author_association: MEMBER
diff_hunk: @@ -1709,7 +1700,7 @@ bitflags! {
         /// The "alt" key.
         const ALT = 0b100 << 6;
         /// This is the "windows" key on PC and "command" key on Mac.
-        const SUPER = 0b100 << 9;
+        const META = 0b100 << 9;
path: src/keyboard.rs
user: login: kchibisov
body: This breaks user configs all along, because a change in serialization format. If someone relied on winit here they are kind of screwed. 
created_at: 2025-03-10T15:24:31Z
author_association: MEMBER
diff_hunk: @@ -1764,7 +1755,7 @@ bitflags! {
         const RCONTROL = 0b0000_1000;
         const LALT     = 0b0001_0000;
         const RALT     = 0b0010_0000;
-        const LSUPER   = 0b0100_0000;
-        const RSUPER   = 0b1000_0000;
+        const LMETA    = 0b0100_0000;
path: src/keyboard.rs
user: login: kchibisov
body: as well.
created_at: 2025-03-10T15:28:12Z
author_association: MEMBER
diff_hunk: @@ -191,6 +191,8 @@ changelog entry.
 - Removed `KeyEventExtModifierSupplement`, and made the fields `text_with_all_modifiers` and
   `key_without_modifiers` public on `KeyEvent` instead.
 - Move `window::Fullscreen` to `monitor::Fullscreen`.
+- Renamed "super" key to "meta", to match the naming in the W3C specification. The `Super` key is
+  still kept, but deprecated, and only `Meta` will be emitted.
path: src/changelog/unreleased.md
user: login: madsmtm
body: Updated the text in both places.
created_at: 2025-03-10T16:09:03Z
author_association: MEMBER
diff_hunk: @@ -1709,7 +1700,7 @@ bitflags! {
         /// The "alt" key.
         const ALT = 0b100 << 6;
         /// This is the "windows" key on PC and "command" key on Mac.
-        const SUPER = 0b100 << 9;
+        const META = 0b100 << 9;
path: src/keyboard.rs
user: login: madsmtm
body: I kept the `const SUPER` around as a deprecated alias, that should make the `serde` impl accept `SUPER` as well.
created_at: 2025-03-10T16:09:40Z
author_association: MEMBER
diff_hunk: @@ -791,24 +782,20 @@ pub enum NamedKey {
     /// The Symbol modifier key (used on some virtual keyboards).
     Symbol,
     SymbolLock,
-    // Legacy modifier key. Also called "Super" in certain places.
-    Meta,
+    // Legacy modifier key.
+    Super,
     // Legacy modifier key.
     Hyper,
-    /// Used to enable "super" modifier function for interpreting concurrent or subsequent keyboard
+    /// Used to enable "meta" modifier function for interpreting concurrent or subsequent keyboard
     /// input. This key value is used for the "Windows Logo" key and the Apple `Command` or `⌘`
     /// key.
-    ///
-    /// Note: In some contexts (e.g. the Web) this is referred to as the "Meta" key.
-    Super,
+    Meta,
path: src/keyboard.rs
user: login: madsmtm
body: Opened https://github.com/pyfisch/keyboard-types/pull/68 and https://github.com/pyfisch/keyboard-types/issues/64 for the suggestions in here.
created_at: 2025-03-23T11:33:56Z
author_association: MEMBER

PR comments:
user: login: maroider
created_at: 2024-12-01T15:48:16Z
body: > These differences from the W3C specifications were introduced in #2662, though I can't find any discussion about it other than in #2662 (comment). It seems like it was left mostly as an unresolved question?

I recall there being more of a discussion about it, but I don't recall where. I'll have a look when i have time. 
author_association: MEMBER
user: login: madsmtm
created_at: 2024-12-01T20:48:21Z
body: I found https://github.com/rust-windowing/winit/pull/1788, searching for "super" and "meta" with all items in that thread expanded reveals https://github.com/rust-windowing/winit/pull/1788#discussion_r554570265.

While I can see the arguments in there (the "alt" key was commonly called "meta"), I don't think they really holds for our use-case (we have a distinct "alt" keys, so there should be no confusion). Regardless of my desire to use `keyboard-types`, I think this concern is overshadowed by the value in having the same terminology as the web standard, and in emitting the same keyboard events as browsers do.

CC @chrisduerr
author_association: MEMBER
user: login: madsmtm
created_at: 2024-12-01T20:53:05Z
body: Also, I found https://github.com/rust-windowing/winit/pull/1788#issuecomment-773116890 regarding `NamedKey::Space`. Responding to that:

> I introduced `Space` as a variant to the `Key` enum. In the [UI Events Spec](https://w3c.github.io/uievents-key/#keys-whitespace) this is instead indicated by the normal space character `' '`. To me it seems odd to have a `Tab` variant but not have a `Space` variant; it feels out of place to use a `Character` for representing the space key, especially because `logical_key` is not intended for text input.

One argument for why these are different might be that space is a normal, printable character, while tab is a control character? Though that's mostly post-rationalization on my part.
author_association: MEMBER
user: login: chrisduerr
created_at: 2024-12-01T22:27:17Z
body: > While I can see the arguments in there (the "alt" key was commonly called "meta"), I don't think they really holds for our use-case (we have a distinct "alt" keys, so there should be no confusion). Regardless of my desire to use keyboard-types, I think this concern is overshadowed by the value in having the same terminology as the web standard, and in emitting the same keyboard events as browser do.

The meta key can be one of many keys. Especially for Linux users this **very** frequently refers to the alt key. I see no reason why there would be a requirement to align with the web standard over other platform's standards and if all are considered equal then the most logical solution should be chosen. I have little doubt that super is least likely to cause any confusion compared to alternatives like "meta" or "hyper", which are just historically highly inaccurate.
author_association: CONTRIBUTOR
user: login: madsmtm
created_at: 2024-12-02T12:34:08Z
body: > The meta key can be one of many keys. Especially for Linux users this **very** frequently refers to the alt key. [...] I have little doubt that super is least likely to cause any confusion compared to alternatives like "meta" or "hyper", which are just historically highly inaccurate.

Hmm, I read the [Wikipedia](https://en.wikipedia.org/wiki/Meta_key) [articles](https://en.wikipedia.org/wiki/Super_key_\(keyboard_button\)) on these, and I can see that "super" is superior (hehe) in the sense that it's likely what you will want to show the user in your documentation - but you will want to do special handling here anyhow, e.g. neither "meta" nor "super" is a nice name to show the user on macOS.

Looking more widely:
- The web uses "meta", e.g. [`metaKey`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey)
- Qt seems to use "meta", e.g. [`Qt::MetaModifier`](https://doc.qt.io/qt-6/qt.html#KeyboardModifier-enum), though they seem to muck around with things a lot, e.g. "ctrl" is swapped with "meta" on macOS, and they do also expose `Qt::Key_Super_[LR]`.
- GTK have both "super" and "meta", not sure which they prefer, but they do map macOS' <kbd>Command</kbd> to "meta", see [`Gdk.ModifierType`](https://docs.gtk.org/gdk4/flags.ModifierType.html).
- The Linux Kernel uses "meta" in [`input-event-codes.h`](https://github.com/torvalds/linux/blob/e70140ba0d2b1a30467d4af6bcfe761327b9ec95/include/uapi/linux/input-event-codes.h#L202-L203).
- X11 uses "super", e.g. it maps the above to `XK_Super_[LR]`.
- Android uses "meta", e.g. [`AKEYCODE_META_LEFT`](https://developer.android.com/ndk/reference/group/input).
- macOS and Windows use their own naming ("command" and "win").
- XKB [recommends "meta"](https://www.x.org/releases/current/doc/libX11/XKB/xkblib.html#Conventions).

I _guess_ we could choose to emit `NamedKey::Meta` on most platforms, but `NamedKey::Super` on Linux when we get `keysyms::Super_L`, though that would be inconsistent with what browsers do on Linux, so I'd prefer to avoid that.

> I see no reason why there would be a requirement to align with the web standard over other platform's standards and if all are considered equal then the most logical solution should be chosen.

I think my core argument is that all are _not_ considered equal, and that the web standard, however flawed, makes sense to align to, for the simple reason that it's a tried and tested way to make cross-platform applications.
author_association: MEMBER
user: login: ArturKovacs
created_at: 2024-12-02T13:09:10Z
body: I still don't feel strongly about renaming Super to Meta. What @chrisduerr said made sense at that time, but with that said, I don't mind if this rename happens. In fact here's an argument for renaming: I remember it being clumsy trying to avoid calling functions and variables `super`. Unfortunately it must be avoided as `super` is a keyword in Rust.

Regarding the question about `Space`, I feel similarly. If there's a decision to change it, that's okay with me, with the caveat that it should be clearly documented that the space key is represented as `Character(" ")`
author_association: CONTRIBUTOR
user: login: madsmtm
created_at: 2024-12-02T14:19:39Z
body: > Super is the label you likely see on the keyboard.

Possibly, though not on keyboards manufactured with macOS and/or Windows in mind, so I don't think we _need_ to use the same label in source code.

> Meta is often an `Alt` on `Linux` and I don't think I've seen anyone referring to meta as `super`, so I don't see a point in renaming at this point.

I feel like I outlined a lot of cases in https://github.com/rust-windowing/winit/pull/4018#issuecomment-2511422037 where people are referring to the key as "meta"?

---

In any case, my issue is not really the naming (I superficially agree that "super" is the better name), but that we diverge from the web specification which we otherwise try to follow.

My main motivation here is because aligning with the web standard is needed to do https://github.com/rust-windowing/winit/pull/4026. If y'all have other suggestions for how to integrate `keyboard-types` without doing this change in Winit, then I'm all ears?
author_association: MEMBER
user: login: chrisduerr
created_at: 2024-12-02T20:51:18Z
body: > What @chrisduerr said made sense at that time, but with that said, I don't mind if this rename happens.

I think every breaking change should be minded. There's already many people complaining that winit breaks things too much.
author_association: CONTRIBUTOR
user: login: madsmtm
created_at: 2024-12-02T21:26:24Z
body: > I think every breaking change should be minded. There's already many people complaining that winit breaks things too much.

Fair point! Would it help if we kept `ModifiersState::SUPER` as a deprecated alias of `ModifiersState::META`?

We can't really do something similar with `NamedKey::Super` though, since both that and `NamedKey::Meta` exist (it's the semantics that change).
author_association: MEMBER
user: login: chrisduerr
created_at: 2024-12-02T21:29:12Z
body: > Would it help if we kept ModifiersState::SUPER as a deprecated alias of ModifiersState::META?

Steps can be taken to make the impact of breaking changes minimal or avoid a breaking change entirely. Of course this makes sense whenever possible.

However any breaking change, no matter how small, will be a strain on library consumers. The only way to avoid that is to not break things unless absolutely necessary.
author_association: CONTRIBUTOR
user: login: kchibisov
created_at: 2024-12-02T21:31:04Z
body: I personally don't think that we should change it at this point, like we had it as `LOGO` now it's `SUPER` and changing to `META` makes it even more confusing.

I'm also not entirely sure if raw keyboard-types should be used transparently and not wrapped by us and e.g. provide a conversion for it under feature or something (especially given that winit-core will be very light).
author_association: MEMBER
user: login: madsmtm
created_at: 2024-12-02T21:46:46Z
body: > I'm also not entirely sure if raw keyboard-types should be used transparently and not wrapped by us and e.g. provide a conversion for it under feature or something

Yeah, I recognize that's an option, but it's just so... Unsatisfying! Especially given that the types (`winit::keyboard::KeyCode` and `keyboard_types::Code`) are literally just `enum`s, and meant to be derived from the same spec...

I've nominated the issue, let's discuss it next meeting, whenever that happens.
author_association: MEMBER
user: login: ArturKovacs
created_at: 2024-12-03T07:48:37Z
body: I think that it's a big issue is that `keyboard_types` has a `Super` variant, which means something different from our current `Super`. But I also agree that `winit` should support `keyboard_types`.

Here's a suggestion for completely avoiding breaking changes: Introduce a new key event called `KeyEvent2` or `KeyboardEvent`. This new event would be almost entirely identical to the original `KeyEvent` except, it would use the `keyboard_types` crate. Adding a deprecated attribute to the original `KeyEvent` could be done, but at that point it could just be left as-is, always kept backward compatible.
author_association: CONTRIBUTOR
user: login: fredizzimo
created_at: 2024-12-31T11:33:49Z
body: In Neovide we rely on `NamedKey::Space`, here https://github.com/neovide/neovide/blob/5395e029455aca1bb83c3b1050f582f093014ff0/src/window/keyboard_manager.rs#L301-L309

It might not be needed if `C-Space` is fixed, but it's currently "broken" on at least Windows and reports the following event
```
KeyEvent {
    physical_key: Code(
        Space,
    ),
    logical_key: Named(
        Space,
    ),
    text: None,
    location: Standard,
    state: Pressed,
    repeat: false,
    platform_specific: KeyEventExtra {
        text_with_all_modifers: None,
        key_without_modifiers: Named(
            Space,
        ),
    },
}
```
Notice, that no text is given, and I'm not sure if there should be, so it could also be considered works as intended.

author_association: NONE
user: login: madsmtm
created_at: 2025-01-01T16:05:39Z
body: > `C-Space`

Do you mean <kbd>Ctrl+Space</kbd>?

> Notice, that no text is given, and I'm not sure if there should be, so it could also be considered works as intended.

Hmm, I think that this PR might incidentally change that? Though I'm not entirely sure, I'd suggest you open a new issue.
author_association: MEMBER
user: login: fredizzimo
created_at: 2025-01-01T16:31:14Z
body: > Do you mean Ctrl+Space?

Yes `Ctrl+Space`

> Hmm, I think that this PR might incidentally change that? Though I'm not entirely sure, I'd suggest you open a new issue.

I'm not sure what's expected actually, I think the current behaviour is actually fine.  On Windows you can actually have a keymap that produces characters combined with CTRL, see https://github.com/rust-windowing/winit/pull/3696#issuecomment-2153398480. And on macOS combining Option with space should actually produce non-breaking spaces https://github.com/rust-windowing/winit/issues/4059.
author_association: NONE
user: login: madsmtm
created_at: 2025-03-07T16:29:53Z
body: Notes from meeting:
- The name "meta" isn't nice, conflicts with naming on Linux
- Following a standard is nice
- Common crate is good for Rust ecosystem
- The breaking change is confusing
  - Can be alleviated by making `Super` deprecated (done in `keyboard-types` [here](https://github.com/pyfisch/keyboard-types/pull/49), should be done in this PR too EDIT: Done).

author_association: MEMBER
user: login: madsmtm
created_at: 2025-03-10T13:42:07Z
body: I believe the major concern here ("meta" is confusing) is mostly resolved by marking "super" deprecated (thus forcing users to think about using "meta" instead).

Additionally, I've added a check to keep the current behaviour with CTRL+Space on Windows, to resolve the concern in https://github.com/rust-windowing/winit/pull/4018#issuecomment-2566371680. If something else is desired here, that can be implemented in another PR.

As such, I am going to merge this in a week or two, unless other concerns are raised, as I strongly believe the upsides to this change (and https://github.com/rust-windowing/winit/pull/4026) outweigh the downsides.
author_association: MEMBER
user: login: PoignardAzur
created_at: 2025-03-21T16:32:55Z
body: Add me and Nico Burns to the list of people who hope this gets through. Right now in Blitz (and soon in Masonry) we have to use [some custom code](https://github.com/DioxusLabs/blitz/blob/000662a94e8e0c277aa966dc635482ee754eb345/packages/blitz-shell/src/convert_events.rs) to convert between Winit events and keyboard_type events. It would be nice to be able to just use the one type.
author_association: NONE
user: login: madsmtm
created_at: 2025-03-23T11:49:29Z
body: Roughly two weeks have passed, so I'll merge this now, thanks for the input all of you!

If you spot additional oversights, feel free to comment here (or open an issue), then I'll open a new PR fixing those.
author_association: MEMBER