diff --git a/dash-frontend/src/frontend.rs b/dash-frontend/src/frontend.rs index 7a3fd543..d35a169a 100644 --- a/dash-frontend/src/frontend.rs +++ b/dash-frontend/src/frontend.rs @@ -31,8 +31,8 @@ use wlx_common::{ use crate::{ assets, tab::{ - apps::TabApps, donate::TabDonate, games::TabGames, home::TabHome, monado::TabMonado, settings::TabSettings, - welcome::TabWelcome, Tab, TabType, + Tab, TabType, apps::TabApps, donate::TabDonate, games::TabGames, home::TabHome, monado::TabMonado, + settings::TabSettings, welcome::TabWelcome, }, util::{ popup_manager::{MountPopupOnceParams, PopupManager, PopupManagerParams}, diff --git a/dash-frontend/src/tab/settings/mod.rs b/dash-frontend/src/tab/settings/mod.rs index a88b5bd8..ae201f19 100644 --- a/dash-frontend/src/tab/settings/mod.rs +++ b/dash-frontend/src/tab/settings/mod.rs @@ -23,7 +23,7 @@ use wgui::{ use wlx_common::{ config::GeneralConfig, config_io::ConfigRoot, - dash_interface::{ConfigChangeKind, InterfaceFeats, DashPlayspaceTask}, + dash_interface::{ConfigChangeKind, DashPlayspaceTask, InterfaceFeats}, }; use crate::{ diff --git a/wayvr/src/overlays/keyboard/layout.rs b/wayvr/src/overlays/keyboard/layout.rs index 2af0590f..204a753c 100644 --- a/wayvr/src/overlays/keyboard/layout.rs +++ b/wayvr/src/overlays/keyboard/layout.rs @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize}; use crate::{ config::{ConfigType, load_known_yaml}, subsystem::hid::{ - KEYS_TO_MODS, KeyType, META, NUM_LOCK, SHIFT, VirtualKey, XkbKeymap, get_key_type, + ALTGR, KEYS_TO_MODS, KeyType, NUM_LOCK, SHIFT, VirtualKey, XkbKeymap, get_key_type, }, }; @@ -83,7 +83,7 @@ impl Layout { label.push(label1); if has_altgr { cap_type = KeyCapType::LetterAltGr; - label.push(keymap.label_for_key(vk, META)); + label.push(keymap.label_for_key(vk, ALTGR)); } else { cap_type = KeyCapType::Letter; } @@ -91,7 +91,7 @@ impl Layout { label.push(label0); label.push(label1); if has_altgr { - label.push(keymap.label_for_key(vk, META)); + label.push(keymap.label_for_key(vk, ALTGR)); cap_type = KeyCapType::SymbolAltGr; } else { cap_type = KeyCapType::Symbol; diff --git a/wayvr/src/overlays/keyboard/mod.rs b/wayvr/src/overlays/keyboard/mod.rs index 709c1c85..c64080e9 100644 --- a/wayvr/src/overlays/keyboard/mod.rs +++ b/wayvr/src/overlays/keyboard/mod.rs @@ -17,7 +17,7 @@ use crate::{ subsystem::{ dbus::DbusConnector, hid::{ - ALT, CTRL, KeyModifier, META, SHIFT, SUPER, VirtualKey, WheelDelta, XkbKeymap, + ALT, ALTGR, CTRL, KeyModifier, SHIFT, SUPER, VirtualKey, WheelDelta, XkbKeymap, get_keymap_wl, get_keymap_x11, }, }, @@ -46,7 +46,7 @@ pub mod builder; mod layout; pub const KEYBOARD_NAME: &str = "kbd"; -const AUTO_RELEASE_MODS: [KeyModifier; 5] = [SHIFT, CTRL, ALT, SUPER, META]; +const AUTO_RELEASE_MODS: [KeyModifier; 5] = [SHIFT, CTRL, ALT, SUPER, ALTGR]; const SYSTEM_LAYOUT_ALIASES: [&str; 5] = ["mozc", "pinyin", "hangul", "sayura", "unikey"]; pub fn create_keyboard(app: &mut AppState, wayland: bool) -> anyhow::Result { @@ -127,7 +127,7 @@ const fn alt_modifier_to_key(m: AltModifier) -> KeyModifier { AltModifier::Ctrl => CTRL, AltModifier::Alt => ALT, AltModifier::Super => SUPER, - AltModifier::Meta => META, + AltModifier::AltGr => ALTGR, _ => 0, } } diff --git a/wayvr/src/res/keyboard.yaml b/wayvr/src/res/keyboard.yaml index 9847f010..14e6de25 100644 --- a/wayvr/src/res/keyboard.yaml +++ b/wayvr/src/res/keyboard.yaml @@ -26,9 +26,9 @@ key_sizes: - [1.25, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2.75, 1.5, 1, 1.5, 1, 1, 1, 1] - [1.25, 1.25, 1.25, 6.25, 1.25, 1.25, 1.25, 1.25, 0.5, 1, 1, 1, 0.5, 2, 1, 1] -# The main (blue) layout of the keyboard. +# The layout of the keyboard. # Accepted are: -# - virtual keys. For a full list, look at enum VirtualKey in https://github.com/galister/wlx-overlay-s/blob/main/src/hid.rs +# - virtual keys. For a full list, see https://github.com/wayvr-org/wayvr/blob/786660a4d54b73714399c9433a68c8cc35eb55f4/wayvr/src/subsystem/hid/mod.rs#L79 # - exec_commands (defined below) # - macros (defined below) # - ~ (null) will leave an empty space with the corresponding size from key_sizes @@ -38,19 +38,19 @@ main_layout: - ["Tab", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "Oem4", "Oem6", "Oem5", ~, "Delete", "End", "Next", ~, "KP_7", "KP_8", "KP_9", "KP_Add"] - ["XF86Favorites", "A", "S", "D", "F", "G", "H", "J", "K", "L", "Oem1", "Oem7", "Return", ~, "KP_4", "KP_5", "KP_6", ~] - ["LShift", "Oem102", "Z", "X", "C", "V", "B", "N", "M", "Comma", "Period", "Oem2", "RShift", ~, "Up", ~, "KP_1", "KP_2", "KP_3", "KP_Enter"] - - ["LCtrl", "LSuper", "LAlt", "Space", "Meta", "RSuper", "Menu", "RCtrl", ~, "Left", "Down", "Right", ~, "KP_0", "KP_Decimal", "MAP"] + - ["LCtrl", "LSuper", "LAlt", "Space", "AltGr", "RSuper", "Menu", "RCtrl", ~, "Left", "Down", "Right", ~, "KP_0", "KP_Decimal", "MAP"] # Shell commands to be used in a layout. # Value is an array of string arguments. exec_commands: STT: [ "whisper_stt", "--lang", "en" ] + MAP: [ "killall", "-USR1", "wayvr"] # reloads keymap # Series of keypresses to be used in a layout. # Format: keyName [DOWN|UP] # keyName must be a valid virtual key from the VirtualKey enum (see above) # DOWN|UP: can be omitted for an implicit "keyName DOWN, keyName UP" macros: - MAP: [ "killall", "-USR1", "wayvr"] # reloads keymap KILL: [ "LSuper DOWN", "LCtrl DOWN", "Escape", "LCtrl UP", "LSuper UP" ] COPY: [ "LCtrl DOWN", "C", "LCtrl UP" ] PASTE: [ "LCtrl DOWN", "V", "LCtrl UP" ] diff --git a/wayvr/src/subsystem/hid/mod.rs b/wayvr/src/subsystem/hid/mod.rs index 7ebcbaeb..30f9312d 100644 --- a/wayvr/src/subsystem/hid/mod.rs +++ b/wayvr/src/subsystem/hid/mod.rs @@ -71,7 +71,7 @@ pub const CTRL: KeyModifier = 0x04; pub const ALT: KeyModifier = 0x08; pub const NUM_LOCK: KeyModifier = 0x10; pub const SUPER: KeyModifier = 0x40; -pub const META: KeyModifier = 0x80; +pub const ALTGR: KeyModifier = 0x80; #[allow(non_camel_case_types)] #[repr(u16)] @@ -173,7 +173,8 @@ pub enum VirtualKey { RCtrl, KP_Divide, Print, - Meta, // Right Alt aka AltGr + #[strum(serialize = "AltGr", serialize = "Meta")] + AltGr, Home = 110, Up, Prior, @@ -242,7 +243,7 @@ pub static KEYS_TO_MODS: LazyLock> = LazyLock::ne VirtualKey::NumLock => NUM_LOCK, VirtualKey::LSuper => SUPER, VirtualKey::RSuper => SUPER, - VirtualKey::Meta => META, + VirtualKey::AltGr => ALTGR, } }); @@ -254,7 +255,7 @@ pub static MODS_TO_KEYS: LazyLock>> = LazyLoc ALT => vec![VirtualKey::LAlt], NUM_LOCK => vec![VirtualKey::NumLock], SUPER => vec![VirtualKey::LSuper, VirtualKey::RSuper], - META => vec![VirtualKey::Meta], + ALTGR => vec![VirtualKey::AltGr], } }); @@ -353,7 +354,7 @@ impl XkbKeymap { let state0 = xkb::State::new(&self.inner); let mut state1 = xkb::State::new(&self.inner); state1.update_key( - xkb::Keycode::from(VirtualKey::Meta as u32), + xkb::Keycode::from(VirtualKey::AltGr as u32), xkb::KeyDirection::Down, ); diff --git a/wlx-common/src/config.rs b/wlx-common/src/config.rs index 289ba055..a34cce8d 100644 --- a/wlx-common/src/config.rs +++ b/wlx-common/src/config.rs @@ -71,7 +71,8 @@ pub enum AltModifier { Ctrl, Alt, Super, - Meta, + #[serde(alias = "Meta")] + AltGr, } #[derive(Debug, Default, Clone, Copy, Serialize, Deserialize, AsRefStr, EnumString, EnumProperty, VariantArray)]