feat(core): implement icon extraction on Linux

This commit is contained in:
Federico Terzi 2021-05-04 21:05:26 +02:00
parent ddd62b225f
commit ddab54616d
2 changed files with 8 additions and 2 deletions

View File

@ -29,7 +29,6 @@ const WINDOWS_ICO_BINARY: &[u8] = include_bytes!("../../../res/windows/espanso.i
const WINDOWS_RED_ICO_BINARY: &[u8] = include_bytes!("../../../res/windows/espansored.ico");
// TODO: macos
// TODO: linux
#[derive(Debug, Default)]
pub struct IconPaths {
@ -53,8 +52,15 @@ pub fn load_icon_paths(runtime_dir: &Path) -> Result<IconPaths> {
})
}
#[cfg(target_os = "linux")]
pub fn load_icon_paths(runtime_dir: &Path) -> Result<IconPaths> {
Ok(IconPaths {
logo: Some(extract_icon(ICON_BINARY, &runtime_dir.join("icon.png"))?),
..Default::default()
})
}
// TODO: macos
// TODO: linux
// TODO: test
fn extract_icon(data: &[u8], target_file: &Path) -> Result<PathBuf> {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB