meta → altgr

This commit is contained in:
galister 2026-07-20 16:34:12 +09:00
parent e1879ca891
commit 4652f708b0
7 changed files with 21 additions and 19 deletions

View File

@ -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},

View File

@ -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::{

View File

@ -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;

View File

@ -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<OverlayWindowConfig> {
@ -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,
}
}

View File

@ -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" ]

View File

@ -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<IdMap<VirtualKey, KeyModifier>> = 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<IdMap<KeyModifier, Vec<VirtualKey>>> = 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,
);

View File

@ -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)]