a hashmap from evdev:Key to config::Modifiers

main
EdenQwQ 2 years ago
parent ed00571241
commit 902a2b545f

@ -2,8 +2,8 @@ use clap::{arg, App};
use evdev::{AttributeSet, Device, Key}; use evdev::{AttributeSet, Device, Key};
use nix::unistd::{Group, Uid}; use nix::unistd::{Group, Uid};
use std::{ use std::{
env, io::prelude::*, os::unix::net::UnixStream, path::Path, process::exit, thread::sleep, collections::HashMap, env, io::prelude::*, os::unix::net::UnixStream, path::Path,
time::Duration, process::exit, thread::sleep, time::Duration,
}; };
mod config; mod config;
@ -65,6 +65,34 @@ pub fn main() {
log::error!("{:#?}", e) log::error!("{:#?}", e)
}; };
// Super,
// Hyper,
// Meta,
// Alt,
// Control,
// Shift,
// ModeSwitch,
// Lock,
// Mod1,
// Mod2,
// Mod3,
// Mod4,
// Mod5,
//a hashmap that map evdev:Key to enum modifiers
let modifiers_map: HashMap<Key, config::Modifier> = HashMap::from([
(Key::KEY_LEFTMETA, config::Modifier::Super),
(Key::KEY_RIGHTMETA, config::Modifier::Super),
(Key::KEY_LEFTMETA, config::Modifier::Super),
(Key::KEY_RIGHTMETA, config::Modifier::Super),
(Key::KEY_LEFTALT, config::Modifier::Alt),
(Key::KEY_RIGHTALT, config::Modifier::Alt),
(Key::KEY_LEFTCTRL, config::Modifier::Control),
(Key::KEY_RIGHTCTRL, config::Modifier::Control),
(Key::KEY_LEFTSHIFT, config::Modifier::Shift),
(Key::KEY_RIGHTSHIFT, config::Modifier::Shift),
]);
let mut key_states: Vec<AttributeSet<Key>> = Vec::new(); let mut key_states: Vec<AttributeSet<Key>> = Vec::new();
let mut possible_hotkeys: Vec<config::Hotkey> = Vec::new(); let mut possible_hotkeys: Vec<config::Hotkey> = Vec::new();
loop { loop {

Loading…
Cancel
Save