add ::SendKey

This commit is contained in:
galister
2025-12-14 02:42:50 +09:00
parent f2bd169c22
commit f3f775c06b
2 changed files with 27 additions and 25 deletions

View File

@@ -1,28 +1,4 @@
# WayVR GUI Customization # Custom UI Elements
When customizing the watch, keyboard, dashboard, etc; place custom XML files under ~/.config/wlxoverlay/theme/gui
## Custom timezones, 12 vs 24-hour clock
These are not done via the GUI system, but via the regular config.
Create `~/.config/wlxoverlay/conf.d/clock.yaml` as such:
```yaml
timezones:
- "Europe/Oslo"
- "America/New_York"
clock_12h: false
```
Once this file is created, the various settings in custom UI that accept the `_timezone` property will use these custom alternate timezones (instead of the default set, which are selected as major ones on different continents from your current actual timezone).
The first timezone is selected with `_timezone="0"`, the second with `_timezone="1"`, and so on.
There is usually no need to specify your own local timezone in here; omitting `_timezone` from a `_source="clock"` Label will display local time.
## Custom UI Elements
### Labels ### Labels
@@ -149,6 +125,12 @@ Available argument value types (case insensitive):
Gracefully shuts down WlxOverlay-S. Useful when using an auto-restart script. Gracefully shuts down WlxOverlay-S. Useful when using an auto-restart script.
##### `::SendKey <VirtualKey> <UP|DOWN>`
Sends a key using the virtual keyboard. If WayVR is focused, the key is sent to the WayVR app.
Supported VirtualKey values are listed [here](https://github.com/galister/wlx-overlay-s/blob/f2bd169c2217d51cd2de862a6429444bf326f471/wlx-overlay-s/src/subsystem/hid/mod.rs#L336).
##### `::PlayspaceReset` ##### `::PlayspaceReset`
Resets the STAGE space to (0,0,0) with identity rotation. Resets the STAGE space to (0,0,0) with identity rotation.

View File

@@ -2,6 +2,7 @@ use std::{
cell::RefCell, cell::RefCell,
process::{Command, Stdio}, process::{Command, Stdio},
rc::Rc, rc::Rc,
str::FromStr,
sync::{Arc, atomic::Ordering}, sync::{Arc, atomic::Ordering},
time::{Duration, Instant}, time::{Duration, Instant},
}; };
@@ -23,6 +24,7 @@ use crate::{
gui::panel::helper::PipeReaderThread, gui::panel::helper::PipeReaderThread,
overlays::toast::Toast, overlays::toast::Toast,
state::AppState, state::AppState,
subsystem::hid::VirtualKey,
windowing::OverlaySelector, windowing::OverlaySelector,
}; };
@@ -140,6 +142,24 @@ pub(super) fn setup_custom_button<S: 'static>(
RUNNING.store(false, Ordering::Relaxed); RUNNING.store(false, Ordering::Relaxed);
Ok(EventResult::Consumed) Ok(EventResult::Consumed)
}), }),
"::SendKey" => {
let Some(key) = args.next().and_then(|s| VirtualKey::from_str(s).ok()) else {
log::error!("{command} has bad/missing arguments");
return;
};
let Some(down) = args.next().and_then(|s| match s.to_lowercase().as_str() {
"down" => Some(true),
"up" => Some(false),
_ => None,
}) else {
log::error!("{command} has bad/missing arguments");
return;
};
Box::new(move |_common, _data, app, _| {
app.hid_provider.send_key_routed(key, down);
Ok(EventResult::Consumed)
})
}
"::ShellExec" => { "::ShellExec" => {
let state = Rc::new(ShellButtonState { let state = Rc::new(ShellButtonState {
button: button.clone(), button: button.clone(),