feat: display witchcraft
This commit is contained in:
@ -25,7 +25,8 @@ pub async fn startline(app: AppHandle) -> Result<(), String> {
|
||||
let hash = appd.sum_packages(p);
|
||||
liner::line_up(p, hash).await
|
||||
.map_err(|e| e.to_string())?;
|
||||
start::start(p, app_copy)
|
||||
|
||||
start::start(p, app_copy).await
|
||||
.map_err(|e| e.to_string())
|
||||
} else {
|
||||
Err("No profile".to_owned())
|
||||
@ -211,6 +212,17 @@ pub async fn write_profile_data(
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn list_platform_capabilities() -> Result<Vec<String>, ()> {
|
||||
log::debug!("invoke: list_platform_capabilities");
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
return Ok(vec!["display".to_owned()]);
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
return Ok(vec!["wine".to_owned()]);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn set_cfg(
|
||||
state: State<'_, Mutex<AppData>>,
|
||||
@ -226,3 +238,32 @@ pub async fn set_cfg(
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[cfg(target_os = "windows")]
|
||||
pub async fn list_displays() -> Result<Vec<(String, String)>, String> {
|
||||
use winsafe::prelude::NativeBitflag;
|
||||
|
||||
log::debug!("invoke: list_displays");
|
||||
|
||||
let mut res = Vec::new();
|
||||
for displ_dev in winsafe::EnumDisplayDevices(None, None) {
|
||||
if let Ok(displ_dev) = displ_dev {
|
||||
if displ_dev.StateFlags.has(winsafe::co::DISPLAY_DEVICE::ATTACHED_TO_DESKTOP) {
|
||||
res.push((displ_dev.DeviceName(), displ_dev.DeviceString()));
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
pub async fn list_displays() -> Result<Vec<String>, ()> {
|
||||
log::debug!("invoke: list_displays");
|
||||
|
||||
Ok(Vec::new())
|
||||
}
|
||||
|
Reference in New Issue
Block a user