wayvrctl switch-set
This commit is contained in:
@@ -156,14 +156,22 @@ pub async fn wlx_device_haptics(
|
||||
)
|
||||
}
|
||||
|
||||
pub async fn wlx_overlay_show_hide(state: &mut WayVRClientState) {
|
||||
pub async fn wlx_show_hide(state: &mut WayVRClientState) {
|
||||
handle_empty_result(
|
||||
WayVRClient::fn_wlx_overlay_show_hide(state.wayvr_client.clone())
|
||||
WayVRClient::fn_wlx_show_hide(state.wayvr_client.clone())
|
||||
.await
|
||||
.context("failed to trigger overlay show hide"),
|
||||
)
|
||||
}
|
||||
|
||||
pub async fn wlx_switch_set(state: &mut WayVRClientState, set: Option<usize>) {
|
||||
handle_empty_result(
|
||||
WayVRClient::fn_wlx_switch_set(state.wayvr_client.clone(), set)
|
||||
.await
|
||||
.context("failed to switch to set"),
|
||||
)
|
||||
}
|
||||
|
||||
pub async fn wlx_panel_modify(
|
||||
state: &mut WayVRClientState,
|
||||
overlay: String,
|
||||
|
||||
@@ -14,9 +14,9 @@ use wayvr_ipc::{
|
||||
};
|
||||
|
||||
use crate::helper::{
|
||||
WayVRClientState, wlx_device_haptics, wlx_input_state, wlx_overlay_show_hide, wlx_panel_modify,
|
||||
wvr_process_get, wvr_process_launch, wvr_process_list, wvr_process_terminate, wvr_window_list,
|
||||
wvr_window_set_visible,
|
||||
WayVRClientState, wlx_device_haptics, wlx_input_state, wlx_panel_modify, wlx_show_hide,
|
||||
wlx_switch_set, wvr_process_get, wvr_process_launch, wvr_process_list, wvr_process_terminate,
|
||||
wvr_window_list, wvr_window_set_visible,
|
||||
};
|
||||
|
||||
mod helper;
|
||||
@@ -164,7 +164,7 @@ async fn run_once(state: &mut WayVRClientState, args: Args) -> anyhow::Result<()
|
||||
wlx_device_haptics(state, device, intensity, duration, frequency).await;
|
||||
}
|
||||
Subcommands::ShowHide {} => {
|
||||
wlx_overlay_show_hide(state).await;
|
||||
wlx_show_hide(state).await;
|
||||
}
|
||||
Subcommands::PanelModify {
|
||||
overlay,
|
||||
@@ -191,6 +191,10 @@ async fn run_once(state: &mut WayVRClientState, args: Args) -> anyhow::Result<()
|
||||
|
||||
wlx_panel_modify(state, overlay, element, command).await;
|
||||
}
|
||||
Subcommands::SwitchSet { set_or_0: set } => {
|
||||
let set = if set <= 0 { None } else { Some((set - 1) as _) };
|
||||
wlx_switch_set(state, set).await;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -283,6 +287,10 @@ enum Subcommands {
|
||||
#[command(subcommand)]
|
||||
command: SubcommandPanelModify,
|
||||
},
|
||||
SwitchSet {
|
||||
/// Set number to switch to, 0 to hide all sets
|
||||
set_or_0: usize,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, clap::ValueEnum)]
|
||||
|
||||
Reference in New Issue
Block a user