Make switch keys kebab-case and include buttons

This commit is contained in:
Jan Trefil 2023-08-22 19:42:49 +02:00
parent ad4d36298c
commit 836f99c46f
5 changed files with 1821 additions and 7 deletions

View file

@ -1,5 +1,6 @@
listen = "0.0.0.0:5258"
switch-keys = ["LeftAlt", "LeftCtrl"]
# See `switch-keys.md` in the repository root for the list of all possible keys.
switch-keys = ["left-alt", "left-ctrl"]
certificate = "/etc/rkvm/certificate.pem"
key = "/etc/rkvm/key.pem"

File diff suppressed because it is too large Load diff

View file

@ -60,8 +60,10 @@ async fn main() -> ExitCode {
}
};
let switch_keys = config.switch_keys.into_iter().map(Into::into).collect();
tokio::select! {
result = server::run(config.listen, acceptor, &config.password, &config.switch_keys) => {
result = server::run(config.listen, acceptor, &config.password, &switch_keys) => {
if let Err(err) = result {
log::error!("Error: {}", err);
return ExitCode::FAILURE;

View file

@ -1,6 +1,6 @@
use rkvm_input::abs::{AbsAxis, AbsInfo};
use rkvm_input::event::Event;
use rkvm_input::key::{Key, KeyEvent, Keyboard};
use rkvm_input::key::{Key, KeyEvent};
use rkvm_input::monitor::Monitor;
use rkvm_input::rel::RelAxis;
use rkvm_input::sync::SyncEvent;
@ -36,7 +36,7 @@ pub async fn run(
listen: SocketAddr,
acceptor: TlsAcceptor,
password: &str,
switch_keys: &HashSet<Keyboard>,
switch_keys: &HashSet<Key>,
) -> Result<(), Error> {
let listener = TcpListener::bind(&listen).await.map_err(Error::Network)?;
log::info!("Listening on {}", listen);
@ -175,7 +175,7 @@ pub async fn run(
Ok(event) => {
let mut press = false;
if let Event::Key(KeyEvent { key: Key::Key(key), down }) = event {
if let Event::Key(KeyEvent { key, down }) = event {
if switch_keys.contains(&key) {
press = true;

600
switch-keys.md Normal file
View file

@ -0,0 +1,600 @@
# Switch keys
## Keyboard keys
- `a`
- `ab`
- `address-book`
- `again`
- `als-toggle`
- `alt-erase`
- `angle`
- `apostrophe`
- `appselect`
- `archive`
- `aspect-ratio`
- `assistant`
- `attendant-off`
- `attendant-on`
- `attendant-toggle`
- `audio`
- `audio-desc`
- `aux`
- `b`
- `back`
- `backslash`
- `backspace`
- `bass-boost`
- `battery`
- `blue`
- `bluetooth`
- `bookmarks`
- `break`
- `brightness-auto`
- `brightness-cycle`
- `brightness-max`
- `brightness-min`
- `brightness-toggle`
- `brightness-zero`
- `brightness-down`
- `brightness-up`
- `brl-dot1`
- `brl-dot10`
- `brl-dot2`
- `brl-dot3`
- `brl-dot4`
- `brl-dot5`
- `brl-dot6`
- `brl-dot7`
- `brl-dot8`
- `brl-dot9`
- `button-config`
- `c`
- `calc`
- `calendar`
- `camera`
- `camera-down`
- `camera-focus`
- `camera-left`
- `camera-right`
- `camera-up`
- `camera-zoom-in`
- `camera-zoom-out`
- `cancel`
- `caps-lock`
- `cd`
- `channel`
- `channel-down`
- `channel-up`
- `chat`
- `clear`
- `close`
- `close-cd`
- `coffee`
- `comma`
- `compose`
- `computer`
- `config`
- `connect`
- `context-menu`
- `controlpanel`
- `copy`
- `cut`
- `cycle-windows`
- `d`
- `dashboard`
- `data`
- `database`
- `del-eol`
- `del-eos`
- `del-line`
- `delete`
- `delete-file`
- `digits`
- `direction`
- `directory`
- `display-off`
- `display-toggle`
- `documents`
- `dollar`
- `dot`
- `down`
- `dvd`
- `e`
- `edit`
- `editor`
- `eject-cd`
- `eject-close-cd`
- `email`
- `end`
- `enter`
- `epg`
- `equal`
- `esc`
- `euro`
- `exit`
- `f`
- `f1`
- `f10`
- `f11`
- `f12`
- `f13`
- `f14`
- `f15`
- `f16`
- `f17`
- `f18`
- `f19`
- `f2`
- `f20`
- `f21`
- `f22`
- `f23`
- `f24`
- `f3`
- `f4`
- `f5`
- `f6`
- `f7`
- `f8`
- `f9`
- `fast-forward`
- `fast-reverse`
- `favorites`
- `file`
- `finance`
- `find`
- `first`
- `fn`
- `fn1`
- `fn2`
- `fn-b`
- `fn-d`
- `fn-e`
- `fn-esc`
- `fn-f`
- `fn-f1`
- `fn-f10`
- `fn-f11`
- `fn-f12`
- `fn-f2`
- `fn-f3`
- `fn-f4`
- `fn-f5`
- `fn-f6`
- `fn-f7`
- `fn-f8`
- `fn-f9`
- `fn-s`
- `forward`
- `forward-mail`
- `frameback`
- `frame-forward`
- `front`
- `full-screen`
- `g`
- `games`
- `goto`
- `graphics-editor`
- `grave`
- `green`
- `h`
- `hangeul`
- `hanja`
- `help`
- `henkan`
- `hiragana`
- `home`
- `homepage`
- `hp`
- `i`
- `images`
- `info`
- `ins-line`
- `insert`
- `iso`
- `j`
- `journal`
- `k`
- `katakana`
- `katakana-hiragana`
- `kbd-layout-next`
- `kbd-lcd-menu1`
- `kbd-lcd-menu2`
- `kbd-lcd-menu3`
- `kbd-lcd-menu4`
- `kbd-lcd-menu5`
- `kbd-illum-down`
- `kbd-illum-toggle`
- `kbd-illum-up`
- `kbd-input-assist-accept`
- `kbd-input-assist-cancel`
- `kbd-input-assist-next`
- `kbd-input-assist-nextgroup`
- `kbd-input-assist-prev`
- `kbd-input-assist-prevgroup`
- `keyboard`
- `kp0`
- `kp1`
- `kp2`
- `kp3`
- `kp4`
- `kp5`
- `kp6`
- `kp7`
- `kp8`
- `kp9`
- `kp-asterisk`
- `kp-comma`
- `kp-dott`
- `kp-enter`
- `kp-equal`
- `kp-jp-comma`
- `kp-left-paren`
- `kp-minus`
- `kp-plus`
- `kp-plus-minus`
- `kp-right-paren`
- `kp-slash`
- `l`
- `language`
- `last`
- `left`
- `left-down`
- `left-up`
- `left-alt`
- `left-brace`
- `left-ctrl`
- `left-meta`
- `left-shift`
- `lights-toggle`
- `line-feed`
- `list`
- `log-off`
- `m`
- `macro`
- `macro1`
- `macro10`
- `macro11`
- `macro12`
- `macro13`
- `macro14`
- `macro15`
- `macro16`
- `macro17`
- `macro18`
- `macro19`
- `macro2`
- `macro20`
- `macro21`
- `macro22`
- `macro23`
- `macro24`
- `macro25`
- `macro26`
- `macro27`
- `macro28`
- `macro29`
- `macro3`
- `macro30`
- `macro4`
- `macro5`
- `macro6`
- `macro7`
- `macro8`
- `macro9`
- `macro-preset1`
- `macro-preset2`
- `macro-preset3`
- `macro-preset-cycle`
- `macro-record-start`
- `macro-record-stop`
- `mail`
- `media`
- `media-repeat`
- `media-top-menu`
- `memo`
- `menu`
- `messenger`
- `mhp`
- `mic-mute`
- `minus`
- `mode`
- `move`
- `mp3`
- `ms-dos`
- `muhenkan`
- `mute`
- `n`
- `n0`
- `n1`
- `n102nd`
- `n10-channels-down`
- `n10-channels-up`
- `n2`
- `n3`
- `n3d-mode`
- `n4`
- `n5`
- `n6`
- `n7`
- `n8`
- `n9`
- `new`
- `news`
- `next`
- `next-favorite`
- `next-song`
- `numeric0`
- `numeric1`
- `numeric11`
- `numeric12`
- `numeric2`
- `numeric3`
- `numeric4`
- `numeric5`
- `numeric6`
- `numeric7`
- `numeric8`
- `numeric9`
- `numeric-a`
- `numeric-b`
- `numeric-c`
- `numeric-d`
- `numeric-pound`
- `numeric-star`
- `num-lock`
- `o`
- `ok`
- `onscreen-keyboard`
- `open`
- `option`
- `p`
- `page-down`
- `page-up`
- `paste`
- `pause`
- `pause-record`
- `pause-cd`
- `pc`
- `phone`
- `play`
- `play-cd`
- `player`
- `play-pause`
- `power`
- `power2`
- `presentation`
- `previous`
- `previous-song`
- `print`
- `privacy-screen-toggle`
- `prog1`
- `prog2`
- `prog3`
- `prog4`
- `program`
- `props`
- `pvr`
- `q`
- `question`
- `r`
- `radio`
- `record`
- `red`
- `redo`
- `refresh`
- `reply`
- `reserved`
- `restart`
- `rewind`
- `rf-kill`
- `right`
- `right-down`
- `right-up`
- `right-alt`
- `right-brace`
- `right-ctrl`
- `right-meta`
- `right-shift`
- `ro`
- `root-menu`
- `rotate-display`
- `rotate-lock-toggle`
- `s`
- `sat`
- `sat2`
- `save`
- `scale`
- `screen`
- `screenlock`
- `screensaver`
- `scroll-down`
- `scroll-lock`
- `scroll-up`
- `search`
- `select`
- `selective-screenshot`
- `semicolon`
- `send`
- `send-file`
- `setup`
- `shop`
- `shuffle`
- `slash`
- `sleep`
- `slow`
- `slow-reverse`
- `sound`
- `space`
- `spellcheck`
- `sport`
- `spreadsheet`
- `stop`
- `stop-record`
- `stop-cd`
- `subtitle`
- `suspend`
- `switch-video-mode`
- `sys-rq`
- `t`
- `tab`
- `tape`
- `task-manager`
- `teen`
- `text`
- `time`
- `title`
- `touchpad-off`
- `touchpad-on`
- `touchpad-toggle`
- `tuner`
- `tv`
- `tv2`
- `twen`
- `u`
- `undo`
- `unknown`
- `unmute`
- `up`
- `uwb`
- `v`
- `vcr`
- `vcr2`
- `vendor`
- `video`
- `video-next`
- `video-prev`
- `video-phone`
- `vod`
- `voice-command`
- `voice-mail`
- `volume-down`
- `volume-up`
- `w`
- `wake-up`
- `wimax`
- `wlan`
- `word-processor`
- `wps-button`
- `wwan`
- `www`
- `x`
- `xfer`
- `y`
- `yellow`
- `yen`
- `z`
- `zenkaku-hankaku`
- `zoom`
- `zoom-in`
- `zoom-out`
- `zoom-reset`
## Buttons
- `b0`
- `b1`
- `b2`
- `b3`
- `b4`
- `b5`
- `b6`
- `b7`
- `b8`
- `b9`
- `b-left`
- `b-right`
- `middle`
- `side`
- `extra`
- `b-forward`
- `b-back`
- `task`
- `trigger`
- `thumb`
- `thumb2`
- `top`
- `top2`
- `pinkie`
- `base`
- `base2`
- `base3`
- `base4`
- `base5`
- `base6`
- `dead`
- `south`
- `east`
- `b-c`
- `north`
- `west`
- `b-z`
- `t-l`
- `tr`
- `tl2`
- `tr2`
- `b-select`
- `start`
- `b-mode`
- `thumb-l`
- `thumb-r`
- `tool-pen`
- `tool-rubber`
- `tool-brush`
- `tool-pencil`
- `tool-airbrush`
- `tool-finger`
- `tool-mouse`
- `tool-lens`
- `quint-tap`
- `stylus3`
- `touch`
- `stylus`
- `stylus2`
- `double-tap`
- `triple-tap`
- `quad-tap`
- `gear-down`
- `gear-up`
- `d-pad-up`
- `d-pad-down`
- `d-pad-left`
- `d-pad-right`
- `trigger-happy1`
- `triger-happy2`
- `trigger-happy3`
- `trigger-happy4`
- `trigger-happy5`
- `trigger-happy6`
- `trigger-happy7`
- `trigger-happy8`
- `trigger-happy9`
- `trigger-happy10`
- `trigger-happy11`
- `trigger-happy12`
- `trigger-happy13`
- `trigger-happy14`
- `trigger-happy15`
- `trigger-happy16`
- `trigger-happy17`
- `trigger-happy18`
- `trigger-happy19`
- `trigger-happy20`
- `trigger-happy21`
- `trigger-happy22`
- `trigger-happy23`
- `trigger-happy24`
- `trigger-happy25`
- `trigger-happy26`
- `trigger-happy27`
- `trigger-happy28`
- `trigger-happy29`
- `trigger-happy30`
- `trigger-happy31`
- `trigger-happy32`
- `trigger-happy33`
- `trigger-happy34`
- `trigger-happy35`
- `trigger-happy36`
- `trigger-happy37`
- `trigger-happy38`
- `trigger-happy39`
- `trigger-happy40`