Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: enhance status line separator configuration #2313

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions yazi-config/preset/theme-dark.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,8 @@ unset_alt = { fg = "red", bg = "gray" }
# : Status bar {{{

[status]
separator_open = ""
separator_close = ""

# Progress
progress_label = { bold = true }
progress_normal = { fg = "blue", bg = "black" }
progress_error = { fg = "red", bg = "black" }
sep_left = { open = "", close = "" }
sep_right = { open = "", close = "" }

# Permissions
perm_sep = { fg = "darkgray" }
Expand All @@ -91,6 +86,11 @@ perm_read = { fg = "yellow" }
perm_write = { fg = "red" }
perm_exec = { fg = "cyan" }

# Progress
progress_label = { bold = true }
progress_normal = { fg = "blue", bg = "black" }
progress_error = { fg = "red", bg = "black" }

# : }}}


Expand Down
14 changes: 7 additions & 7 deletions yazi-config/preset/theme-light.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,8 @@ unset_alt = { fg = "red", bg = "gray" }
# : Status bar {{{

[status]
separator_open = ""
separator_close = ""

# Progress
progress_label = { bold = true }
progress_normal = { fg = "blue", bg = "black" }
progress_error = { fg = "red", bg = "black" }
sep_left = { open = "", close = "" }
sep_right = { open = "", close = "" }

# Permissions
perm_sep = { fg = "darkgray" }
Expand All @@ -91,6 +86,11 @@ perm_read = { fg = "yellow" }
perm_write = { fg = "red" }
perm_exec = { fg = "cyan" }

# Progress
progress_label = { bold = true }
progress_normal = { fg = "blue", bg = "black" }
progress_error = { fg = "red", bg = "black" }

# : }}}


Expand Down
20 changes: 13 additions & 7 deletions yazi-config/src/theme/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,26 @@ struct Mode {

#[derive(Deserialize, Serialize)]
struct Status {
pub separator_open: String,
pub separator_close: String,

// Progress
pub progress_label: Style,
pub progress_normal: Style,
pub progress_error: Style,
pub sep_left: StatusSep,
pub sep_right: StatusSep,

// Permissions
pub perm_sep: Style,
pub perm_type: Style,
pub perm_read: Style,
pub perm_write: Style,
pub perm_exec: Style,

// Progress
pub progress_label: Style,
pub progress_normal: Style,
pub progress_error: Style,
}

#[derive(Deserialize, Serialize)]
struct StatusSep {
pub open: String,
pub close: String,
}

#[derive(Deserialize, Serialize, Validate)]
Expand Down
12 changes: 6 additions & 6 deletions yazi-plugin/preset/components/status.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ function Status:mode()

local style = self:style()
return ui.Line {
ui.Span(THEME.status.separator_open):fg(style.main.bg),
ui.Span(THEME.status.sep_left.open):fg(style.main.bg),
ui.Span(" " .. mode .. " "):style(style.main),
ui.Span(THEME.status.separator_close):fg(style.main.bg):bg(style.alt.bg),
ui.Span(THEME.status.sep_left.close):fg(style.main.bg):bg(style.alt.bg),
}
end

Expand All @@ -55,7 +55,7 @@ function Status:size()
local style = self:style()
return ui.Line {
ui.Span(" " .. ya.readable_size(h:size() or h.cha.len) .. " "):style(style.alt),
ui.Span(THEME.status.separator_close):fg(style.alt.bg),
ui.Span(THEME.status.sep_left.close):fg(style.alt.bg),
}
end

Expand Down Expand Up @@ -115,7 +115,7 @@ function Status:percent()

local style = self:style()
return ui.Line {
ui.Span(" " .. THEME.status.separator_open):fg(style.alt.bg),
ui.Span(" " .. THEME.status.sep_right.open):fg(style.alt.bg),
ui.Span(percent):style(style.alt),
}
end
Expand All @@ -126,9 +126,9 @@ function Status:position()

local style = self:style()
return ui.Line {
ui.Span(THEME.status.separator_open):fg(style.main.bg):bg(style.alt.bg),
ui.Span(THEME.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(THEME.status.separator_close):fg(style.main.bg),
ui.Span(THEME.status.sep_right.close):fg(style.main.bg),
}
end

Expand Down
Loading