mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 05:12:40 +03:00
fonts: use toast notification for missing glyph notification
Popping open the config error window is a bit of overkill
This commit is contained in:
parent
8880979586
commit
0c4c129b91
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -4410,6 +4410,7 @@ dependencies = [
|
||||
"unicode-segmentation",
|
||||
"walkdir",
|
||||
"wezterm-term",
|
||||
"wezterm-toast-notification",
|
||||
"winapi 0.3.9",
|
||||
"window",
|
||||
]
|
||||
|
@ -28,6 +28,7 @@ unicode-segmentation = "1.7"
|
||||
unicode-general-category = "0.3"
|
||||
walkdir = "2"
|
||||
wezterm-term = { path = "../term", features=["use_serde"] }
|
||||
wezterm-toast-notification = { path = "../wezterm-toast-notification" }
|
||||
window = { path = "../window" }
|
||||
|
||||
[target.'cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))'.dependencies]
|
||||
|
@ -12,8 +12,10 @@ use std::cell::RefCell;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::rc::{Rc, Weak};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
use thiserror::Error;
|
||||
use wezterm_term::CellAttributes;
|
||||
use wezterm_toast_notification::ToastNotification;
|
||||
use window::default_dpi;
|
||||
|
||||
mod hbwrap;
|
||||
@ -305,16 +307,33 @@ impl FontConfigInner {
|
||||
.collect::<String>();
|
||||
|
||||
if config.warn_about_missing_glyphs {
|
||||
config::show_error(&format!(
|
||||
let url = "https://wezfurlong.org/wezterm/config/fonts.html";
|
||||
log::warn!(
|
||||
"No fonts contain glyphs for these codepoints: {}.\n\
|
||||
Placeholder 'Last Resort' glyphs are being displayed instead.\n\
|
||||
You may wish to install additional fonts, or adjust your\n\
|
||||
configuration so that it can find them.\n\
|
||||
https://wezfurlong.org/wezterm/config/fonts.html\n\
|
||||
has more information about configuring fonts.\n\
|
||||
{} has more information about configuring fonts.\n\
|
||||
Set warn_about_missing_glyphs=false to suppress this message.",
|
||||
fallback_str.escape_unicode(),
|
||||
url,
|
||||
);
|
||||
|
||||
ToastNotification {
|
||||
title: "Font problem".to_string(),
|
||||
message: format!(
|
||||
"No fonts contain glyphs for these codepoints: {}.\n\
|
||||
Placeholder glyphs are being displayed instead.\n\
|
||||
You may wish to install additional fonts, or adjust\n\
|
||||
your configuration so that it can find them.\n\
|
||||
Set warn_about_missing_glyphs=false to suppress this\n\
|
||||
message.",
|
||||
fallback_str.escape_unicode()
|
||||
));
|
||||
),
|
||||
url: Some(url.to_string()),
|
||||
timeout: Some(Duration::from_secs(15)),
|
||||
}
|
||||
.show();
|
||||
} else {
|
||||
log::warn!(
|
||||
"No fonts contain glyphs for these codepoints: {}",
|
||||
|
@ -10,6 +10,12 @@ pub struct ToastNotification {
|
||||
pub timeout: Option<std::time::Duration>,
|
||||
}
|
||||
|
||||
impl ToastNotification {
|
||||
pub fn show(self) {
|
||||
show(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
use crate::windows as backend;
|
||||
#[cfg(all(not(target_os = "macos"), not(windows), not(target_os = "freebsd")))]
|
||||
|
Loading…
Reference in New Issue
Block a user