This commit is contained in:
sxyazi 2024-11-20 16:09:29 +08:00
parent 67ba903fd4
commit 5fc817d52c
No known key found for this signature in database
2 changed files with 26 additions and 1 deletions

View file

@ -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

View file

@ -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