Compare commits
No commits in common. "159346814bd18497daa38ce45b04a7d5d7b6b003" and "2d311af09f021913f61bc36318cd87b5acd25f40" have entirely different histories.
159346814b
...
2d311af09f
2 changed files with 131 additions and 155 deletions
|
@ -1,4 +1,4 @@
|
||||||
local wezterm = require("wezterm")
|
local wezterm = require('wezterm')
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
|
|
||||||
|
@ -6,16 +6,16 @@ local config = {
|
||||||
webgpu_preferred_adapter = {
|
webgpu_preferred_adapter = {
|
||||||
backend = "Vulkan",
|
backend = "Vulkan",
|
||||||
device_type = "DiscreteGpu",
|
device_type = "DiscreteGpu",
|
||||||
name = "NVIDIA GeForce GTX 1070 Ti",
|
name = "NVIDIA GeForce GTX 1070 Ti"
|
||||||
},
|
},
|
||||||
enable_wayland = false,
|
enable_wayland = false,
|
||||||
font = wezterm.font("Monaspace Krypton"),
|
font = wezterm.font 'Monaspace Krypton',
|
||||||
font_size = 12.0,
|
font_size = 12.0,
|
||||||
window_background_opacity = 0.6,
|
window_background_opacity = 0.6,
|
||||||
text_background_opacity = 1.0,
|
text_background_opacity = 1.0,
|
||||||
enable_tab_bar = false,
|
enable_tab_bar = false,
|
||||||
color_scheme = "tokyonight",
|
color_scheme = 'tokyonight',
|
||||||
window_padding = { top = 20, bottom = 20, left = 20, right = 20 },
|
window_padding = {top = 20, bottom = 20, left = 20, right = 20}
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
|
@ -1,32 +1,25 @@
|
||||||
function Manager:render(area)
|
function Manager:render(area)
|
||||||
self.area = area
|
self.area = area
|
||||||
|
|
||||||
local chunks = ui.Layout()
|
local chunks = ui.Layout():direction(ui.Layout.HORIZONTAL):constraints({
|
||||||
:direction(ui.Layout.HORIZONTAL)
|
|
||||||
:constraints({
|
|
||||||
ui.Constraint.Ratio(MANAGER.ratio.parent, MANAGER.ratio.all),
|
ui.Constraint.Ratio(MANAGER.ratio.parent, MANAGER.ratio.all),
|
||||||
ui.Constraint.Ratio(MANAGER.ratio.current, MANAGER.ratio.all),
|
ui.Constraint.Ratio(MANAGER.ratio.current, MANAGER.ratio.all),
|
||||||
ui.Constraint.Ratio(MANAGER.ratio.preview, MANAGER.ratio.all),
|
ui.Constraint.Ratio(MANAGER.ratio.preview, MANAGER.ratio.all)
|
||||||
})
|
}):split(area)
|
||||||
:split(area)
|
|
||||||
|
|
||||||
local bar = function(c, x, y)
|
local bar = function(c, x, y)
|
||||||
return ui.Bar(
|
return ui.Bar(ui.Rect {
|
||||||
ui.Rect({
|
|
||||||
x = math.max(0, x),
|
x = math.max(0, x),
|
||||||
y = math.max(0, y),
|
y = math.max(0, y),
|
||||||
w = math.min(1, area.w),
|
w = math.min(1, area.w),
|
||||||
h = math.min(1, area.h),
|
h = math.min(1, area.h)
|
||||||
}),
|
}, ui.Bar.TOP):symbol(c)
|
||||||
ui.Bar.TOP
|
|
||||||
):symbol(c)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return ya.flat({
|
return ya.flat {
|
||||||
-- Borders
|
-- Borders
|
||||||
ui.Border(area, ui.Border.ALL):type(ui.Border.ROUNDED),
|
ui.Border(area, ui.Border.ALL):type(ui.Border.ROUNDED),
|
||||||
ui.Bar(chunks[1], ui.Bar.RIGHT),
|
ui.Bar(chunks[1], ui.Bar.RIGHT), ui.Bar(chunks[3], ui.Bar.LEFT),
|
||||||
ui.Bar(chunks[3], ui.Bar.LEFT),
|
|
||||||
|
|
||||||
bar("┬", chunks[1].right - 1, chunks[1].y),
|
bar("┬", chunks[1].right - 1, chunks[1].y),
|
||||||
bar("┴", chunks[1].right - 1, chunks[1].bottom - 1),
|
bar("┴", chunks[1].right - 1, chunks[1].bottom - 1),
|
||||||
|
@ -34,11 +27,11 @@ function Manager:render(area)
|
||||||
bar("┴", chunks[2].right, chunks[1].bottom - 1), -- Parent
|
bar("┴", chunks[2].right, chunks[1].bottom - 1), -- Parent
|
||||||
Parent:render(chunks[1]:padding(ui.Padding.xy(1))), -- Current
|
Parent:render(chunks[1]:padding(ui.Padding.xy(1))), -- Current
|
||||||
Current:render(chunks[2]:padding(ui.Padding.y(1))), -- Preview
|
Current:render(chunks[2]:padding(ui.Padding.y(1))), -- Preview
|
||||||
Preview:render(chunks[3]:padding(ui.Padding.xy(1))),
|
Preview:render(chunks[3]:padding(ui.Padding.xy(1)))
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
Status = { area = ui.Rect.default }
|
Status = {area = ui.Rect.default}
|
||||||
|
|
||||||
function Status.style()
|
function Status.style()
|
||||||
if cx.active.mode.is_select then
|
if cx.active.mode.is_select then
|
||||||
|
@ -52,54 +45,41 @@ end
|
||||||
|
|
||||||
function Status:mode()
|
function Status:mode()
|
||||||
local mode = tostring(cx.active.mode):upper()
|
local mode = tostring(cx.active.mode):upper()
|
||||||
if mode == "UNSET" then
|
if mode == "UNSET" then mode = "UN-SET" end
|
||||||
mode = "UN-SET"
|
|
||||||
end
|
|
||||||
|
|
||||||
local style = self.style()
|
local style = self.style()
|
||||||
return ui.Line({
|
return ui.Line {
|
||||||
ui.Span(THEME.status.separator_open):fg(style.bg),
|
ui.Span(THEME.status.separator_open):fg(style.bg),
|
||||||
ui.Span(" " .. mode .. " "):style(style),
|
ui.Span(" " .. mode .. " "):style(style)
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:size()
|
function Status:size()
|
||||||
local h = cx.active.current.hovered
|
local h = cx.active.current.hovered
|
||||||
if h == nil then
|
if h == nil then return ui.Line {} end
|
||||||
return ui.Line({})
|
|
||||||
end
|
|
||||||
|
|
||||||
local style = self.style()
|
local style = self.style()
|
||||||
return ui.Line({
|
return ui.Line {
|
||||||
ui.Span(" " .. ya.readable_size(h:size() or h.cha.length) .. " ")
|
ui.Span(" " .. ya.readable_size(h:size() or h.cha.length) .. " "):fg(
|
||||||
:fg(style.bg)
|
style.bg):bg(THEME.status.separator_style.bg),
|
||||||
:bg(THEME.status.separator_style.bg),
|
ui.Span(THEME.status.separator_close):fg(THEME.status.separator_style.fg)
|
||||||
ui.Span(THEME.status.separator_close):fg(THEME.status.separator_style.fg),
|
}
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:name()
|
function Status:name()
|
||||||
local h = cx.active.current.hovered
|
local h = cx.active.current.hovered
|
||||||
if h == nil then
|
if h == nil then return ui.Span("") end
|
||||||
return ui.Span("")
|
|
||||||
end
|
|
||||||
local linked = ""
|
local linked = ""
|
||||||
if h.link_to ~= nil then
|
if h.link_to ~= nil then linked = " -> " .. tostring(h.link_to) end
|
||||||
linked = " -> " .. tostring(h.link_to)
|
|
||||||
end
|
|
||||||
return ui.Span(" " .. h.name .. linked)
|
return ui.Span(" " .. h.name .. linked)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:permissions()
|
function Status:permissions()
|
||||||
local h = cx.active.current.hovered
|
local h = cx.active.current.hovered
|
||||||
if h == nil then
|
if h == nil then return ui.Line {} end
|
||||||
return ui.Line({})
|
|
||||||
end
|
|
||||||
|
|
||||||
local perm = h.cha:permissions()
|
local perm = h.cha:permissions()
|
||||||
if perm == nil then
|
if perm == nil then return ui.Line {} end
|
||||||
return ui.Line({})
|
|
||||||
end
|
|
||||||
|
|
||||||
local spans = {}
|
local spans = {}
|
||||||
for i = 1, #perm do
|
for i = 1, #perm do
|
||||||
|
@ -134,10 +114,11 @@ function Status:percentage()
|
||||||
end
|
end
|
||||||
|
|
||||||
local style = self.style()
|
local style = self.style()
|
||||||
return ui.Line({
|
return ui.Line {
|
||||||
ui.Span(" " .. THEME.status.separator_open):fg(THEME.status.separator_style.fg),
|
ui.Span(" " .. THEME.status.separator_open):fg(THEME.status
|
||||||
ui.Span(percent):fg(style.bg):bg(THEME.status.separator_style.bg),
|
.separator_style.fg),
|
||||||
})
|
ui.Span(percent):fg(style.bg):bg(THEME.status.separator_style.bg)
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:position()
|
function Status:position()
|
||||||
|
@ -145,39 +126,34 @@ function Status:position()
|
||||||
local length = #cx.active.current.files
|
local length = #cx.active.current.files
|
||||||
|
|
||||||
local style = self.style()
|
local style = self.style()
|
||||||
return ui.Line({
|
return ui.Line {
|
||||||
ui.Span(string.format(" %2d/%-2d ", cursor + 1, length)):style(style),
|
ui.Span(string.format(" %2d/%-2d ", cursor + 1, length)):style(style),
|
||||||
ui.Span(THEME.status.separator_close):fg(style.bg),
|
ui.Span(THEME.status.separator_close):fg(style.bg)
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:render(area)
|
function Status:render(area)
|
||||||
self.area = area
|
self.area = area
|
||||||
|
|
||||||
local left = ui.Line({ self:mode(), self:size(), self:name() })
|
local left = ui.Line {self:mode(), self:size(), self:name()}
|
||||||
local right = ui.Line({
|
local right = ui.Line {
|
||||||
self:owner(),
|
self:owner(), self:permissions(), self:percentage(), self:position()
|
||||||
self:permissions(),
|
}
|
||||||
self:percentage(),
|
|
||||||
self:position(),
|
|
||||||
})
|
|
||||||
return {
|
return {
|
||||||
ui.Paragraph(area, { left }),
|
ui.Paragraph(area, {left}),
|
||||||
ui.Paragraph(area, { right }):align(ui.Paragraph.RIGHT),
|
ui.Paragraph(area, {right}):align(ui.Paragraph.RIGHT),
|
||||||
table.unpack(Progress:render(area, right:width())),
|
table.unpack(Progress:render(area, right:width()))
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:owner()
|
function Status:owner()
|
||||||
local h = cx.active.current.hovered
|
local h = cx.active.current.hovered
|
||||||
if h == nil or ya.target_family() ~= "unix" then
|
if h == nil or ya.target_family() ~= "unix" then return ui.Line {} end
|
||||||
return ui.Line({})
|
|
||||||
end
|
|
||||||
|
|
||||||
return ui.Line({
|
return ui.Line {
|
||||||
ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"),
|
ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"),
|
||||||
ui.Span(":"),
|
ui.Span(":"),
|
||||||
ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"),
|
ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"),
|
||||||
ui.Span(" "),
|
ui.Span(" ")
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue