mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
67ba903fd4
commit
5fc817d52c
2 changed files with 26 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ end
|
|||
|
||||
function M:seek() end
|
||||
|
||||
-- TODO: remove this
|
||||
local hovered_mime = ya.sync(function()
|
||||
local h = cx.active.current.hovered
|
||||
if not h then
|
||||
|
|
|
|||
|
|
@ -22,6 +22,30 @@ function M:preload()
|
|||
return ya.image_precache(self.file.url, cache) and 1 or 2
|
||||
end
|
||||
|
||||
function M:spot(args) require("file"):spot(args) end
|
||||
function M:spot(args)
|
||||
local info = ya.image_info(args.file.url)
|
||||
|
||||
local rows = {}
|
||||
local row = function(key, value)
|
||||
local h = type(value) == "table" and #value or 1
|
||||
rows[#rows + 1] = ui.Row({ key, value }):height(h)
|
||||
end
|
||||
|
||||
row("Format:", tostring(info.format))
|
||||
row("Width:", string.format("%dpx", info.w))
|
||||
row("Height:", string.format("%dpx", info.h))
|
||||
row("Color:", tostring(info.color))
|
||||
|
||||
ya.spot_table(
|
||||
args,
|
||||
ui.Table(rows)
|
||||
:area(ui.Pos { "center", w = 60, h = 20 })
|
||||
:row(args.skip)
|
||||
:col(1)
|
||||
:col_style(ui.Style():fg("blue"))
|
||||
:cell_style(ui.Style():fg("yellow"):reverse())
|
||||
:widths { ui.Constraint.Length(12), ui.Constraint.Fill(1) }
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue