From d80b920cf8b4eb25d8cf7026eccf95a7e57fe50e Mon Sep 17 00:00:00 2001 From: Yahddyyp Date: Fri, 26 Jun 2026 19:16:18 +0530 Subject: [PATCH 1/9] feat: add filter_keyword style to header indicator defaults to red, bold can me changed by filter_keyword = { fg = "red", bold = true } in the [mgr] section of the config --- yazi-config/preset/theme-dark.toml | 2 +- yazi-config/preset/theme-light.toml | 1 + yazi-config/src/theme/theme.rs | 139 ++++++------- yazi-plugin/preset/components/header.lua | 152 +++++++------- yazi-plugin/preset/components/status.lua | 246 +++++++++++------------ yazi-plugin/src/theme/theme.rs | 70 +++++-- 6 files changed, 328 insertions(+), 282 deletions(-) diff --git a/yazi-config/preset/theme-dark.toml b/yazi-config/preset/theme-dark.toml index 90d6eca6..dae7686b 100644 --- a/yazi-config/preset/theme-dark.toml +++ b/yazi-config/preset/theme-dark.toml @@ -15,7 +15,6 @@ light = "" # : }}} - # : App {{{ [app] @@ -28,6 +27,7 @@ overall = {} [mgr] cwd = { fg = "cyan" } +filter_keyword = { fg = "red", bold = true } # Find find_keyword = { fg = "yellow", bold = true, italic = true, underline = true } diff --git a/yazi-config/preset/theme-light.toml b/yazi-config/preset/theme-light.toml index 43cf9552..44bbe12a 100644 --- a/yazi-config/preset/theme-light.toml +++ b/yazi-config/preset/theme-light.toml @@ -28,6 +28,7 @@ overall = {} [mgr] cwd = { fg = "cyan" } +filter_keyword = { fg = "red", bold = true } # Find find_keyword = { fg = "yellow", bold = true, italic = true, underline = true } diff --git a/yazi-config/src/theme/theme.rs b/yazi-config/src/theme/theme.rs index 4998eae1..c26b6461 100644 --- a/yazi-config/src/theme/theme.rs +++ b/yazi-config/src/theme/theme.rs @@ -13,26 +13,26 @@ use crate::YAZI; #[derive(Deserialize, DeserializeOver, DeserializeOver1, Overlay)] pub struct Theme { - pub flavor: Flavor, - pub app: App, - pub mgr: Mgr, - pub tabs: Tabs, - pub mode: Mode, + pub flavor: Flavor, + pub app: App, + pub mgr: Mgr, + pub tabs: Tabs, + pub mode: Mode, pub indicator: Indicator, - pub status: Status, - pub which: Which, - pub confirm: Confirm, - pub spot: Spot, - pub notify: Notify, - pub pick: Pick, - pub input: Input, - pub cmp: Cmp, - pub tasks: Tasks, - pub help: Help, + pub status: Status, + pub which: Which, + pub confirm: Confirm, + pub spot: Spot, + pub notify: Notify, + pub pick: Pick, + pub input: Input, + pub cmp: Cmp, + pub tasks: Tasks, + pub help: Help, // File-specific styles pub filetype: Filetype, - pub icon: Icon, + pub icon: Icon, // User-defined custom sections #[serde(flatten, default)] @@ -68,27 +68,30 @@ pub struct Mgr { pub cwd: SyncCell, // Find - pub find_keyword: SyncCell, + pub find_keyword: SyncCell, pub find_position: SyncCell, + // Filter + pub filter_keyword: SyncCell, + // Symlink pub symlink_target: SyncCell, // Marker - pub marker_copied: SyncCell, - pub marker_cut: SyncCell, - pub marker_marked: SyncCell, + pub marker_copied: SyncCell, + pub marker_cut: SyncCell, + pub marker_marked: SyncCell, pub marker_selected: SyncCell, - pub marker_symbol: ArcSwap, + pub marker_symbol: ArcSwap, // Count - pub count_copied: SyncCell, - pub count_cut: SyncCell, + pub count_copied: SyncCell, + pub count_cut: SyncCell, pub count_selected: SyncCell, // Border pub border_symbol: ArcSwap, - pub border_style: SyncCell, + pub border_style: SyncCell, // Highlighting #[serde(deserialize_with = "deserialize_syntect_theme")] @@ -98,7 +101,7 @@ pub struct Mgr { // --- Tabs #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Tabs { - pub active: SyncCell, + pub active: SyncCell, pub inactive: SyncCell, pub sep_inner: ArcSwap, @@ -107,7 +110,7 @@ pub struct Tabs { #[derive(Deserialize)] pub struct TabsSep { - pub open: String, + pub open: String, pub close: String, } @@ -115,19 +118,19 @@ pub struct TabsSep { #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Mode { pub normal_main: SyncCell, - pub normal_alt: SyncCell, + pub normal_alt: SyncCell, pub select_main: SyncCell, - pub select_alt: SyncCell, + pub select_alt: SyncCell, pub unset_main: SyncCell, - pub unset_alt: SyncCell, + pub unset_alt: SyncCell, } // --- Indicator #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Indicator { - pub parent: SyncCell, + pub parent: SyncCell, pub current: SyncCell, pub preview: SyncCell, pub padding: ArcSwap, @@ -135,33 +138,33 @@ pub struct Indicator { #[derive(Deserialize)] pub struct IndicatorPadding { - pub open: String, + pub open: String, pub close: String, } // --- Status #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Status { - pub overall: SyncCell, - pub sep_left: ArcSwap, + pub overall: SyncCell, + pub sep_left: ArcSwap, pub sep_right: ArcSwap, // Permissions - pub perm_sep: SyncCell, - pub perm_type: SyncCell, - pub perm_read: SyncCell, + pub perm_sep: SyncCell, + pub perm_type: SyncCell, + pub perm_read: SyncCell, pub perm_write: SyncCell, - pub perm_exec: SyncCell, + pub perm_exec: SyncCell, // Progress - pub progress_label: SyncCell, + pub progress_label: SyncCell, pub progress_normal: SyncCell, - pub progress_error: SyncCell, + pub progress_error: SyncCell, } #[derive(Deserialize)] pub struct StatusSep { - pub open: String, + pub open: String, pub close: String, } @@ -175,7 +178,7 @@ pub struct Which { pub rest: SyncCell, pub desc: SyncCell, - pub separator: ArcSwap, + pub separator: ArcSwap, pub separator_style: SyncCell, } @@ -183,12 +186,12 @@ pub struct Which { #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Confirm { pub border: SyncCell, - pub title: SyncCell, - pub body: SyncCell, - pub list: SyncCell, + pub title: SyncCell, + pub body: SyncCell, + pub list: SyncCell, - pub btn_yes: SyncCell, - pub btn_no: SyncCell, + pub btn_yes: SyncCell, + pub btn_no: SyncCell, pub btn_labels: ArcSwap<[String; 2]>, } @@ -196,47 +199,47 @@ pub struct Confirm { #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Spot { pub border: SyncCell, - pub title: SyncCell, + pub title: SyncCell, - pub tbl_col: SyncCell, + pub tbl_col: SyncCell, pub tbl_cell: SyncCell, } // --- Notify #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Notify { - pub title_info: SyncCell, - pub title_warn: SyncCell, + pub title_info: SyncCell, + pub title_warn: SyncCell, pub title_error: SyncCell, - pub icon_info: ArcSwap, - pub icon_warn: ArcSwap, + pub icon_info: ArcSwap, + pub icon_warn: ArcSwap, pub icon_error: ArcSwap, } // --- Pick #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Pick { - pub border: SyncCell, - pub active: SyncCell, + pub border: SyncCell, + pub active: SyncCell, pub inactive: SyncCell, } // --- Input #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Input { - pub border: SyncCell, - pub title: SyncCell, - pub value: SyncCell, + pub border: SyncCell, + pub title: SyncCell, + pub value: SyncCell, pub selected: SyncCell, } impl From<&Input> for yazi_widgets::input::InputStyles { fn from(input: &Input) -> Self { Self { - normal: Some(input.value.get().into()), + normal: Some(input.value.get().into()), selected: Some(input.selected.get().into()), - blink: Some(YAZI.input.cursor_blink), + blink: Some(YAZI.input.cursor_blink), } } } @@ -244,29 +247,29 @@ impl From<&Input> for yazi_widgets::input::InputStyles { // --- Cmp #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Cmp { - pub border: SyncCell, - pub active: SyncCell, + pub border: SyncCell, + pub active: SyncCell, pub inactive: SyncCell, - pub icon_file: ArcSwap, - pub icon_folder: ArcSwap, + pub icon_file: ArcSwap, + pub icon_folder: ArcSwap, pub icon_command: ArcSwap, } // --- Tasks #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Tasks { - pub border: SyncCell, - pub title: SyncCell, + pub border: SyncCell, + pub title: SyncCell, pub hovered: SyncCell, } // --- Help #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Help { - pub border: SyncCell, - pub chord: SyncCell, - pub action: SyncCell, + pub border: SyncCell, + pub chord: SyncCell, + pub action: SyncCell, pub hovered: SyncCell, } diff --git a/yazi-plugin/preset/components/header.lua b/yazi-plugin/preset/components/header.lua index 494d06a4..c3f21b48 100644 --- a/yazi-plugin/preset/components/header.lua +++ b/yazi-plugin/preset/components/header.lua @@ -1,84 +1,90 @@ Header = { - -- TODO: remove these two constants - LEFT = 0, - RIGHT = 1, + -- TODO: remove these two constants + LEFT = 0, + RIGHT = 1, - _id = "header", - _inc = 1000, - _left = { - { "cwd", id = 1, order = 1000 }, - }, - _right = { - { "count", id = 1, order = 1000 }, - }, + _id = "header", + _inc = 1000, + _left = { + { "cwd", id = 1, order = 1000 }, + }, + _right = { + { "count", id = 1, order = 1000 }, + }, } function Header:new(area, tab) - return setmetatable({ - _area = area, - _tab = tab, - _current = tab.current, - }, { __index = self }) + return setmetatable({ + _area = area, + _tab = tab, + _current = tab.current, + }, { __index = self }) end function Header:cwd() - local max = self._area.w - self._right_width - if max <= 0 then - return "" - end + local max = self._area.w - self._right_width + if max <= 0 then + return "" + end - local s = ya.readable_path(tostring(self._current.cwd)) .. self:flags() - return ui.Span(ui.truncate(s, { max = max, rtl = true })):style(th.mgr.cwd) + local path = ya.readable_path(tostring(self._current.cwd)) + local flags = self:flags() + local flag_str = #flags == 0 and "" or " (" .. table.concat(flags, ", ") .. ")" + + return ui.Line { + ui.Span(ui.truncate(path, { max = max - #flag_str, rtl = true })):style(th.mgr.cwd), + ui.Span(flag_str):style(th.mgr.filter_keyword), + } end function Header:flags() - local cwd = self._current.cwd - local filter = self._current.files.filter - local finder = self._tab.finder + local cwd = self._current.cwd + local filter = self._current.files.filter + local finder = self._tab.finder - local t = {} - if cwd.is_search then - t[#t + 1] = string.format("search: %s", cwd.domain) - end - if filter then - t[#t + 1] = string.format("filter: %s", filter) - end - if finder then - t[#t + 1] = string.format("find: %s", finder) - end - return #t == 0 and "" or " (" .. table.concat(t, ", ") .. ")" + local t = {} + if cwd.is_search then + t[#t + 1] = string.format("search: %s", cwd.domain) + end + if filter then + t[#t + 1] = string.format("filter: %s", filter) + end + if finder then + t[#t + 1] = string.format("find: %s", finder) + end + return t end function Header:count() - local selected = #self._tab.selected - local yanked = selected > 0 and 0 or #cx.yanked + local selected = #self._tab.selected + local yanked = selected > 0 and 0 or #cx.yanked - local span - if selected > 0 then - span = ui.Span(" " .. selected .. " "):style(th.mgr.count_selected) - elseif yanked <= 0 then - return "" - elseif cx.yanked.is_cut then - span = ui.Span(" " .. yanked .. " "):style(th.mgr.count_cut) - else - span = ui.Span(" " .. yanked .. " "):style(th.mgr.count_copied) - end + local span + if selected > 0 then + span = ui.Span(" " .. selected .. " "):style(th.mgr.count_selected) + elseif yanked <= 0 then + return "" + elseif cx.yanked.is_cut then + span = ui.Span(" " .. yanked .. " "):style(th.mgr.count_cut) + else + span = ui.Span(" " .. yanked .. " "):style(th.mgr.count_copied) + end - return ui.Line { span, " " } + return ui.Line { span, " " } end function Header:reflow() return { self } end function Header:redraw() - local right = self:children_redraw(self.RIGHT) - self._right_width = right:width() + local right = self:children_redraw(self.RIGHT) + self._right_width = right:width() - local left = self:children_redraw(self.LEFT) + local left = self:children_redraw(self.LEFT) - return { - ui.Line(left):area(self._area), - ui.Line(right):area(self._area):align(ui.Align.RIGHT), - } + return { + ui.Line(left):area(self._area), + ui.Line(right):area(self._area):align(ui.Align.RIGHT), + } end -- Mouse events @@ -90,29 +96,29 @@ function Header:touch(event, step) end -- Children function Header:children_add(fn, order, side) - self._inc = self._inc + 1 - local children = side == self.RIGHT and self._right or self._left + self._inc = self._inc + 1 + local children = side == self.RIGHT and self._right or self._left - children[#children + 1] = { fn, id = self._inc, order = order } - table.sort(children, function(a, b) return a.order < b.order end) + children[#children + 1] = { fn, id = self._inc, order = order } + table.sort(children, function(a, b) return a.order < b.order end) - return self._inc + return self._inc end function Header:children_remove(id, side) - local children = side == self.RIGHT and self._right or self._left - for i, child in ipairs(children) do - if child.id == id then - table.remove(children, i) - break - end - end + local children = side == self.RIGHT and self._right or self._left + for i, child in ipairs(children) do + if child.id == id then + table.remove(children, i) + break + end + end end function Header:children_redraw(side) - local lines = {} - for _, c in ipairs(side == self.RIGHT and self._right or self._left) do - lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self) - end - return ui.Line(lines) + local lines = {} + for _, c in ipairs(side == self.RIGHT and self._right or self._left) do + lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self) + end + return ui.Line(lines) end diff --git a/yazi-plugin/preset/components/status.lua b/yazi-plugin/preset/components/status.lua index 377ae94c..9803566a 100644 --- a/yazi-plugin/preset/components/status.lua +++ b/yazi-plugin/preset/components/status.lua @@ -1,150 +1,150 @@ Status = { - -- TODO: remove these two constants - LEFT = 0, - RIGHT = 1, + -- TODO: remove these two constants + LEFT = 0, + RIGHT = 1, - _id = "status", - _inc = 1000, - _left = { - { "mode", id = 1, order = 1000 }, - { "length", id = 2, order = 2000 }, - { "name", id = 3, order = 3000 }, - }, - _right = { - { "perm", id = 4, order = 1000 }, - { "percent", id = 5, order = 2000 }, - { "position", id = 6, order = 3000 }, - }, + _id = "status", + _inc = 1000, + _left = { + { "mode", id = 1, order = 1000 }, + { "length", id = 2, order = 2000 }, + { "name", id = 3, order = 3000 }, + }, + _right = { + { "perm", id = 4, order = 1000 }, + { "percent", id = 5, order = 2000 }, + { "position", id = 6, order = 3000 }, + }, } function Status:new(area, tab) - return setmetatable({ - _area = area, - _tab = tab, - _current = tab.current, - }, { __index = self }) + return setmetatable({ + _area = area, + _tab = tab, + _current = tab.current, + }, { __index = self }) end function Status:style() - local m, s = th.mode, ui.Style():fg("reset"):bg("reset") - if self._tab.mode.is_select then - return { main = s:patch(m.select_main), alt = s:patch(m.select_alt) } - elseif self._tab.mode.is_unset then - return { main = s:patch(m.unset_main), alt = s:patch(m.unset_alt) } - else - return { main = s:patch(m.normal_main), alt = s:patch(m.normal_alt) } - end + local m, s = th.mode, ui.Style():fg("reset"):bg("reset") + if self._tab.mode.is_select then + return { main = s:patch(m.select_main), alt = s:patch(m.select_alt) } + elseif self._tab.mode.is_unset then + return { main = s:patch(m.unset_main), alt = s:patch(m.unset_alt) } + else + return { main = s:patch(m.normal_main), alt = s:patch(m.normal_alt) } + end end function Status:mode() - local mode = tostring(self._tab.mode):sub(1, 3):upper() + local mode = tostring(self._tab.mode):sub(1, 3):upper() - local style = self:style() - return ui.Line { - ui.Span(th.status.sep_left.open):fg(style.main:bg()):bg(App.bg()), - ui.Span(" " .. mode .. " "):style(style.main), - ui.Span(th.status.sep_left.close):fg(style.main:bg()):bg(style.alt:bg()), - } + local style = self:style() + return ui.Line { + ui.Span(th.status.sep_left.open):fg(style.main:bg()):bg(App.bg()), + ui.Span(" " .. mode .. " "):style(style.main), + ui.Span(th.status.sep_left.close):fg(style.main:bg()):bg(style.alt:bg()), + } end function Status:length() - local h = self._current.hovered - local len = h and h.cha.len or 0 + local h = self._current.hovered + local len = h and h.cha.len or 0 - local style = self:style() - return ui.Line { - ui.Span(" " .. ya.readable_size(len) .. " "):style(style.alt), - ui.Span(th.status.sep_left.close):fg(style.alt:bg()), - } + local style = self:style() + return ui.Line { + ui.Span(" " .. ya.readable_size(len) .. " "):style(style.alt), + ui.Span(th.status.sep_left.close):fg(style.alt:bg()), + } end function Status:name() - local h = self._current.hovered - if not h then - return "" - end + local h = self._current.hovered + if not h then + return "" + end - return " " .. ui.printable(h.name) + return " " .. ui.printable(h.name) end function Status:perm() - local h = self._current.hovered - if not h then - return "" - end + local h = self._current.hovered + if not h then + return "" + end - local perm = h.cha:perm() - if not perm then - return "" - end + local perm = h.cha:perm() + if not perm then + return "" + end - local spans = {} - for i = 1, #perm do - local c = perm:sub(i, i) - local style = th.status.perm_type - if c == "-" or c == "?" then - style = th.status.perm_sep - elseif c == "r" then - style = th.status.perm_read - elseif c == "w" then - style = th.status.perm_write - elseif c == "x" or c == "s" or c == "S" or c == "t" or c == "T" then - style = th.status.perm_exec - end - spans[i] = ui.Span(c):style(style) - end - return ui.Line(spans) + local spans = {} + for i = 1, #perm do + local c = perm:sub(i, i) + local style = th.status.perm_type + if c == "-" or c == "?" then + style = th.status.perm_sep + elseif c == "r" then + style = th.status.perm_read + elseif c == "w" then + style = th.status.perm_write + elseif c == "x" or c == "s" or c == "S" or c == "t" or c == "T" then + style = th.status.perm_exec + end + spans[i] = ui.Span(c):style(style) + end + return ui.Line(spans) end function Status:percent() - local percent = 0 - local cursor = self._current.cursor - local length = #self._current.files - if cursor ~= 0 and length ~= 0 then - percent = math.floor((cursor + 1) * 100 / length) - end + local percent = 0 + local cursor = self._current.cursor + local length = #self._current.files + if cursor ~= 0 and length ~= 0 then + percent = math.floor((cursor + 1) * 100 / length) + end - if percent == 0 then - percent = " Top " - elseif percent == 100 then - percent = " Bot " - else - percent = string.format(" %2d%% ", percent) - end + if percent == 0 then + percent = " Top " + elseif percent == 100 then + percent = " Bot " + else + percent = string.format(" %2d%% ", percent) + end - local style = self:style() - return ui.Line { - ui.Span(" " .. th.status.sep_right.open):fg(style.alt:bg()), - ui.Span(percent):style(style.alt), - } + local style = self:style() + return ui.Line { + ui.Span(" " .. th.status.sep_right.open):fg(style.alt:bg()), + ui.Span(percent):style(style.alt), + } end function Status:position() - local cursor = self._current.cursor - local length = #self._current.files + local cursor = self._current.cursor + local length = #self._current.files - local style = self:style() - return ui.Line { - ui.Span(th.status.sep_right.open):fg(style.main:bg()):bg(style.alt:bg()), - ui.Span(string.format(" %2d/%-2d ", math.min(cursor + 1, length), length)):style(style.main), - ui.Span(th.status.sep_right.close):fg(style.main:bg()):bg(App.bg()), - } + local style = self:style() + return ui.Line { + ui.Span(th.status.sep_right.open):fg(style.main:bg()):bg(style.alt:bg()), + ui.Span(string.format(" %2d/%-2d ", math.min(cursor + 1, length), length)):style(style.main), + ui.Span(th.status.sep_right.close):fg(style.main:bg()):bg(App.bg()), + } end function Status:reflow() return { self } end function Status:redraw() - local left = self:children_redraw(self.LEFT) + local left = self:children_redraw(self.LEFT) - local right = self:children_redraw(self.RIGHT) - local right_width = right:width() + local right = self:children_redraw(self.RIGHT) + local right_width = right:width() - return { - ui.Text(""):area(self._area):style(th.status.overall), - ui.Line(left):area(self._area), - ui.Line(right):area(self._area):align(ui.Align.RIGHT), - table.unpack(ui.redraw(Progress:new(self._area, right_width))), - } + return { + ui.Text(""):area(self._area):style(th.status.overall), + ui.Line(left):area(self._area), + ui.Line(right):area(self._area):align(ui.Align.RIGHT), + table.unpack(ui.redraw(Progress:new(self._area, right_width))), + } end -- Mouse events @@ -156,29 +156,29 @@ function Status:touch(event, step) end -- Children function Status:children_add(fn, order, side) - self._inc = self._inc + 1 - local children = side == self.RIGHT and self._right or self._left + self._inc = self._inc + 1 + local children = side == self.RIGHT and self._right or self._left - children[#children + 1] = { fn, id = self._inc, order = order } - table.sort(children, function(a, b) return a.order < b.order end) + children[#children + 1] = { fn, id = self._inc, order = order } + table.sort(children, function(a, b) return a.order < b.order end) - return self._inc + return self._inc end function Status:children_remove(id, side) - local children = side == self.RIGHT and self._right or self._left - for i, child in ipairs(children) do - if child.id == id then - table.remove(children, i) - break - end - end + local children = side == self.RIGHT and self._right or self._left + for i, child in ipairs(children) do + if child.id == id then + table.remove(children, i) + break + end + end end function Status:children_redraw(side) - local lines = {} - for _, c in ipairs(side == self.RIGHT and self._right or self._left) do - lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self) - end - return ui.Line(lines) + local lines = {} + for _, c in ipairs(side == self.RIGHT and self._right or self._left) do + lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self) + end + return ui.Line(lines) end diff --git a/yazi-plugin/src/theme/theme.rs b/yazi-plugin/src/theme/theme.rs index 8460b169..1ef70f97 100644 --- a/yazi-plugin/src/theme/theme.rs +++ b/yazi-plugin/src/theme/theme.rs @@ -28,12 +28,16 @@ pub fn compose() -> Composer { .into_lua(lua) } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } -pub fn reset() -> mlua::Result<()> { LUA.globals().raw_set("th", compose()) } +pub fn reset() -> mlua::Result<()> { + LUA.globals().raw_set("th", compose()) +} fn app() -> Composer { fn get(lua: &Lua, key: &[u8]) -> mlua::Result { @@ -45,7 +49,9 @@ fn app() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -59,6 +65,8 @@ fn mgr() -> Composer { b"find_keyword" => Style::from(&m.find_keyword).into_lua(lua), b"find_position" => Style::from(&m.find_position).into_lua(lua), + b"filter_keyword" => Style::from(&m.filter_keyword).into_lua(lua), + b"symlink_target" => Style::from(&m.symlink_target).into_lua(lua), b"marker_copied" => Style::from(&m.marker_copied).into_lua(lua), @@ -79,7 +87,9 @@ fn mgr() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -108,7 +118,9 @@ fn tabs() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -130,7 +142,9 @@ fn mode() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -153,7 +167,9 @@ fn indicator() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -190,7 +206,9 @@ fn status() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -212,7 +230,9 @@ fn which() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -239,7 +259,9 @@ fn confirm() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -258,7 +280,9 @@ fn spot() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -279,7 +303,9 @@ fn notify() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -296,7 +322,9 @@ fn pick() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -314,7 +342,9 @@ fn input() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -335,7 +365,9 @@ fn cmp() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -352,7 +384,9 @@ fn tasks() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } @@ -370,7 +404,9 @@ fn help() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { + Ok(value) + } Composer::new(get, set) } From 291504862b487b908377c674b9d2d30e9bfc88e4 Mon Sep 17 00:00:00 2001 From: Yahddyyp Date: Fri, 26 Jun 2026 19:39:51 +0530 Subject: [PATCH 2/9] Forgot stylua --- yazi-plugin/preset/components/header.lua | 156 +++++++++++------------ 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/yazi-plugin/preset/components/header.lua b/yazi-plugin/preset/components/header.lua index c3f21b48..394bd224 100644 --- a/yazi-plugin/preset/components/header.lua +++ b/yazi-plugin/preset/components/header.lua @@ -1,90 +1,90 @@ Header = { - -- TODO: remove these two constants - LEFT = 0, - RIGHT = 1, + -- TODO: remove these two constants + LEFT = 0, + RIGHT = 1, - _id = "header", - _inc = 1000, - _left = { - { "cwd", id = 1, order = 1000 }, - }, - _right = { - { "count", id = 1, order = 1000 }, - }, + _id = "header", + _inc = 1000, + _left = { + { "cwd", id = 1, order = 1000 }, + }, + _right = { + { "count", id = 1, order = 1000 }, + }, } function Header:new(area, tab) - return setmetatable({ - _area = area, - _tab = tab, - _current = tab.current, - }, { __index = self }) + return setmetatable({ + _area = area, + _tab = tab, + _current = tab.current, + }, { __index = self }) end function Header:cwd() - local max = self._area.w - self._right_width - if max <= 0 then - return "" - end + local max = self._area.w - self._right_width + if max <= 0 then + return "" + end - local path = ya.readable_path(tostring(self._current.cwd)) - local flags = self:flags() - local flag_str = #flags == 0 and "" or " (" .. table.concat(flags, ", ") .. ")" + local path = ya.readable_path(tostring(self._current.cwd)) + local flags = self:flags() + local flag_str = #flags == 0 and "" or " (" .. table.concat(flags, ", ") .. ")" - return ui.Line { - ui.Span(ui.truncate(path, { max = max - #flag_str, rtl = true })):style(th.mgr.cwd), - ui.Span(flag_str):style(th.mgr.filter_keyword), - } + return ui.Line { + ui.Span(ui.truncate(path, { max = max - #flag_str, rtl = true })):style(th.mgr.cwd), + ui.Span(flag_str):style(th.mgr.filter_keyword), + } end function Header:flags() - local cwd = self._current.cwd - local filter = self._current.files.filter - local finder = self._tab.finder + local cwd = self._current.cwd + local filter = self._current.files.filter + local finder = self._tab.finder - local t = {} - if cwd.is_search then - t[#t + 1] = string.format("search: %s", cwd.domain) - end - if filter then - t[#t + 1] = string.format("filter: %s", filter) - end - if finder then - t[#t + 1] = string.format("find: %s", finder) - end - return t + local t = {} + if cwd.is_search then + t[#t + 1] = string.format("search: %s", cwd.domain) + end + if filter then + t[#t + 1] = string.format("filter: %s", filter) + end + if finder then + t[#t + 1] = string.format("find: %s", finder) + end + return t end function Header:count() - local selected = #self._tab.selected - local yanked = selected > 0 and 0 or #cx.yanked + local selected = #self._tab.selected + local yanked = selected > 0 and 0 or #cx.yanked - local span - if selected > 0 then - span = ui.Span(" " .. selected .. " "):style(th.mgr.count_selected) - elseif yanked <= 0 then - return "" - elseif cx.yanked.is_cut then - span = ui.Span(" " .. yanked .. " "):style(th.mgr.count_cut) - else - span = ui.Span(" " .. yanked .. " "):style(th.mgr.count_copied) - end + local span + if selected > 0 then + span = ui.Span(" " .. selected .. " "):style(th.mgr.count_selected) + elseif yanked <= 0 then + return "" + elseif cx.yanked.is_cut then + span = ui.Span(" " .. yanked .. " "):style(th.mgr.count_cut) + else + span = ui.Span(" " .. yanked .. " "):style(th.mgr.count_copied) + end - return ui.Line { span, " " } + return ui.Line { span, " " } end function Header:reflow() return { self } end function Header:redraw() - local right = self:children_redraw(self.RIGHT) - self._right_width = right:width() + local right = self:children_redraw(self.RIGHT) + self._right_width = right:width() - local left = self:children_redraw(self.LEFT) + local left = self:children_redraw(self.LEFT) - return { - ui.Line(left):area(self._area), - ui.Line(right):area(self._area):align(ui.Align.RIGHT), - } + return { + ui.Line(left):area(self._area), + ui.Line(right):area(self._area):align(ui.Align.RIGHT), + } end -- Mouse events @@ -96,29 +96,29 @@ function Header:touch(event, step) end -- Children function Header:children_add(fn, order, side) - self._inc = self._inc + 1 - local children = side == self.RIGHT and self._right or self._left + self._inc = self._inc + 1 + local children = side == self.RIGHT and self._right or self._left - children[#children + 1] = { fn, id = self._inc, order = order } - table.sort(children, function(a, b) return a.order < b.order end) + children[#children + 1] = { fn, id = self._inc, order = order } + table.sort(children, function(a, b) return a.order < b.order end) - return self._inc + return self._inc end function Header:children_remove(id, side) - local children = side == self.RIGHT and self._right or self._left - for i, child in ipairs(children) do - if child.id == id then - table.remove(children, i) - break - end - end + local children = side == self.RIGHT and self._right or self._left + for i, child in ipairs(children) do + if child.id == id then + table.remove(children, i) + break + end + end end function Header:children_redraw(side) - local lines = {} - for _, c in ipairs(side == self.RIGHT and self._right or self._left) do - lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self) - end - return ui.Line(lines) + local lines = {} + for _, c in ipairs(side == self.RIGHT and self._right or self._left) do + lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self) + end + return ui.Line(lines) end From 19e2dab18d49c896bac11ff855a9a3687faf6afe Mon Sep 17 00:00:00 2001 From: Yahddyyp Date: Fri, 26 Jun 2026 19:44:37 +0530 Subject: [PATCH 3/9] Fixed up formatting for stylua --- yazi-plugin/preset/components/status.lua | 246 +++++++++++------------ 1 file changed, 123 insertions(+), 123 deletions(-) diff --git a/yazi-plugin/preset/components/status.lua b/yazi-plugin/preset/components/status.lua index 9803566a..377ae94c 100644 --- a/yazi-plugin/preset/components/status.lua +++ b/yazi-plugin/preset/components/status.lua @@ -1,150 +1,150 @@ Status = { - -- TODO: remove these two constants - LEFT = 0, - RIGHT = 1, + -- TODO: remove these two constants + LEFT = 0, + RIGHT = 1, - _id = "status", - _inc = 1000, - _left = { - { "mode", id = 1, order = 1000 }, - { "length", id = 2, order = 2000 }, - { "name", id = 3, order = 3000 }, - }, - _right = { - { "perm", id = 4, order = 1000 }, - { "percent", id = 5, order = 2000 }, - { "position", id = 6, order = 3000 }, - }, + _id = "status", + _inc = 1000, + _left = { + { "mode", id = 1, order = 1000 }, + { "length", id = 2, order = 2000 }, + { "name", id = 3, order = 3000 }, + }, + _right = { + { "perm", id = 4, order = 1000 }, + { "percent", id = 5, order = 2000 }, + { "position", id = 6, order = 3000 }, + }, } function Status:new(area, tab) - return setmetatable({ - _area = area, - _tab = tab, - _current = tab.current, - }, { __index = self }) + return setmetatable({ + _area = area, + _tab = tab, + _current = tab.current, + }, { __index = self }) end function Status:style() - local m, s = th.mode, ui.Style():fg("reset"):bg("reset") - if self._tab.mode.is_select then - return { main = s:patch(m.select_main), alt = s:patch(m.select_alt) } - elseif self._tab.mode.is_unset then - return { main = s:patch(m.unset_main), alt = s:patch(m.unset_alt) } - else - return { main = s:patch(m.normal_main), alt = s:patch(m.normal_alt) } - end + local m, s = th.mode, ui.Style():fg("reset"):bg("reset") + if self._tab.mode.is_select then + return { main = s:patch(m.select_main), alt = s:patch(m.select_alt) } + elseif self._tab.mode.is_unset then + return { main = s:patch(m.unset_main), alt = s:patch(m.unset_alt) } + else + return { main = s:patch(m.normal_main), alt = s:patch(m.normal_alt) } + end end function Status:mode() - local mode = tostring(self._tab.mode):sub(1, 3):upper() + local mode = tostring(self._tab.mode):sub(1, 3):upper() - local style = self:style() - return ui.Line { - ui.Span(th.status.sep_left.open):fg(style.main:bg()):bg(App.bg()), - ui.Span(" " .. mode .. " "):style(style.main), - ui.Span(th.status.sep_left.close):fg(style.main:bg()):bg(style.alt:bg()), - } + local style = self:style() + return ui.Line { + ui.Span(th.status.sep_left.open):fg(style.main:bg()):bg(App.bg()), + ui.Span(" " .. mode .. " "):style(style.main), + ui.Span(th.status.sep_left.close):fg(style.main:bg()):bg(style.alt:bg()), + } end function Status:length() - local h = self._current.hovered - local len = h and h.cha.len or 0 + local h = self._current.hovered + local len = h and h.cha.len or 0 - local style = self:style() - return ui.Line { - ui.Span(" " .. ya.readable_size(len) .. " "):style(style.alt), - ui.Span(th.status.sep_left.close):fg(style.alt:bg()), - } + local style = self:style() + return ui.Line { + ui.Span(" " .. ya.readable_size(len) .. " "):style(style.alt), + ui.Span(th.status.sep_left.close):fg(style.alt:bg()), + } end function Status:name() - local h = self._current.hovered - if not h then - return "" - end + local h = self._current.hovered + if not h then + return "" + end - return " " .. ui.printable(h.name) + return " " .. ui.printable(h.name) end function Status:perm() - local h = self._current.hovered - if not h then - return "" - end + local h = self._current.hovered + if not h then + return "" + end - local perm = h.cha:perm() - if not perm then - return "" - end + local perm = h.cha:perm() + if not perm then + return "" + end - local spans = {} - for i = 1, #perm do - local c = perm:sub(i, i) - local style = th.status.perm_type - if c == "-" or c == "?" then - style = th.status.perm_sep - elseif c == "r" then - style = th.status.perm_read - elseif c == "w" then - style = th.status.perm_write - elseif c == "x" or c == "s" or c == "S" or c == "t" or c == "T" then - style = th.status.perm_exec - end - spans[i] = ui.Span(c):style(style) - end - return ui.Line(spans) + local spans = {} + for i = 1, #perm do + local c = perm:sub(i, i) + local style = th.status.perm_type + if c == "-" or c == "?" then + style = th.status.perm_sep + elseif c == "r" then + style = th.status.perm_read + elseif c == "w" then + style = th.status.perm_write + elseif c == "x" or c == "s" or c == "S" or c == "t" or c == "T" then + style = th.status.perm_exec + end + spans[i] = ui.Span(c):style(style) + end + return ui.Line(spans) end function Status:percent() - local percent = 0 - local cursor = self._current.cursor - local length = #self._current.files - if cursor ~= 0 and length ~= 0 then - percent = math.floor((cursor + 1) * 100 / length) - end + local percent = 0 + local cursor = self._current.cursor + local length = #self._current.files + if cursor ~= 0 and length ~= 0 then + percent = math.floor((cursor + 1) * 100 / length) + end - if percent == 0 then - percent = " Top " - elseif percent == 100 then - percent = " Bot " - else - percent = string.format(" %2d%% ", percent) - end + if percent == 0 then + percent = " Top " + elseif percent == 100 then + percent = " Bot " + else + percent = string.format(" %2d%% ", percent) + end - local style = self:style() - return ui.Line { - ui.Span(" " .. th.status.sep_right.open):fg(style.alt:bg()), - ui.Span(percent):style(style.alt), - } + local style = self:style() + return ui.Line { + ui.Span(" " .. th.status.sep_right.open):fg(style.alt:bg()), + ui.Span(percent):style(style.alt), + } end function Status:position() - local cursor = self._current.cursor - local length = #self._current.files + local cursor = self._current.cursor + local length = #self._current.files - local style = self:style() - return ui.Line { - ui.Span(th.status.sep_right.open):fg(style.main:bg()):bg(style.alt:bg()), - ui.Span(string.format(" %2d/%-2d ", math.min(cursor + 1, length), length)):style(style.main), - ui.Span(th.status.sep_right.close):fg(style.main:bg()):bg(App.bg()), - } + local style = self:style() + return ui.Line { + ui.Span(th.status.sep_right.open):fg(style.main:bg()):bg(style.alt:bg()), + ui.Span(string.format(" %2d/%-2d ", math.min(cursor + 1, length), length)):style(style.main), + ui.Span(th.status.sep_right.close):fg(style.main:bg()):bg(App.bg()), + } end function Status:reflow() return { self } end function Status:redraw() - local left = self:children_redraw(self.LEFT) + local left = self:children_redraw(self.LEFT) - local right = self:children_redraw(self.RIGHT) - local right_width = right:width() + local right = self:children_redraw(self.RIGHT) + local right_width = right:width() - return { - ui.Text(""):area(self._area):style(th.status.overall), - ui.Line(left):area(self._area), - ui.Line(right):area(self._area):align(ui.Align.RIGHT), - table.unpack(ui.redraw(Progress:new(self._area, right_width))), - } + return { + ui.Text(""):area(self._area):style(th.status.overall), + ui.Line(left):area(self._area), + ui.Line(right):area(self._area):align(ui.Align.RIGHT), + table.unpack(ui.redraw(Progress:new(self._area, right_width))), + } end -- Mouse events @@ -156,29 +156,29 @@ function Status:touch(event, step) end -- Children function Status:children_add(fn, order, side) - self._inc = self._inc + 1 - local children = side == self.RIGHT and self._right or self._left + self._inc = self._inc + 1 + local children = side == self.RIGHT and self._right or self._left - children[#children + 1] = { fn, id = self._inc, order = order } - table.sort(children, function(a, b) return a.order < b.order end) + children[#children + 1] = { fn, id = self._inc, order = order } + table.sort(children, function(a, b) return a.order < b.order end) - return self._inc + return self._inc end function Status:children_remove(id, side) - local children = side == self.RIGHT and self._right or self._left - for i, child in ipairs(children) do - if child.id == id then - table.remove(children, i) - break - end - end + local children = side == self.RIGHT and self._right or self._left + for i, child in ipairs(children) do + if child.id == id then + table.remove(children, i) + break + end + end end function Status:children_redraw(side) - local lines = {} - for _, c in ipairs(side == self.RIGHT and self._right or self._left) do - lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self) - end - return ui.Line(lines) + local lines = {} + for _, c in ipairs(side == self.RIGHT and self._right or self._left) do + lines[#lines + 1] = (type(c[1]) == "string" and self[c[1]] or c[1])(self) + end + return ui.Line(lines) end From 3ddd9f7f6a9fbdd7bb10dc67c4d07a3a7921907a Mon Sep 17 00:00:00 2001 From: Yahddyyp Date: Sat, 27 Jun 2026 15:36:28 +0530 Subject: [PATCH 4/9] fix: formatting --- yazi-config/src/theme/theme.rs | 134 ++++++++++++++++----------------- yazi-plugin/src/theme/theme.rs | 51 +++++-------- 2 files changed, 84 insertions(+), 101 deletions(-) diff --git a/yazi-config/src/theme/theme.rs b/yazi-config/src/theme/theme.rs index c26b6461..ebae81a5 100644 --- a/yazi-config/src/theme/theme.rs +++ b/yazi-config/src/theme/theme.rs @@ -13,26 +13,26 @@ use crate::YAZI; #[derive(Deserialize, DeserializeOver, DeserializeOver1, Overlay)] pub struct Theme { - pub flavor: Flavor, - pub app: App, - pub mgr: Mgr, - pub tabs: Tabs, - pub mode: Mode, + pub flavor: Flavor, + pub app: App, + pub mgr: Mgr, + pub tabs: Tabs, + pub mode: Mode, pub indicator: Indicator, - pub status: Status, - pub which: Which, - pub confirm: Confirm, - pub spot: Spot, - pub notify: Notify, - pub pick: Pick, - pub input: Input, - pub cmp: Cmp, - pub tasks: Tasks, - pub help: Help, + pub status: Status, + pub which: Which, + pub confirm: Confirm, + pub spot: Spot, + pub notify: Notify, + pub pick: Pick, + pub input: Input, + pub cmp: Cmp, + pub tasks: Tasks, + pub help: Help, // File-specific styles pub filetype: Filetype, - pub icon: Icon, + pub icon: Icon, // User-defined custom sections #[serde(flatten, default)] @@ -68,7 +68,7 @@ pub struct Mgr { pub cwd: SyncCell, // Find - pub find_keyword: SyncCell, + pub find_keyword: SyncCell, pub find_position: SyncCell, // Filter @@ -78,11 +78,11 @@ pub struct Mgr { pub symlink_target: SyncCell, // Marker - pub marker_copied: SyncCell, - pub marker_cut: SyncCell, - pub marker_marked: SyncCell, + pub marker_copied: SyncCell, + pub marker_cut: SyncCell, + pub marker_marked: SyncCell, pub marker_selected: SyncCell, - pub marker_symbol: ArcSwap, + pub marker_symbol: ArcSwap, // Count pub count_copied: SyncCell, @@ -91,7 +91,7 @@ pub struct Mgr { // Border pub border_symbol: ArcSwap, - pub border_style: SyncCell, + pub border_style: SyncCell, // Highlighting #[serde(deserialize_with = "deserialize_syntect_theme")] @@ -101,7 +101,7 @@ pub struct Mgr { // --- Tabs #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Tabs { - pub active: SyncCell, + pub active: SyncCell, pub inactive: SyncCell, pub sep_inner: ArcSwap, @@ -110,7 +110,7 @@ pub struct Tabs { #[derive(Deserialize)] pub struct TabsSep { - pub open: String, + pub open: String, pub close: String, } @@ -118,19 +118,19 @@ pub struct TabsSep { #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Mode { pub normal_main: SyncCell, - pub normal_alt: SyncCell, + pub normal_alt: SyncCell, pub select_main: SyncCell, - pub select_alt: SyncCell, + pub select_alt: SyncCell, - pub unset_main: SyncCell, - pub unset_alt: SyncCell, + pub unset_main: SyncCell, + pub unset_alt: SyncCell, } // --- Indicator #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Indicator { - pub parent: SyncCell, + pub parent: SyncCell, pub current: SyncCell, pub preview: SyncCell, pub padding: ArcSwap, @@ -138,33 +138,33 @@ pub struct Indicator { #[derive(Deserialize)] pub struct IndicatorPadding { - pub open: String, + pub open: String, pub close: String, } // --- Status #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Status { - pub overall: SyncCell, - pub sep_left: ArcSwap, + pub overall: SyncCell, + pub sep_left: ArcSwap, pub sep_right: ArcSwap, // Permissions - pub perm_sep: SyncCell, - pub perm_type: SyncCell, - pub perm_read: SyncCell, + pub perm_sep: SyncCell, + pub perm_type: SyncCell, + pub perm_read: SyncCell, pub perm_write: SyncCell, - pub perm_exec: SyncCell, + pub perm_exec: SyncCell, // Progress - pub progress_label: SyncCell, + pub progress_label: SyncCell, pub progress_normal: SyncCell, - pub progress_error: SyncCell, + pub progress_error: SyncCell, } #[derive(Deserialize)] pub struct StatusSep { - pub open: String, + pub open: String, pub close: String, } @@ -178,7 +178,7 @@ pub struct Which { pub rest: SyncCell, pub desc: SyncCell, - pub separator: ArcSwap, + pub separator: ArcSwap, pub separator_style: SyncCell, } @@ -186,12 +186,12 @@ pub struct Which { #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Confirm { pub border: SyncCell, - pub title: SyncCell, - pub body: SyncCell, - pub list: SyncCell, + pub title: SyncCell, + pub body: SyncCell, + pub list: SyncCell, - pub btn_yes: SyncCell, - pub btn_no: SyncCell, + pub btn_yes: SyncCell, + pub btn_no: SyncCell, pub btn_labels: ArcSwap<[String; 2]>, } @@ -199,47 +199,47 @@ pub struct Confirm { #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Spot { pub border: SyncCell, - pub title: SyncCell, + pub title: SyncCell, - pub tbl_col: SyncCell, + pub tbl_col: SyncCell, pub tbl_cell: SyncCell, } // --- Notify #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Notify { - pub title_info: SyncCell, - pub title_warn: SyncCell, + pub title_info: SyncCell, + pub title_warn: SyncCell, pub title_error: SyncCell, - pub icon_info: ArcSwap, - pub icon_warn: ArcSwap, + pub icon_info: ArcSwap, + pub icon_warn: ArcSwap, pub icon_error: ArcSwap, } // --- Pick #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Pick { - pub border: SyncCell, - pub active: SyncCell, + pub border: SyncCell, + pub active: SyncCell, pub inactive: SyncCell, } // --- Input #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Input { - pub border: SyncCell, - pub title: SyncCell, - pub value: SyncCell, + pub border: SyncCell, + pub title: SyncCell, + pub value: SyncCell, pub selected: SyncCell, } impl From<&Input> for yazi_widgets::input::InputStyles { fn from(input: &Input) -> Self { Self { - normal: Some(input.value.get().into()), + normal: Some(input.value.get().into()), selected: Some(input.selected.get().into()), - blink: Some(YAZI.input.cursor_blink), + blink: Some(YAZI.input.cursor_blink), } } } @@ -247,29 +247,29 @@ impl From<&Input> for yazi_widgets::input::InputStyles { // --- Cmp #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Cmp { - pub border: SyncCell, - pub active: SyncCell, + pub border: SyncCell, + pub active: SyncCell, pub inactive: SyncCell, - pub icon_file: ArcSwap, - pub icon_folder: ArcSwap, + pub icon_file: ArcSwap, + pub icon_folder: ArcSwap, pub icon_command: ArcSwap, } // --- Tasks #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Tasks { - pub border: SyncCell, - pub title: SyncCell, + pub border: SyncCell, + pub title: SyncCell, pub hovered: SyncCell, } // --- Help #[derive(Deserialize, DeserializeOver, DeserializeOver2, Overlay)] pub struct Help { - pub border: SyncCell, - pub chord: SyncCell, - pub action: SyncCell, + pub border: SyncCell, + pub chord: SyncCell, + pub action: SyncCell, pub hovered: SyncCell, } diff --git a/yazi-plugin/src/theme/theme.rs b/yazi-plugin/src/theme/theme.rs index 1ef70f97..e74bdf32 100644 --- a/yazi-plugin/src/theme/theme.rs +++ b/yazi-plugin/src/theme/theme.rs @@ -29,15 +29,13 @@ pub fn compose() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } pub fn reset() -> mlua::Result<()> { - LUA.globals().raw_set("th", compose()) -} + LUA.globals().raw_set("th", compose()) } fn app() -> Composer { fn get(lua: &Lua, key: &[u8]) -> mlua::Result { @@ -50,8 +48,7 @@ fn app() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -88,8 +85,7 @@ fn mgr() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -119,8 +115,7 @@ fn tabs() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -143,8 +138,7 @@ fn mode() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -168,8 +162,7 @@ fn indicator() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -207,8 +200,7 @@ fn status() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -231,8 +223,7 @@ fn which() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -260,8 +251,7 @@ fn confirm() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -281,8 +271,7 @@ fn spot() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -304,8 +293,7 @@ fn notify() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -323,8 +311,7 @@ fn pick() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -343,8 +330,7 @@ fn input() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -366,8 +352,7 @@ fn cmp() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -385,8 +370,7 @@ fn tasks() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } @@ -405,8 +389,7 @@ fn help() -> Composer { } fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) - } + Ok(value) } Composer::new(get, set) } From 2018764f260d421024637c730396dd5ab68162e2 Mon Sep 17 00:00:00 2001 From: Yahddyyp Date: Sat, 27 Jun 2026 15:44:27 +0530 Subject: [PATCH 5/9] fix: made fn set be in one line for rustfmt --- yazi-plugin/src/theme/theme.rs | 48 ++++++++++++---------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/yazi-plugin/src/theme/theme.rs b/yazi-plugin/src/theme/theme.rs index e74bdf32..98da89be 100644 --- a/yazi-plugin/src/theme/theme.rs +++ b/yazi-plugin/src/theme/theme.rs @@ -28,8 +28,7 @@ pub fn compose() -> Composer { .into_lua(lua) } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -47,8 +46,7 @@ fn app() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -84,8 +82,7 @@ fn mgr() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -114,8 +111,7 @@ fn tabs() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -137,8 +133,7 @@ fn mode() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -161,8 +156,7 @@ fn indicator() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -199,8 +193,7 @@ fn status() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -222,8 +215,7 @@ fn which() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -250,8 +242,7 @@ fn confirm() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -270,8 +261,7 @@ fn spot() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -292,8 +282,7 @@ fn notify() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -310,8 +299,7 @@ fn pick() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -329,8 +317,7 @@ fn input() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -351,8 +338,7 @@ fn cmp() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -369,8 +355,7 @@ fn tasks() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } @@ -388,8 +373,7 @@ fn help() -> Composer { } } - fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { - Ok(value) } + fn set(_: &Lua, _: &[u8], value: Value) -> mlua::Result { Ok(value) } Composer::new(get, set) } From b60b81c7860b56f6116f396153889a73052cdffd Mon Sep 17 00:00:00 2001 From: Yahddyyp Date: Sat, 27 Jun 2026 15:47:12 +0530 Subject: [PATCH 6/9] fix: made fn reset be in one line --- yazi-plugin/src/theme/theme.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yazi-plugin/src/theme/theme.rs b/yazi-plugin/src/theme/theme.rs index 98da89be..aeffe051 100644 --- a/yazi-plugin/src/theme/theme.rs +++ b/yazi-plugin/src/theme/theme.rs @@ -33,8 +33,7 @@ pub fn compose() -> Composer { Composer::new(get, set) } -pub fn reset() -> mlua::Result<()> { - LUA.globals().raw_set("th", compose()) } +pub fn reset() -> mlua::Result<()> { LUA.globals().raw_set("th", compose()) } fn app() -> Composer { fn get(lua: &Lua, key: &[u8]) -> mlua::Result { From 61da95ef5c79ef352c739dbfefac8d1bcd30a12f Mon Sep 17 00:00:00 2001 From: Yahddyyp Date: Sat, 27 Jun 2026 15:57:48 +0530 Subject: [PATCH 7/9] Spacing --- yazi-config/src/theme/theme.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/yazi-config/src/theme/theme.rs b/yazi-config/src/theme/theme.rs index ebae81a5..68b30fa1 100644 --- a/yazi-config/src/theme/theme.rs +++ b/yazi-config/src/theme/theme.rs @@ -13,22 +13,22 @@ use crate::YAZI; #[derive(Deserialize, DeserializeOver, DeserializeOver1, Overlay)] pub struct Theme { - pub flavor: Flavor, - pub app: App, - pub mgr: Mgr, - pub tabs: Tabs, - pub mode: Mode, + pub flavor: Flavor, + pub app: App, + pub mgr: Mgr, + pub tabs: Tabs, + pub mode: Mode, pub indicator: Indicator, - pub status: Status, - pub which: Which, - pub confirm: Confirm, - pub spot: Spot, - pub notify: Notify, - pub pick: Pick, - pub input: Input, - pub cmp: Cmp, - pub tasks: Tasks, - pub help: Help, + pub status: Status, + pub which: Which, + pub confirm: Confirm, + pub spot: Spot, + pub notify: Notify, + pub pick: Pick, + pub input: Input, + pub cmp: Cmp, + pub tasks: Tasks, + pub help: Help, // File-specific styles pub filetype: Filetype, @@ -85,8 +85,8 @@ pub struct Mgr { pub marker_symbol: ArcSwap, // Count - pub count_copied: SyncCell, - pub count_cut: SyncCell, + pub count_copied: SyncCell, + pub count_cut: SyncCell, pub count_selected: SyncCell, // Border From d2f36e8b2b0b8da456dae406bb8fdb216bc35655 Mon Sep 17 00:00:00 2001 From: Yahddyyp Date: Sat, 27 Jun 2026 15:59:38 +0530 Subject: [PATCH 8/9] spacing --- yazi-config/preset/theme-dark.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/yazi-config/preset/theme-dark.toml b/yazi-config/preset/theme-dark.toml index dae7686b..9891a12c 100644 --- a/yazi-config/preset/theme-dark.toml +++ b/yazi-config/preset/theme-dark.toml @@ -15,6 +15,7 @@ light = "" # : }}} + # : App {{{ [app] From 61a2817f992d6430da68e82f937a3ef1f4e7edad Mon Sep 17 00:00:00 2001 From: Yahddyyp Date: Sat, 27 Jun 2026 16:06:39 +0530 Subject: [PATCH 9/9] Formatting --- yazi-config/src/theme/theme.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yazi-config/src/theme/theme.rs b/yazi-config/src/theme/theme.rs index 68b30fa1..2adb34fd 100644 --- a/yazi-config/src/theme/theme.rs +++ b/yazi-config/src/theme/theme.rs @@ -123,8 +123,8 @@ pub struct Mode { pub select_main: SyncCell, pub select_alt: SyncCell, - pub unset_main: SyncCell, - pub unset_alt: SyncCell, + pub unset_main: SyncCell, + pub unset_alt: SyncCell, } // --- Indicator