fix wayvrctl

This commit is contained in:
galister
2026-01-05 20:52:19 +09:00
parent 0e291837da
commit fd9becc398
2 changed files with 27 additions and 1 deletions

View File

@@ -105,6 +105,8 @@ pub async fn wvr_process_launch(
exec: String,
name: String,
env: Vec<String>,
resolution: [u32; 2],
icon: Option<String>,
args: String,
userdata: HashMap<String, String>,
) {
@@ -118,6 +120,8 @@ pub async fn wvr_process_launch(
exec,
name,
args,
resolution,
icon,
userdata,
},
)

View File

@@ -119,10 +119,29 @@ async fn run_once(state: &mut WayVRClientState, args: Args) -> anyhow::Result<()
exec,
name,
env,
resolution,
icon,
args,
} => {
let env = env.split(",").map(|s| s.to_string()).collect::<Vec<_>>();
wvr_process_launch(state, exec, name, env, args, HashMap::new()).await;
let resolution = resolution
.split_once('x')
.and_then(|(x, y)| Some([x.parse::<u32>().ok()?, y.parse::<u32>().ok()?]))
.context(
"Invalid resolution format. Expecting <width>x<height>, for example: 1920x1080, 1280x720",
)?;
wvr_process_launch(
state,
exec,
name,
env,
resolution,
icon,
args,
HashMap::new(),
)
.await;
}
Subcommands::Haptics {
device,
@@ -216,6 +235,9 @@ enum Subcommands {
env: String,
/// Executable to run
exec: String,
#[arg(default_value = "1920x1080")]
resolution: String,
icon: Option<String>,
/// Arguments to pass to executable
#[arg(default_value = "")]
args: String,