v1.0.2: arrow keys, start menu paging support
key press convenience methods, fix logo, docs, add more chars
This commit is contained in:
26
docs/system/keys.md
Normal file
26
docs/system/keys.md
Normal file
@@ -0,0 +1,26 @@
|
||||
Relevant section taken from `src/bin/main.rs`:
|
||||
|
||||
```rust
|
||||
fn key_to_char(key: Key) -> Option<KeyChar> {
|
||||
match key {
|
||||
Key::Char('\n') => Some(KeyChar::Press('𐘂')),
|
||||
Key::Char(c) => Some(KeyChar::Press(c)),
|
||||
Key::Alt(c) => Some(KeyChar::Alt(c)),
|
||||
Key::Ctrl(c) => Some(KeyChar::Ctrl(c)),
|
||||
Key::Backspace => Some(KeyChar::Press('𐘁')),
|
||||
Key::Esc => Some(KeyChar::Press('𐘃')),
|
||||
Key::Up => Some(KeyChar::Press('𐙘')),
|
||||
Key::Down => Some(KeyChar::Press('𐘞')),
|
||||
Key::Left => Some(KeyChar::Press('𐙣')),
|
||||
Key::Right => Some(KeyChar::Press('𐙥')),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The special keys backspace, enter, escape, and the arrows, are represented by a single Linear A char. For ease, there are [methods](https://docs.rs/ming-wm-lib/latest/ming_wm_lib/messages/struct.KeyPress.html) to check whether a key press is a backspace, enter, etc, without pasting the Linear A into the code.
|
||||
|
||||
Although the arrow keys are supported, please try and support the Vim `hjkl` if possible!
|
||||
|
||||
The `Press` events are sent as `WindowMessage::KeyPress(KeyPress)`, and the `Ctrl` events are sent as `WindowMessage::CtrlKeyPress(KeyPress)`. Any keys pressed along with the Alt key are not passed to the windows.
|
||||
|
||||
@@ -101,8 +101,17 @@ mv target/release/mingMisc_Example /usr/bin/mingMisc_Example #or whatever direct
|
||||
|
||||

|
||||
|
||||
## Now what?
|
||||
|
||||
Handle various inputs in `handle_message`, and have it mutate the state. Draw the relevant state in `draw`. Not too hard, eh?
|
||||
|
||||
Besides looking at the examples (Koxinga, `src/bin`), read the [ming-wm-lib docs](https://docs.rs/ming-wm-lib)!
|
||||
|
||||
Also, `docs/system/keys.md` may be useful.
|
||||
|
||||
## Tips
|
||||
|
||||
- For windows that are separate binaries, the Elm Architecture obviously cannot be enforced (unless the window is written in Rust and uses the `ming-wm-lib`. However, the design of the IPC and the nature of the window manager being keyboard-driven makes it so using the Elm Architecture is highly recommended.
|
||||
- Since the window manager currently queries and reads the responses to/from window binaries in the main thread, while the response is being waited for, the window manager is "frozen". Therefore, time-consuming tasks (>1 second) should not be done in the main thread, but rather a separate thread. For example, the ming-wm audio player (`src/bin/audio_player.rs`) does the time-consuming process of reading audio files in a separate thread to not hold up the window manager, and provide quick responses.
|
||||
- Window panics will be logged to `~/.local/share/ming-wm/logs.txt`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user