mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: Configuring the display results of notify using theme.toml
This commit is contained in:
parent
4d8e276a6f
commit
61907b5324
2 changed files with 21 additions and 4 deletions
|
|
@ -335,4 +335,20 @@ rules = [
|
||||||
{ name = "*/", text = "" },
|
{ name = "*/", text = "" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# : }}}
|
||||||
|
|
||||||
|
|
||||||
|
# : Notify {{{
|
||||||
|
|
||||||
|
[notify]
|
||||||
|
title_info = { fg = "green" }
|
||||||
|
title_warn = { bg = "yellow" }
|
||||||
|
title_error = { fg = "red" }
|
||||||
|
|
||||||
|
# Icons
|
||||||
|
icon_info = ""
|
||||||
|
icon_warn = ""
|
||||||
|
icon_error = ""
|
||||||
|
|
||||||
# : }}}
|
# : }}}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use ratatui::{buffer::Buffer, layout::{self, Constraint, Offset, Rect}, style::{Style, Stylize}, widgets::{Block, BorderType, Paragraph, Widget, Wrap}};
|
use ratatui::{buffer::Buffer, layout::{self, Constraint, Offset, Rect}, widgets::{Block, BorderType, Paragraph, Widget, Wrap}};
|
||||||
|
use yazi_config::THEME;
|
||||||
use yazi_core::notify::{Level, Message};
|
use yazi_core::notify::{Level, Message};
|
||||||
|
|
||||||
use crate::{widgets::Clear, Ctx};
|
use crate::{widgets::Clear, Ctx};
|
||||||
|
|
@ -42,9 +43,9 @@ impl<'a> Widget for Layout<'a> {
|
||||||
|
|
||||||
for (i, m) in notify.messages.iter().enumerate().take(limit) {
|
for (i, m) in notify.messages.iter().enumerate().take(limit) {
|
||||||
let (icon, style) = match m.level {
|
let (icon, style) = match m.level {
|
||||||
Level::Info => ("", Style::default().green()),
|
Level::Info => (&THEME.notify.icon_info, THEME.notify.title_info),
|
||||||
Level::Warn => ("", Style::default().yellow()),
|
Level::Warn => (&THEME.notify.icon_warn, THEME.notify.title_warn),
|
||||||
Level::Error => ("", Style::default().red()),
|
Level::Error => (&THEME.notify.icon_error, THEME.notify.title_error),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut rect =
|
let mut rect =
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue