mirror of
https://github.com/k0kubun/xremap
synced 2024-11-02 03:40:25 +00:00
parent
bdf3af41f8
commit
2c4e3574e3
@ -32,7 +32,7 @@ where
|
|||||||
|
|
||||||
// Expand ModifierState::Either to Left and Right. Not leaving Either to save some space and computation.
|
// Expand ModifierState::Either to Left and Right. Not leaving Either to save some space and computation.
|
||||||
// Note that we currently don't have `Both`. Does anybody need it?
|
// Note that we currently don't have `Both`. Does anybody need it?
|
||||||
fn expand_modifiers(key_press: KeyPress) -> Vec<KeyPress> {
|
pub fn expand_modifiers(key_press: KeyPress) -> Vec<KeyPress> {
|
||||||
if key_press.shift == ModifierState::Either {
|
if key_press.shift == ModifierState::Either {
|
||||||
expand_modifier(key_press, &Modifier::Shift)
|
expand_modifier(key_press, &Modifier::Shift)
|
||||||
} else if key_press.control == ModifierState::Either {
|
} else if key_press.control == ModifierState::Either {
|
||||||
|
@ -3,7 +3,7 @@ pub mod application;
|
|||||||
mod key;
|
mod key;
|
||||||
pub mod key_action;
|
pub mod key_action;
|
||||||
pub mod key_press;
|
pub mod key_press;
|
||||||
mod keymap;
|
pub mod keymap;
|
||||||
mod modmap;
|
mod modmap;
|
||||||
|
|
||||||
mod remap;
|
mod remap;
|
||||||
|
@ -3,6 +3,7 @@ use crate::config::action::Action;
|
|||||||
use crate::config::application::Application;
|
use crate::config::application::Application;
|
||||||
use crate::config::key_action::KeyAction;
|
use crate::config::key_action::KeyAction;
|
||||||
use crate::config::key_press::{KeyPress, Modifier, ModifierState};
|
use crate::config::key_press::{KeyPress, Modifier, ModifierState};
|
||||||
|
use crate::config::keymap::expand_modifiers;
|
||||||
use crate::Config;
|
use crate::Config;
|
||||||
use evdev::uinput::VirtualDevice;
|
use evdev::uinput::VirtualDevice;
|
||||||
use evdev::{EventType, InputEvent, Key};
|
use evdev::{EventType, InputEvent, Key};
|
||||||
@ -217,7 +218,9 @@ impl EventHandler {
|
|||||||
Action::Remap(action) => {
|
Action::Remap(action) => {
|
||||||
let mut override_remap: HashMap<KeyPress, Vec<Action>> = HashMap::new();
|
let mut override_remap: HashMap<KeyPress, Vec<Action>> = HashMap::new();
|
||||||
for (key_press, actions) in action.remap.iter() {
|
for (key_press, actions) in action.remap.iter() {
|
||||||
override_remap.insert(key_press.clone(), actions.to_vec());
|
for key_press in expand_modifiers(key_press.clone()) {
|
||||||
|
override_remap.insert(key_press, actions.to_vec());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.override_remap = Some(override_remap);
|
self.override_remap = Some(override_remap);
|
||||||
if let Some(timeout) = action.timeout {
|
if let Some(timeout) = action.timeout {
|
||||||
|
Loading…
Reference in New Issue
Block a user