From ddab54616da13e992ad3790fc2e15752f865b198 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Tue, 4 May 2021 21:05:26 +0200 Subject: [PATCH] feat(core): implement icon extraction on Linux --- espanso/src/cli/worker/ui/icon.rs | 10 ++++++++-- espanso/src/res/linux/icon.png | Bin 11596 -> 0 bytes 2 files changed, 8 insertions(+), 2 deletions(-) delete mode 100644 espanso/src/res/linux/icon.png diff --git a/espanso/src/cli/worker/ui/icon.rs b/espanso/src/cli/worker/ui/icon.rs index 9410052..0b7a3f1 100644 --- a/espanso/src/cli/worker/ui/icon.rs +++ b/espanso/src/cli/worker/ui/icon.rs @@ -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 { }) } +#[cfg(target_os = "linux")] +pub fn load_icon_paths(runtime_dir: &Path) -> Result { + 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 { diff --git a/espanso/src/res/linux/icon.png b/espanso/src/res/linux/icon.png deleted file mode 100644 index 9bde0d24159582e4cc84a24a3c9cec2010040328..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11596 zcmV-SEwj>zP)005u}1^@s6i_d2*000 zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3*tb{o5Ph5us|83OtP3;8j()yM2|u~vJno`1RL9tSU)fBkzs2cMtc&%g2hh`+zQ z?>-+y-by^D*Pr#gj~~2WetyC7`~CU#eP`=^p7uUb_?-Cpmvm*lejnG~Cra`4et7@w z`ulq$|1zETPh9WQzEA%9-`NPpE}Sn#7f%Yw^SkLPi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