fix: display has to be sequential after all

This commit is contained in:
2025-03-14 15:18:38 +00:00
parent 62edcdae08
commit b525e74467
6 changed files with 45 additions and 28 deletions

View File

@ -20,23 +20,18 @@ impl Default for DisplayInfo {
}
impl Display {
pub fn activate(&self, app: AppHandle) {
let display = self.clone();
pub fn wait_for_exit(app: AppHandle, info: DisplayInfo) {
log::debug!("display: waiting");
tauri::async_runtime::spawn(async move {
let info = display.line_up()?;
if let Some(info) = info {
app.listen("launch-end", move |_| {
if let Err(e) = Self::clean_up(&info) {
log::error!("Error cleaning up display: {:?}", e);
}
});
}
Ok::<(), anyhow::Error>(())
app.listen("launch-end", move |_| {
if let Err(e) = Self::clean_up(&info) {
log::error!("error cleaning up display: {:?}", e);
}
});
});
}
fn line_up(&self) -> Result<Option<DisplayInfo>> {
pub fn line_up(&self) -> Result<Option<DisplayInfo>> {
use anyhow::anyhow;
use displayz::{query_displays, Orientation, Resolution, Frequency};
@ -101,7 +96,7 @@ impl Display {
Ok(Some(res))
}
fn clean_up(info: &DisplayInfo) -> Result<()> {
pub fn clean_up(info: &DisplayInfo) -> Result<()> {
use anyhow::anyhow;
let display_set = info.set.as_ref()