mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
.. [no ci]
This commit is contained in:
parent
6013e603a2
commit
b207eb4db5
1 changed files with 10 additions and 15 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use mlua::{LuaSerdeExt, SerializeOptions, Table};
|
||||
use yazi_config::{MANAGER, THEME};
|
||||
|
||||
use crate::{layout::Rect, GLOBALS, LUA};
|
||||
|
||||
|
|
@ -16,30 +17,24 @@ impl Config {
|
|||
}
|
||||
|
||||
fn theme(self, options: SerializeOptions) -> mlua::Result<()> {
|
||||
GLOBALS.set("THEME", LUA.to_value_with(&*yazi_config::THEME, options)?)
|
||||
GLOBALS.set("THEME", LUA.to_value_with(&*THEME, options)?)
|
||||
}
|
||||
|
||||
fn manager(self, options: SerializeOptions) -> mlua::Result<()> {
|
||||
let manager = LUA.to_value_with(&*yazi_config::MANAGER, options)?;
|
||||
let manager = LUA.to_value_with(&*MANAGER, options)?;
|
||||
{
|
||||
let layout: Table = manager.as_table().unwrap().get("layout")?;
|
||||
|
||||
layout.set(
|
||||
"preview_rect",
|
||||
LUA.create_function(|_, ()| Ok(Rect(yazi_config::MANAGER.layout.preview_rect())))?,
|
||||
)?;
|
||||
layout.set(
|
||||
"preview_height",
|
||||
LUA.create_function(|_, ()| Ok(yazi_config::MANAGER.layout.preview_height()))?,
|
||||
)?;
|
||||
layout.set(
|
||||
"folder_rect",
|
||||
LUA.create_function(|_, ()| Ok(Rect(yazi_config::MANAGER.layout.folder_rect())))?,
|
||||
)?;
|
||||
layout.set(
|
||||
"folder_height",
|
||||
LUA.create_function(|_, ()| Ok(yazi_config::MANAGER.layout.folder_height()))?,
|
||||
LUA.create_function(|_, ()| Ok(Rect(MANAGER.layout.preview_rect())))?,
|
||||
)?;
|
||||
layout
|
||||
.set("preview_height", LUA.create_function(|_, ()| Ok(MANAGER.layout.preview_height()))?)?;
|
||||
layout
|
||||
.set("folder_rect", LUA.create_function(|_, ()| Ok(Rect(MANAGER.layout.folder_rect())))?)?;
|
||||
layout
|
||||
.set("folder_height", LUA.create_function(|_, ()| Ok(MANAGER.layout.folder_height()))?)?;
|
||||
}
|
||||
|
||||
GLOBALS.set("MANAGER", manager)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue