windows issues
This commit is contained in:
831
Cargo.lock
generated
831
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@ ctrlc = "3.5.2"
|
||||
futures = "0.3"
|
||||
oklab = "1.1.2"
|
||||
png = "0.17"
|
||||
reqwest = { version = "0.13.2", features = ["json"] }
|
||||
reqwest = { version = "0.13.2", default-features = false, features = ["json"] }
|
||||
rgb = "0.8"
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
serde_json = "1.0.149"
|
||||
@@ -24,6 +24,8 @@ embed-resource = "2.3"
|
||||
grim-rs = "0.1.6"
|
||||
libc = "0.2.183"
|
||||
tray-item = { version = "0.10.0", features = ["ksni"] }
|
||||
reqwest = { version = "0.13.2", default-features = false, features = ["json", "native-tls-vendored"] }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
tray-item = { version = "0.10.0" }
|
||||
reqwest = { version = "0.13.2", default-features = false, features = ["json", "native-tls-vendored"] }
|
||||
|
||||
BIN
icon.ico
BIN
icon.ico
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
icon.png
BIN
icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -54,7 +54,7 @@ impl HaClient {
|
||||
.map(|modes| {
|
||||
modes
|
||||
.iter()
|
||||
.any(|m| m.as_str().map_or(false, |s| color_modes.contains(&s)))
|
||||
.any(|m| m.as_str().is_some_and(|s| color_modes.contains(&s)))
|
||||
})
|
||||
.unwrap_or(false)
|
||||
})
|
||||
|
||||
@@ -10,6 +10,12 @@ use std::sync::Arc;
|
||||
|
||||
use tray_item::{IconSource, TrayItem};
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn get_tray_icon() -> IconSource {
|
||||
IconSource::Resource("app-icon")
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn get_tray_icon() -> IconSource {
|
||||
let icon_data = include_bytes!("../icon.png");
|
||||
let cursor = Cursor::new(&icon_data[..]);
|
||||
@@ -121,7 +127,7 @@ fn main() {
|
||||
println!("Creating scene snapshot for restore on exit...");
|
||||
if let Err(e) = rt_handle_toggle.block_on(
|
||||
ha_client_toggle
|
||||
.create_scene_snapshot("ambilight_restore", &*target_lights_toggle),
|
||||
.create_scene_snapshot("ambilight_restore", &target_lights_toggle),
|
||||
) {
|
||||
eprintln!("Failed to create scene snapshot: {}", e);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use anyhow;
|
||||
|
||||
pub type ScreenResult<T> = Result<T, anyhow::Error>;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
@@ -12,8 +10,6 @@ pub struct Pixel {
|
||||
|
||||
pub struct Screenshot {
|
||||
pub data: Vec<Pixel>,
|
||||
pub height: usize,
|
||||
pub width: usize,
|
||||
}
|
||||
|
||||
impl Screenshot {
|
||||
@@ -108,8 +104,6 @@ mod ffi {
|
||||
.map_err(|e| anyhow::anyhow!("Failed to capture screenshot: {}", e))?;
|
||||
|
||||
let raw_data = result.data();
|
||||
let width = result.width() as usize;
|
||||
let height = result.height() as usize;
|
||||
|
||||
let pixels: Vec<Pixel> = raw_data
|
||||
.chunks_exact(4)
|
||||
@@ -121,11 +115,7 @@ mod ffi {
|
||||
})
|
||||
.collect();
|
||||
|
||||
Ok(Screenshot {
|
||||
data: pixels,
|
||||
height,
|
||||
width,
|
||||
})
|
||||
Ok(Screenshot { data: pixels })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,11 +204,7 @@ mod ffi {
|
||||
CGImageRelease(cg_img);
|
||||
CFRelease(cf_data as *const libc::c_void);
|
||||
|
||||
Ok(Screenshot {
|
||||
data: pixels,
|
||||
height,
|
||||
width,
|
||||
})
|
||||
Ok(Screenshot { data: pixels })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -428,11 +414,7 @@ mod ffi {
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Screenshot {
|
||||
data: pixels,
|
||||
height: height as usize,
|
||||
width: width as usize,
|
||||
})
|
||||
Ok(Screenshot { data: pixels })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user