mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Refactor: Flatten app config structure - move panes directly under [app]
This commit is contained in:
parent
228dca9d94
commit
27fe8eb6f9
5 changed files with 14 additions and 28 deletions
|
|
@ -20,11 +20,9 @@ light = ""
|
|||
|
||||
[app]
|
||||
overall = {}
|
||||
|
||||
[app.panes]
|
||||
parent = ""
|
||||
current = ""
|
||||
preview = ""
|
||||
parent = {}
|
||||
current = {}
|
||||
preview = {}
|
||||
|
||||
# : }}}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,11 +20,9 @@ light = ""
|
|||
|
||||
[app]
|
||||
overall = {}
|
||||
|
||||
[app.panes]
|
||||
parent = ""
|
||||
current = ""
|
||||
preview = ""
|
||||
parent = {}
|
||||
current = {}
|
||||
preview = {}
|
||||
|
||||
# : }}}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,11 +37,6 @@ pub struct Theme {
|
|||
#[derive(Deserialize, DeserializeOver2)]
|
||||
pub struct App {
|
||||
pub overall: Style,
|
||||
pub panes: AppPanes,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, DeserializeOver2)]
|
||||
pub struct AppPanes {
|
||||
#[serde(default)]
|
||||
pub parent: Style,
|
||||
#[serde(default)]
|
||||
|
|
@ -249,10 +244,10 @@ impl Theme {
|
|||
|
||||
impl App {
|
||||
pub fn bg_color(&self) -> String { self.overall.bg.map(|c| c.to_string()).unwrap_or_default() }
|
||||
}
|
||||
|
||||
impl AppPanes {
|
||||
pub fn parent_bg(&self) -> String { self.parent.bg.map(|c| c.to_string()).unwrap_or_default() }
|
||||
|
||||
pub fn current_bg(&self) -> String { self.current.bg.map(|c| c.to_string()).unwrap_or_default() }
|
||||
|
||||
pub fn preview_bg(&self) -> String { self.preview.bg.map(|c| c.to_string()).unwrap_or_default() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ impl Widget for Root<'_> {
|
|||
|
||||
// Apply pane backgrounds (if configured)
|
||||
// Skip borders: top/bottom rows and left/right edges where borders are drawn
|
||||
let parent_bg = THEME.app.panes.parent_bg();
|
||||
let parent_bg = THEME.app.parent_bg();
|
||||
if !parent_bg.is_empty() {
|
||||
if let Ok(bg_color) = parent_bg.parse::<ratatui::style::Color>() {
|
||||
let pane = chunks[0];
|
||||
|
|
@ -117,7 +117,7 @@ impl Widget for Root<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
let current_bg = THEME.app.panes.current_bg();
|
||||
let current_bg = THEME.app.current_bg();
|
||||
if !current_bg.is_empty() {
|
||||
if let Ok(bg_color) = current_bg.parse::<ratatui::style::Color>() {
|
||||
let pane = chunks[1];
|
||||
|
|
@ -134,7 +134,7 @@ impl Widget for Root<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
let preview_bg = THEME.app.panes.preview_bg();
|
||||
let preview_bg = THEME.app.preview_bg();
|
||||
if !preview_bg.is_empty() {
|
||||
if let Ok(bg_color) = preview_bg.parse::<ratatui::style::Color>() {
|
||||
let pane = chunks[2];
|
||||
|
|
|
|||
|
|
@ -34,14 +34,9 @@ fn app() -> Composer<ComposerGet, ComposerSet> {
|
|||
let a = &THEME.app;
|
||||
match key {
|
||||
b"overall" => Style::from(a.overall).into_lua(lua),
|
||||
|
||||
b"panes" => lua
|
||||
.create_table_from([
|
||||
("parent", Style::from(a.panes.parent).into_lua(lua)?),
|
||||
("current", Style::from(a.panes.current).into_lua(lua)?),
|
||||
("preview", Style::from(a.panes.preview).into_lua(lua)?),
|
||||
])?
|
||||
.into_lua(lua),
|
||||
b"parent" => Style::from(a.parent).into_lua(lua),
|
||||
b"current" => Style::from(a.current).into_lua(lua),
|
||||
b"preview" => Style::from(a.preview).into_lua(lua),
|
||||
_ => Ok(Value::Nil),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue