Merge remote-tracking branch 'origin/main' into next-dash-interface
This commit is contained in:
@@ -410,6 +410,13 @@ impl WayVRClient {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn fn_wlx_overlay_show_hide(
|
||||||
|
client: WayVRClientMutex,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
|
send_only!(client, &PacketClient::WlxShowHide);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn fn_wlx_modify_panel(
|
pub async fn fn_wlx_modify_panel(
|
||||||
client: WayVRClientMutex,
|
client: WayVRClientMutex,
|
||||||
params: packet_client::WlxModifyPanelParams,
|
params: packet_client::WlxModifyPanelParams,
|
||||||
|
|||||||
@@ -67,4 +67,5 @@ pub enum PacketClient {
|
|||||||
WlxInputState(Serial),
|
WlxInputState(Serial),
|
||||||
WlxModifyPanel(WlxModifyPanelParams),
|
WlxModifyPanel(WlxModifyPanelParams),
|
||||||
WlxDeviceHaptics(usize, WlxHapticsParams),
|
WlxDeviceHaptics(usize, WlxHapticsParams),
|
||||||
|
WlxShowHide,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,6 +156,18 @@ pub async fn wlx_device_haptics(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn wlx_overlay_show_hide(
|
||||||
|
state: &mut WayVRClientState,
|
||||||
|
) {
|
||||||
|
handle_empty_result(
|
||||||
|
WayVRClient::fn_wlx_overlay_show_hide(
|
||||||
|
state.wayvr_client.clone(),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.context("failed to trigger overlay show hide"),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn wlx_panel_modify(
|
pub async fn wlx_panel_modify(
|
||||||
state: &mut WayVRClientState,
|
state: &mut WayVRClientState,
|
||||||
overlay: String,
|
overlay: String,
|
||||||
|
|||||||
@@ -163,6 +163,9 @@ async fn run_once(state: &mut WayVRClientState, args: Args) -> anyhow::Result<()
|
|||||||
} => {
|
} => {
|
||||||
wlx_device_haptics(state, device, intensity, duration, frequency).await;
|
wlx_device_haptics(state, device, intensity, duration, frequency).await;
|
||||||
}
|
}
|
||||||
|
Subcommands::ShowHide {} => {
|
||||||
|
wlx_overlay_show_hide(state).await;
|
||||||
|
}
|
||||||
Subcommands::PanelModify {
|
Subcommands::PanelModify {
|
||||||
overlay,
|
overlay,
|
||||||
element,
|
element,
|
||||||
@@ -268,6 +271,8 @@ enum Subcommands {
|
|||||||
#[arg(short, long, default_value = "0.1")]
|
#[arg(short, long, default_value = "0.1")]
|
||||||
frequency: f32,
|
frequency: f32,
|
||||||
},
|
},
|
||||||
|
/// Toggle overlay show or hide
|
||||||
|
ShowHide,
|
||||||
/// Apply a modification to a panel element
|
/// Apply a modification to a panel element
|
||||||
PanelModify {
|
PanelModify {
|
||||||
/// The name of the overlay (XML file name without extension)
|
/// The name of the overlay (XML file name without extension)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
"ALIGN_TO_HMD": "常にHMDの方を向く",
|
"ALIGN_TO_HMD": "常にHMDの方を向く",
|
||||||
"MOUSE": {
|
"MOUSE": {
|
||||||
"TITLE": "マウスの修正",
|
"TITLE": "マウスの修正",
|
||||||
"WRONG_SCREEN_SELECTION_HELP": "カーソルが全く別のスクリーンで動く場合、\nスクリーンが正しく選択されていない可能性があります。\nマニュアルをご確認ください。",
|
"WRONG_SCREEN_SELECTION_HELP": "カーソルが全く別のスクリーンで動く場合、\nスクリーンが正しく選択されていない可能性があります。\nReadmeをご参照ください。",
|
||||||
"NORMAL": "通常",
|
"NORMAL": "通常",
|
||||||
"FLIPPED": "ミラー",
|
"FLIPPED": "ミラー",
|
||||||
"FLIP90": "ミラー 90°",
|
"FLIP90": "ミラー 90°",
|
||||||
@@ -95,4 +95,4 @@
|
|||||||
"CANNOT_ADD_SET": "セットを追加できません!",
|
"CANNOT_ADD_SET": "セットを追加できません!",
|
||||||
"MAXIMUM_SETS_REACHED": "最大セット数に達しました。"
|
"MAXIMUM_SETS_REACHED": "最大セット数に達しました。"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,16 @@ See the Custom Timezones section for more info on timezones. Skip `_timezone` to
|
|||||||
<label _source="clock" _display="time" _timezone="0" [...] />
|
<label _source="clock" _display="time" _timezone="0" [...] />
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Timer label
|
||||||
|
|
||||||
|
Instead of a clock, this label shows the amount of time since program start, (aka time in VR).
|
||||||
|
|
||||||
|
Use `_format` to arrange `%h` hours, `%m` minutes, and `%s` seconds.
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<label _source="timer" _format="%h:%m:%s" [...] />
|
||||||
|
```
|
||||||
|
|
||||||
#### Battery label
|
#### Battery label
|
||||||
|
|
||||||
This is a label type that's used internally to display battery states.
|
This is a label type that's used internally to display battery states.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
use chrono::DateTime;
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
use chrono_tz::Tz;
|
use chrono_tz::Tz;
|
||||||
use wgui::{
|
use wgui::{
|
||||||
@@ -138,6 +139,19 @@ pub(super) fn setup_custom_label<S: 'static>(
|
|||||||
Ok(EventResult::Pass)
|
Ok(EventResult::Pass)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
"timer" => {
|
||||||
|
let format = attribs.get_value("_format").unwrap_or("%h:%m");
|
||||||
|
|
||||||
|
let state = TimerLabelState {
|
||||||
|
start: Local::now(),
|
||||||
|
format: format.into(),
|
||||||
|
};
|
||||||
|
|
||||||
|
Box::new(move |common, data, _, _| {
|
||||||
|
timer_on_tick(&state, common, data);
|
||||||
|
Ok(EventResult::Pass)
|
||||||
|
})
|
||||||
|
}
|
||||||
"ipd" => Box::new(|common, data, app, _| {
|
"ipd" => Box::new(|common, data, app, _| {
|
||||||
ipd_on_tick(common, data, app);
|
ipd_on_tick(common, data, app);
|
||||||
Ok(EventResult::Pass)
|
Ok(EventResult::Pass)
|
||||||
@@ -217,6 +231,30 @@ fn clock_on_tick(
|
|||||||
label.set_text(common, Translation::from_raw_text(&date_time));
|
label.set_text(common, Translation::from_raw_text(&date_time));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct TimerLabelState {
|
||||||
|
start: DateTime<Local>,
|
||||||
|
format: Rc<str>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn timer_on_tick(
|
||||||
|
state: &TimerLabelState,
|
||||||
|
common: &mut event::CallbackDataCommon,
|
||||||
|
data: &mut event::CallbackData,
|
||||||
|
) {
|
||||||
|
let duration = Local::now()
|
||||||
|
.signed_duration_since(&state.start)
|
||||||
|
.num_seconds();
|
||||||
|
|
||||||
|
let time = &state
|
||||||
|
.format
|
||||||
|
.replace("%s", &format!("{:02}", (duration % 60)))
|
||||||
|
.replace("%m", &format!("{:02}", ((duration / 60) % 60)))
|
||||||
|
.replace("%h", &format!("{:02}", ((duration / 60) / 60)));
|
||||||
|
|
||||||
|
let label = data.obj.get_as_mut::<WidgetLabel>().unwrap();
|
||||||
|
label.set_text(common, Translation::from_raw_text(&time));
|
||||||
|
}
|
||||||
|
|
||||||
fn ipd_on_tick(
|
fn ipd_on_tick(
|
||||||
common: &mut event::CallbackDataCommon,
|
common: &mut event::CallbackDataCommon,
|
||||||
data: &mut event::CallbackData,
|
data: &mut event::CallbackData,
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ where
|
|||||||
app.tasks
|
app.tasks
|
||||||
.enqueue(TaskType::Input(InputTask::Haptics { device, haptics }));
|
.enqueue(TaskType::Input(InputTask::Haptics { device, haptics }));
|
||||||
}
|
}
|
||||||
|
WayVRSignal::ShowHide => {
|
||||||
|
app.tasks
|
||||||
|
.enqueue(TaskType::Overlay(OverlayTask::ShowHide));
|
||||||
|
}
|
||||||
WayVRSignal::DropOverlay(overlay_id) => {
|
WayVRSignal::DropOverlay(overlay_id) => {
|
||||||
app.tasks
|
app.tasks
|
||||||
.enqueue(TaskType::Overlay(OverlayTask::Drop(OverlaySelector::Id(
|
.enqueue(TaskType::Overlay(OverlayTask::Drop(OverlaySelector::Id(
|
||||||
|
|||||||
@@ -350,6 +350,12 @@ impl Connection {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle_wlx_overlay_show_hide(
|
||||||
|
params: &mut TickParams
|
||||||
|
) {
|
||||||
|
params.signals.send(WayVRSignal::ShowHide);
|
||||||
|
}
|
||||||
|
|
||||||
fn handle_wlx_panel(
|
fn handle_wlx_panel(
|
||||||
params: &mut TickParams,
|
params: &mut TickParams,
|
||||||
custom_params: packet_client::WlxModifyPanelParams,
|
custom_params: packet_client::WlxModifyPanelParams,
|
||||||
@@ -424,6 +430,9 @@ impl Connection {
|
|||||||
PacketClient::WlxDeviceHaptics(device, haptics_params) => {
|
PacketClient::WlxDeviceHaptics(device, haptics_params) => {
|
||||||
Self::handle_wlx_device_haptics(params, device, haptics_params);
|
Self::handle_wlx_device_haptics(params, device, haptics_params);
|
||||||
}
|
}
|
||||||
|
PacketClient::WlxShowHide => {
|
||||||
|
Self::handle_wlx_overlay_show_hide(params);
|
||||||
|
}
|
||||||
PacketClient::WlxModifyPanel(custom_params) => {
|
PacketClient::WlxModifyPanel(custom_params) => {
|
||||||
Self::handle_wlx_panel(params, custom_params);
|
Self::handle_wlx_panel(params, custom_params);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,6 @@ pub enum WayVRSignal {
|
|||||||
BroadcastStateChanged(wayvr_ipc::packet_server::WvrStateChanged),
|
BroadcastStateChanged(wayvr_ipc::packet_server::WvrStateChanged),
|
||||||
DeviceHaptics(usize, crate::backend::input::Haptics),
|
DeviceHaptics(usize, crate::backend::input::Haptics),
|
||||||
DropOverlay(crate::windowing::OverlayID),
|
DropOverlay(crate::windowing::OverlayID),
|
||||||
|
ShowHide,
|
||||||
CustomTask(crate::backend::task::ModifyPanelTask),
|
CustomTask(crate::backend::task::ModifyPanelTask),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user