diff --git a/src/ui/windows.rs b/src/ui/windows.rs
index dc92af7..2c0b606 100644
--- a/src/ui/windows.rs
+++ b/src/ui/windows.rs
@@ -17,19 +17,19 @@
* along with espanso. If not, see .
*/
-use crate::bridge::windows::{close_notification, WindowsMenuItem, show_context_menu, cleanup_ui};
-use widestring::U16CString;
-use std::{thread, time};
-use log::{debug};
-use std::sync::Mutex;
-use std::sync::Arc;
+use crate::bridge::windows::{cleanup_ui, close_notification, show_context_menu, WindowsMenuItem};
use crate::ui::{MenuItem, MenuItemType};
-use std::path::Path;
-use winrt_notification::{Duration, IconCrop, Sound, Toast};
+use log::debug;
use std::io;
+use std::path::Path;
+use std::sync::Arc;
+use std::sync::Mutex;
+use std::{thread, time};
+use widestring::U16CString;
+use winrt_notification::{Duration, IconCrop, Sound, Toast};
pub struct WindowsUIManager {
- id: Arc>
+ id: Arc>,
}
impl super::UIManager for WindowsUIManager {
@@ -38,14 +38,22 @@ impl super::UIManager for WindowsUIManager {
let path_buf = std::env::current_exe()?;
let path_buf = path_buf.parent().unwrap().to_path_buf();
let installed_ico = path_buf.join("icon.ico");
- let dev_ico = path_buf.parent().unwrap().parent().unwrap().join("packager/win/icon.ico");
+ let dev_ico = path_buf
+ .parent()
+ .unwrap()
+ .parent()
+ .unwrap()
+ .join("packager/win/icon.ico");
if installed_ico.is_file() {
Ok(installed_ico.into_boxed_path())
} else if dev_ico.is_file() {
Ok(dev_ico.into_boxed_path())
} else {
- Err(io::Error::new(io::ErrorKind::NotFound, "icon.ico not found"))
+ Err(io::Error::new(
+ io::ErrorKind::NotFound,
+ "icon.ico not found",
+ ))
}
}
@@ -54,37 +62,29 @@ impl super::UIManager for WindowsUIManager {
.title("Espanso")
.text1(message)
.duration(Duration::Short);
-
+
if let Ok(p) = get_icon_path() {
- toast = toast
- .icon(
- &p,
- IconCrop::Circular,
- "espanso",
- );
+ toast = toast.icon(&p, IconCrop::Circular, "espanso");
} else {
toast = toast.text2(":(");
}
-
+
toast.show().expect("Unable to toast");
-
}
-
-
fn show_menu(&self, menu: Vec