style(ui): fix formatting
This commit is contained in:
parent
a8a5ef16a2
commit
638863170c
|
@ -58,10 +58,11 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_context_menu_serializes_correctly() {
|
fn test_context_menu_serializes_correctly() {
|
||||||
let menu = Menu { items: vec![
|
let menu = Menu {
|
||||||
|
items: vec![
|
||||||
MenuItem::Simple(SimpleMenuItem {
|
MenuItem::Simple(SimpleMenuItem {
|
||||||
id: 0,
|
id: 0,
|
||||||
label: "Open".to_string()
|
label: "Open".to_string(),
|
||||||
}),
|
}),
|
||||||
MenuItem::Separator,
|
MenuItem::Separator,
|
||||||
MenuItem::Sub(SubMenuItem {
|
MenuItem::Sub(SubMenuItem {
|
||||||
|
@ -77,7 +78,8 @@ mod tests {
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
]};
|
],
|
||||||
|
};
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
menu.to_json().unwrap(),
|
menu.to_json().unwrap(),
|
||||||
|
|
|
@ -17,14 +17,20 @@
|
||||||
* along with espanso. If not, see <https://www.gnu.org/licenses/>.
|
* along with espanso. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::{path::{PathBuf}, sync::{Arc, Mutex, mpsc::{Sender, channel}}};
|
use std::{
|
||||||
|
path::PathBuf,
|
||||||
|
sync::{
|
||||||
|
mpsc::{channel, Sender},
|
||||||
|
Arc, Mutex,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
use anyhow::{Result, anyhow, bail};
|
use anyhow::{anyhow, bail, Result};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use log::{error, warn};
|
use log::{error, warn};
|
||||||
|
use std::os::windows::process::CommandExt;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use winrt_notification::{IconCrop, Toast};
|
use winrt_notification::{IconCrop, Toast};
|
||||||
use std::os::windows::process::CommandExt;
|
|
||||||
|
|
||||||
const ESPANSO_APP_USER_MODEL_ID: &str = "{5E3B6C0F-1A4D-45C4-8872-D8174702101A}";
|
const ESPANSO_APP_USER_MODEL_ID: &str = "{5E3B6C0F-1A4D-45C4-8872-D8174702101A}";
|
||||||
|
|
||||||
|
@ -36,7 +42,9 @@ pub fn initialize_notification_thread(notification_icon_path: PathBuf) -> Result
|
||||||
let (sender, receiver) = channel::<String>();
|
let (sender, receiver) = channel::<String>();
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut lock = SEND_CHANNEL.lock().map_err(|e| anyhow!("failed to define shared notification sender: {}", e))?;
|
let mut lock = SEND_CHANNEL
|
||||||
|
.lock()
|
||||||
|
.map_err(|e| anyhow!("failed to define shared notification sender: {}", e))?;
|
||||||
*lock = Some(sender);
|
*lock = Some(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,12 +76,14 @@ pub fn initialize_notification_thread(notification_icon_path: PathBuf) -> Result
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show_notification(msg: &str) -> Result<()> {
|
pub fn show_notification(msg: &str) -> Result<()> {
|
||||||
let mut lock = SEND_CHANNEL.lock().map_err(|e| anyhow!("unable to acquire notification send channel: {}", e))?;
|
let mut lock = SEND_CHANNEL
|
||||||
|
.lock()
|
||||||
|
.map_err(|e| anyhow!("unable to acquire notification send channel: {}", e))?;
|
||||||
match &mut *lock {
|
match &mut *lock {
|
||||||
Some(sender) => {
|
Some(sender) => {
|
||||||
sender.send(msg.to_string())?;
|
sender.send(msg.to_string())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
}
|
||||||
None => bail!("notification sender not available"),
|
None => bail!("notification sender not available"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user