mirror of
https://github.com/kristoferssolo/solorice.git
synced 2026-02-04 06:32:03 +00:00
Update 2025-06-30
Update 2025-06-06 Update 2025-06-08 Update 2025-06-11 Update 2025-06-11 Update 2025-06-18 Update 2025-06-24
This commit is contained in:
@@ -20,52 +20,52 @@ require("augment-command"):setup({
|
||||
wraparound_file_navigation = false,
|
||||
})
|
||||
require("git"):setup()
|
||||
require("yatline"):setup({
|
||||
show_background = false,
|
||||
section_separator = { open = "", close = "" },
|
||||
part_separator = { open = "", close = "" },
|
||||
inverse_separator = { open = "", close = "" },
|
||||
|
||||
header_line = {
|
||||
left = {
|
||||
section_a = {
|
||||
{ type = "line", custom = false, name = "tabs", params = { "left" } },
|
||||
},
|
||||
section_b = {},
|
||||
section_c = {},
|
||||
},
|
||||
right = {
|
||||
section_a = {
|
||||
{ type = "string", custom = false, name = "date", params = { "%A, %d %B %Y" } },
|
||||
},
|
||||
section_b = {
|
||||
{ type = "string", custom = false, name = "date", params = { "%X" } },
|
||||
},
|
||||
section_c = {},
|
||||
},
|
||||
},
|
||||
|
||||
status_line = {
|
||||
left = {
|
||||
section_a = {},
|
||||
section_b = {},
|
||||
section_c = {
|
||||
{ type = "string", custom = false, name = "hovered_path" },
|
||||
{ type = "coloreds", custom = false, name = "task_states" },
|
||||
},
|
||||
},
|
||||
right = {
|
||||
section_a = {
|
||||
{ type = "string", custom = false, name = "cursor_position" },
|
||||
{ type = "string", custom = false, name = "cursor_percentage" },
|
||||
},
|
||||
section_b = {
|
||||
{ type = "string", custom = false, name = "hovered_file_extension", params = { true } },
|
||||
},
|
||||
section_c = {
|
||||
{ type = "coloreds", custom = false, name = "permissions" },
|
||||
{ type = "coloreds", custom = false, name = "count", params = "true" },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
-- require("yatline"):setup({
|
||||
-- show_background = false,
|
||||
-- section_separator = { open = "", close = "" },
|
||||
-- part_separator = { open = "", close = "" },
|
||||
-- inverse_separator = { open = "", close = "" },
|
||||
--
|
||||
-- header_line = {
|
||||
-- left = {
|
||||
-- section_a = {
|
||||
-- { type = "line", custom = false, name = "tabs", params = { "left" } },
|
||||
-- },
|
||||
-- section_b = {},
|
||||
-- section_c = {},
|
||||
-- },
|
||||
-- right = {
|
||||
-- section_a = {
|
||||
-- { type = "string", custom = false, name = "date", params = { "%A, %d %B %Y" } },
|
||||
-- },
|
||||
-- section_b = {
|
||||
-- { type = "string", custom = false, name = "date", params = { "%X" } },
|
||||
-- },
|
||||
-- section_c = {},
|
||||
-- },
|
||||
-- },
|
||||
--
|
||||
-- status_line = {
|
||||
-- left = {
|
||||
-- section_a = {},
|
||||
-- section_b = {},
|
||||
-- section_c = {
|
||||
-- { type = "string", custom = false, name = "hovered_path" },
|
||||
-- { type = "coloreds", custom = false, name = "task_states" },
|
||||
-- },
|
||||
-- },
|
||||
-- right = {
|
||||
-- section_a = {
|
||||
-- { type = "string", custom = false, name = "cursor_position" },
|
||||
-- { type = "string", custom = false, name = "cursor_percentage" },
|
||||
-- },
|
||||
-- section_b = {
|
||||
-- { type = "string", custom = false, name = "hovered_file_extension", params = { true } },
|
||||
-- },
|
||||
-- section_c = {
|
||||
-- { type = "coloreds", custom = false, name = "permissions" },
|
||||
-- { type = "coloreds", custom = false, name = "count", params = "true" },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
|
||||
@@ -5,13 +5,13 @@ hash = "50da29476e744dba37d77fb209328fd1"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "dedukun/relative-motions"
|
||||
rev = "ce2e890"
|
||||
hash = "23915860e59348bf4166778bb0e606f7"
|
||||
rev = "2e3b617"
|
||||
hash = "b67ee12053113983273e9118a7d1272b"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "hankertrix/augment-command"
|
||||
rev = "ac4a651"
|
||||
hash = "7b6b0b8c260c9c5e557287bf9b370f7c"
|
||||
rev = "a03a237"
|
||||
hash = "56dfc522998328d0c417226e88da862c"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "kirasok/torrent-preview"
|
||||
@@ -20,8 +20,8 @@ hash = "6af40ce6b2cd849b5fa32de04a598b06"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "ndtoan96/ouch"
|
||||
rev = "2496cd9"
|
||||
hash = "5b9dea47776a30946cfbf83232d18fb1"
|
||||
rev = "1ee69a5"
|
||||
hash = "63679f3daf8551ff8755be38b5ced0f"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "pirafrank/what-size"
|
||||
@@ -30,48 +30,48 @@ hash = "fca231a128488a554823374f8f6d5241"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:git"
|
||||
rev = "c0ad8a3"
|
||||
hash = "bf6f074cd41ee33c3360341d168f9733"
|
||||
rev = "86d28e4"
|
||||
hash = "e01006bfb38951ea89031bd918b20dbb"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:chmod"
|
||||
rev = "c0ad8a3"
|
||||
hash = "d0ad0c1946b46a30c8489735fe8de41c"
|
||||
rev = "86d28e4"
|
||||
hash = "a030fe48d91b04341ad2fba9be957df"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:full-border"
|
||||
rev = "c0ad8a3"
|
||||
rev = "86d28e4"
|
||||
hash = "3996fc74044bc44144b323686f887e1"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:mount"
|
||||
rev = "c0ad8a3"
|
||||
hash = "c0b6cd7dc830b96e77e5c8a71eec7926"
|
||||
rev = "86d28e4"
|
||||
hash = "b3f1d6ec3721d4061aad5f69cddb0cf9"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:smart-filter"
|
||||
rev = "c0ad8a3"
|
||||
hash = "4d82cd9e7534d976f000edf9c0f68d8f"
|
||||
rev = "86d28e4"
|
||||
hash = "f660384d7ed12ecd456efed313453310"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:diff"
|
||||
rev = "c0ad8a3"
|
||||
rev = "86d28e4"
|
||||
hash = "47865a70cade14a0b9b6bc6a54f16bdb"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "AnirudhG07/rich-preview"
|
||||
rev = "de28f50"
|
||||
hash = "b9cd4027db110b4228889be32462f363"
|
||||
rev = "843c3fa"
|
||||
hash = "b4040931f0d2f9670ddb4923e55cd881"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "macydnah/office"
|
||||
rev = "d1e3e51"
|
||||
hash = "35241f7d85abc5a0d2441020bc597ceb"
|
||||
rev = "4002d36"
|
||||
hash = "9c68763dd4f2799f7cfee1e9c3e819a9"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "boydaihungst/mediainfo"
|
||||
rev = "c6d0de7"
|
||||
hash = "7b024fc14b462235068400207cbe7bf0"
|
||||
rev = "a7d1aa6"
|
||||
hash = "844133c7247cda086819d63a9ca5e457"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "iynaix/time-travel"
|
||||
@@ -80,8 +80,8 @@ hash = "69967963fba96295a07b68354fc91ea9"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "imsi32/yatline"
|
||||
rev = "2ecf715"
|
||||
hash = "38e2ea4703ea606d4eef574e8e8b8fd7"
|
||||
rev = "88bd1c5"
|
||||
hash = "981acbe9b758b1af3a8154c932bb936d"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "kristoferssolo/vidir"
|
||||
|
||||
@@ -46,7 +46,7 @@ plugin.
|
||||
|
||||
## Requirements
|
||||
|
||||
- [Yazi][yazi-link] v25.5.28+
|
||||
- [Yazi][yazi-link] v25.5.31+
|
||||
- [`7z` or `7zz` command][7z-link]
|
||||
- [`file` command][file-command-link]
|
||||
|
||||
@@ -1206,7 +1206,7 @@ are also supported, for example:
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "k"
|
||||
run = "plugin augment-command -- arrow -1"
|
||||
desc = "Move cursor up"
|
||||
desc = "Move the cursor up"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "r"
|
||||
@@ -1221,6 +1221,7 @@ desc = "Permanently delete the files"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["g", "j"]
|
||||
run = "plugin augment-command -- parent_arrow 1"
|
||||
desc = "Move the cursor down in the parent directory"
|
||||
```
|
||||
|
||||
For the default descriptions of the commands, you can refer to
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.5.28
|
||||
--- @since 25.5.31
|
||||
|
||||
-- Plugin to make some Yazi commands smarter
|
||||
-- Written in Lua 5.4
|
||||
@@ -938,7 +938,7 @@ local function show_overwrite_prompt(file_path_to_overwrite)
|
||||
|
||||
-- Wrap the string in a line and align it to the center.
|
||||
first_line = ui.Line(overwrite_confirm_options.content)
|
||||
:align(ui.Line.CENTER)
|
||||
:align(ui.Align.CENTER)
|
||||
|
||||
-- Otherwise, just set the first line to the content given
|
||||
else
|
||||
@@ -951,9 +951,9 @@ local function show_overwrite_prompt(file_path_to_overwrite)
|
||||
first_line,
|
||||
ui.Line(string.rep("─", overwrite_confirm_options.pos.w - 2))
|
||||
:style(ui.Style(th.confirm.border))
|
||||
:align(ui.Line.LEFT),
|
||||
ui.Line(tostring(file_path_to_overwrite)):align(ui.Line.LEFT),
|
||||
}):wrap(ui.Text.WRAP_TRIM)
|
||||
:align(ui.Align.LEFT),
|
||||
ui.Line(tostring(file_path_to_overwrite)):align(ui.Align.LEFT),
|
||||
}):wrap(ui.Wrap.TRIM)
|
||||
|
||||
-- Get the user's confirmation for
|
||||
-- whether they want to overwrite the item
|
||||
@@ -3886,7 +3886,7 @@ local function handle_quit(args, config)
|
||||
content = ui.Text({
|
||||
"There are multiple tabs open.",
|
||||
"Are you sure you want to quit?",
|
||||
}):wrap(ui.Text.WRAP_TRIM),
|
||||
}):wrap(ui.Wrap.TRIM),
|
||||
}, true, true)
|
||||
|
||||
-- Get the type of the quit content
|
||||
@@ -3895,7 +3895,7 @@ local function handle_quit(args, config)
|
||||
-- If the type of the quit content is a string or a list of strings
|
||||
if quit_content_type == "string" or quit_content_type == "table" then
|
||||
quit_confirm_options.content = ui.Text(quit_confirm_options.content)
|
||||
:wrap(ui.Text.WRAP_TRIM)
|
||||
:wrap(ui.Wrap.TRIM)
|
||||
end
|
||||
|
||||
-- Get the user's confirmation for quitting
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.5.28
|
||||
--- @since 25.5.31
|
||||
|
||||
local selected_or_hovered = ya.sync(function()
|
||||
local tab, paths = cx.active, {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.5.28
|
||||
--- @since 25.5.31
|
||||
|
||||
local WINDOWS = ya.target_family() == "windows"
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ This is a Yazi plugin for previewing media files. The preview shows thumbnail
|
||||
using `ffmpeg` if available and media metadata using `mediainfo`.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Minimum version: yazi v25.5.28.
|
||||
> Minimum version: yazi v25.5.31.
|
||||
|
||||
## Preview
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.5.28
|
||||
--- @since 25.5.31
|
||||
|
||||
local skip_labels = {
|
||||
["Complete name"] = true,
|
||||
@@ -129,7 +129,7 @@ function M:peek(job)
|
||||
w = job.area.w,
|
||||
h = job.area.h - image_height,
|
||||
}))
|
||||
:wrap(is_wrap and ui.Text.WRAP or ui.Text.WRAP_NO),
|
||||
:wrap(is_wrap and ui.Wrap.YES or ui.Wrap.NO),
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.5.28
|
||||
--- @since 25.5.31
|
||||
|
||||
local toggle_ui = ya.sync(function(self)
|
||||
if self.children then
|
||||
@@ -274,7 +274,7 @@ function M.operate(type)
|
||||
end
|
||||
end
|
||||
|
||||
function M.fail(s, ...) ya.notify { title = "Mount", content = string.format(s, ...), timeout = 10, level = "error" } end
|
||||
function M.fail(...) ya.notify { title = "Mount", content = string.format(...), timeout = 10, level = "error" } end
|
||||
|
||||
function M:click() end
|
||||
|
||||
|
||||
@@ -29,32 +29,39 @@ end
|
||||
function M:doc2pdf(job)
|
||||
local tmp = "/tmp/yazi-" .. ya.uid() .. "/" .. ya.hash("office.yazi") .. "/"
|
||||
|
||||
--[[ For Future Reference: Regarding `libreoffice` as preconverter
|
||||
--[[ For Future Reference: Regarding `libreoffice` as preconverter
|
||||
1. It prints errors to stdout (always, doesn't matter if it succeeded or it failed)
|
||||
2. Always writes the converted files to the filesystem, so no "Mario|Bros|Piping|Magic" for the data stream (https://ask.libreoffice.org/t/using-convert-to-output-to-stdout/38753)
|
||||
3. The `pdf:draw_pdf_Export` filter needs literal double quotes when defining its options (https://help.libreoffice.org/latest/en-US/text/shared/guide/pdf_params.html?&DbPAR=SHARED&System=UNIX#generaltext/shared/guide/pdf_params.xhp)
|
||||
3.1 Regarding double quotes and Lua strings, see https://www.lua.org/manual/5.1/manual.html#2.1 --]]
|
||||
local libreoffice = Command("libreoffice")
|
||||
:args({
|
||||
:arg({
|
||||
"--headless",
|
||||
"--convert-to",
|
||||
"pdf:draw_pdf_Export:{" ..
|
||||
"\"PageRange\":{" ..
|
||||
"\"type\":\"string\"," ..
|
||||
"\"value\":" .. "\"" .. job.skip + 1 .. "\"" ..
|
||||
"}" ..
|
||||
"}",
|
||||
"pdf:draw_pdf_Export:{"
|
||||
.. '"PageRange":{'
|
||||
.. '"type":"string",'
|
||||
.. '"value":'
|
||||
.. '"'
|
||||
.. job.skip + 1
|
||||
.. '"'
|
||||
.. "}"
|
||||
.. "}",
|
||||
"--outdir",
|
||||
tmp,
|
||||
tostring(job.file.url)
|
||||
tostring(job.file.url),
|
||||
})
|
||||
:stdin(Command.NULL)
|
||||
:stdout(Command.PIPED)
|
||||
:stderr(Command.NULL)
|
||||
:output()
|
||||
|
||||
|
||||
if not libreoffice.status.success then
|
||||
ya.err(libreoffice.stdout:match("LibreOffice .+"):gsub("%\n.*", "") .. " " .. libreoffice.stdout:match("Error .+"):gsub("%\n.*", ""))
|
||||
ya.err(
|
||||
libreoffice.stdout:match("LibreOffice .+"):gsub("%\n.*", "")
|
||||
.. " "
|
||||
.. libreoffice.stdout:match("Error .+"):gsub("%\n.*", "")
|
||||
)
|
||||
return nil, Err("Failed to preconvert `%s` to a temporary PDF", job.file.name)
|
||||
end
|
||||
|
||||
@@ -80,7 +87,7 @@ function M:preload(job)
|
||||
end
|
||||
|
||||
local output, err = Command("pdftoppm")
|
||||
:args({
|
||||
:arg({
|
||||
"-singlefile",
|
||||
"-jpeg",
|
||||
"-jpegopt",
|
||||
|
||||
@@ -43,7 +43,7 @@ prepend_previewers = [
|
||||
{ mime = "application/x-bzip2", run = "ouch" },
|
||||
{ mime = "application/x-7z-compressed", run = "ouch" },
|
||||
{ mime = "application/x-rar", run = "ouch" },
|
||||
{ mime = "application/x-xz", run = "ouch" },
|
||||
{ mime = "application/x-xz", run = "ouch" },
|
||||
{ mime = "application/xz", run = "ouch" },
|
||||
]
|
||||
```
|
||||
@@ -56,7 +56,7 @@ If you want to change the icon or the style of text, you can modify the `peek` f
|
||||
For compession, add this to your `keymap.toml`:
|
||||
|
||||
```toml
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["C"]
|
||||
run = "plugin ouch"
|
||||
desc = "Compress with ouch"
|
||||
@@ -73,7 +73,7 @@ To decompress with `ouch`, configure the opener in `yazi.toml`.
|
||||
```toml
|
||||
[opener]
|
||||
extract = [
|
||||
{ run = 'ouch d -y "%*"', desc = "Extract here with ouch", for = "windows" },
|
||||
{ run = 'ouch d -y %*', desc = "Extract here with ouch", for = "windows" },
|
||||
{ run = 'ouch d -y "$@"', desc = "Extract here with ouch", for = "unix" },
|
||||
]
|
||||
```
|
||||
|
||||
@@ -2,13 +2,13 @@ local M = {}
|
||||
|
||||
function M:peek(job)
|
||||
local child = Command("ouch")
|
||||
:args({ "l", "-t", "-y", tostring(job.file.url) })
|
||||
:arg({ "l", "-t", "-y", tostring(job.file.url) })
|
||||
:stdout(Command.PIPED)
|
||||
:stderr(Command.PIPED)
|
||||
:spawn()
|
||||
local limit = job.area.h
|
||||
local file_name = string.match(tostring(job.file.url), ".*[/\\](.*)")
|
||||
local lines = string.format("📁 \x1b[2m%s\x1b[0m\n", file_name)
|
||||
local lines = string.format("\u{1f4c1} %s\n", file_name)
|
||||
local num_lines = 1
|
||||
local num_skip = 0
|
||||
repeat
|
||||
@@ -31,12 +31,12 @@ function M:peek(job)
|
||||
|
||||
child:start_kill()
|
||||
if job.skip > 0 and num_lines < limit then
|
||||
ya.manager_emit(
|
||||
ya.emit(
|
||||
"peek",
|
||||
{ tostring(math.max(0, job.skip - (limit - num_lines))), only_if = tostring(job.file.url), upper_bound = "" }
|
||||
)
|
||||
else
|
||||
ya.preview_widgets(job, { ui.Text(lines):area(job.area) })
|
||||
ya.preview_widget(job, { ui.Text(lines):area(job.area) })
|
||||
end
|
||||
end
|
||||
|
||||
@@ -44,7 +44,7 @@ function M:seek(job)
|
||||
local h = cx.active.current.hovered
|
||||
if h and h.url == job.file.url then
|
||||
local step = math.floor(job.units * job.area.h / 10)
|
||||
ya.manager_emit("peek", {
|
||||
ya.emit("peek", {
|
||||
math.max(0, cx.active.preview.skip + step),
|
||||
only_if = tostring(job.file.url),
|
||||
})
|
||||
@@ -81,15 +81,15 @@ local get_compression_target = ya.sync(function()
|
||||
table.insert(paths, tostring(url))
|
||||
end
|
||||
-- The compression targets are aquired, now unselect them
|
||||
ya.manager_emit("escape", {})
|
||||
ya.emit("escape", {})
|
||||
end
|
||||
return paths, default_name
|
||||
end)
|
||||
|
||||
local function invoke_compress_command(paths, name)
|
||||
local cmd_output, err_code = Command("ouch")
|
||||
:args({ "c", "-y" })
|
||||
:args(paths)
|
||||
:arg({ "c", "-y" })
|
||||
:arg(paths)
|
||||
:arg(name)
|
||||
:stderr(Command.PIPED)
|
||||
:output()
|
||||
@@ -116,7 +116,7 @@ function M:entry(job)
|
||||
default_fmt = "zip"
|
||||
end
|
||||
|
||||
ya.manager_emit("escape", { visual = true })
|
||||
ya.emit("escape", { visual = true })
|
||||
|
||||
-- Get the files that need to be compressed and infer a default archive name
|
||||
local paths, default_name = get_compression_target()
|
||||
|
||||
@@ -6,7 +6,7 @@ https://github.com/dedukun/relative-motions.yazi/assets/25795432/04fb186a-5efe-4
|
||||
|
||||
## Requirements
|
||||
|
||||
- [Yazi](https://github.com/sxyazi/yazi) v25.4.8+
|
||||
- [Yazi](https://github.com/sxyazi/yazi) v25.5.28+
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.4.8
|
||||
--- @since 25.5.28
|
||||
-- stylua: ignore
|
||||
local MOTIONS_AND_OP_KEYS = {
|
||||
{ on = "0" }, { on = "1" }, { on = "2" }, { on = "3" }, { on = "4" },
|
||||
@@ -141,7 +141,7 @@ local render_numbers = ya.sync(function(_, mode)
|
||||
|
||||
return {
|
||||
ui.List(entities):area(self._area),
|
||||
ui.Text(linemodes):area(self._area):align(ui.Text.RIGHT),
|
||||
ui.Text(linemodes):area(self._area):align(ui.Align.RIGHT),
|
||||
}
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -2,7 +2,7 @@ local M = {}
|
||||
|
||||
function M:peek(job)
|
||||
local child = Command("rich")
|
||||
:args({
|
||||
:arg({
|
||||
"-j",
|
||||
"--left",
|
||||
"--line-numbers",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--- @since 25.5.28
|
||||
--- @since 25.5.31
|
||||
|
||||
local hovered = ya.sync(function()
|
||||
local h = cx.active.current.hovered
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
--- @since 25.5.31
|
||||
--- @diagnostic disable: undefined-global, undefined-field
|
||||
--- @alias Mode Mode Comes from Yazi.
|
||||
--- @alias Rect Rect Comes from Yazi.
|
||||
@@ -424,12 +425,20 @@ function Yatline.string.get:hovered_mime()
|
||||
end
|
||||
|
||||
--- Gets the hovered file's user and group ownership of the current active tab.
|
||||
--- Unix-like systems only.
|
||||
--- @return string ownership Current active tab's hovered file's user and group ownership.
|
||||
function Yatline.string.get:hovered_ownership()
|
||||
local hovered = cx.active.current.hovered
|
||||
|
||||
if hovered then
|
||||
return ya.user_name(hovered.cha.uid) .. ":" .. ya.group_name(hovered.cha.gid)
|
||||
if not hovered.cha.uid or not hovered.cha.gid then
|
||||
return ""
|
||||
end
|
||||
|
||||
local username = ya.user_name(hovered.cha.uid) or tostring(hovered.cha.uid)
|
||||
local groupname = ya.group_name(hovered.cha.gid) or tostring(hovered.cha.gid)
|
||||
|
||||
return username .. ":" .. groupname
|
||||
else
|
||||
return ""
|
||||
end
|
||||
@@ -713,6 +722,7 @@ function Yatline.coloreds.create(coloreds, component_type)
|
||||
end
|
||||
|
||||
--- Gets the hovered file's permissions of the current active tab.
|
||||
--- Unix-like systems only.
|
||||
--- @return Coloreds coloreds Current active tab's hovered file's permissions
|
||||
function Yatline.coloreds.get:permissions()
|
||||
local hovered = cx.active.current.hovered
|
||||
@@ -990,8 +1000,10 @@ local function config_side(side)
|
||||
|
||||
if component_group then
|
||||
if component.custom then
|
||||
section_components[#section_components + 1] =
|
||||
{ component_group.create(component.name, in_section), component_group.has_separator }
|
||||
if component.name ~= nil and component.name ~= "" and #component.name ~= 0 then
|
||||
section_components[#section_components + 1] =
|
||||
{ component_group.create(component.name, in_section), component_group.has_separator }
|
||||
end
|
||||
else
|
||||
local getter = component_group.get[component.name]
|
||||
|
||||
@@ -1075,9 +1087,65 @@ local function config_paragraph(area, line)
|
||||
end
|
||||
|
||||
return {
|
||||
setup = function(_, config)
|
||||
setup = function(_, config, pre_theme)
|
||||
config = config or {}
|
||||
|
||||
if config == 0 then
|
||||
config = {
|
||||
show_background = false,
|
||||
|
||||
header_line = {
|
||||
left = {
|
||||
section_a = {
|
||||
{ type = "line", custom = false, name = "tabs", params = { "left" } },
|
||||
},
|
||||
section_b = {},
|
||||
section_c = {},
|
||||
},
|
||||
right = {
|
||||
section_a = {
|
||||
{ type = "string", custom = false, name = "date", params = { "%A, %d %B %Y" } },
|
||||
},
|
||||
section_b = {
|
||||
{ type = "string", custom = false, name = "date", params = { "%X" } },
|
||||
},
|
||||
section_c = {},
|
||||
},
|
||||
},
|
||||
|
||||
status_line = {
|
||||
left = {
|
||||
section_a = {
|
||||
{ type = "string", custom = false, name = "tab_mode" },
|
||||
},
|
||||
section_b = {
|
||||
{ type = "string", custom = false, name = "hovered_size" },
|
||||
},
|
||||
section_c = {
|
||||
{ type = "string", custom = false, name = "hovered_path" },
|
||||
{ type = "coloreds", custom = false, name = "count" },
|
||||
},
|
||||
},
|
||||
right = {
|
||||
section_a = {
|
||||
{ type = "string", custom = false, name = "cursor_position" },
|
||||
},
|
||||
section_b = {
|
||||
{ type = "string", custom = false, name = "cursor_percentage" },
|
||||
},
|
||||
section_c = {
|
||||
{ type = "string", custom = false, name = "hovered_file_extension", params = { true } },
|
||||
{ type = "coloreds", custom = false, name = "permissions" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
if pre_theme then
|
||||
config.theme = pre_theme
|
||||
end
|
||||
|
||||
tab_width = config.tab_width or 20
|
||||
|
||||
local component_positions = config.component_positions or { "header", "tab", "status" }
|
||||
@@ -1249,7 +1317,7 @@ return {
|
||||
Progress.partial_render = function(self)
|
||||
local progress = cx.tasks.progress
|
||||
if progress.total == 0 then
|
||||
return { config_paragraph(self._area) }
|
||||
return config_paragraph(self._area)
|
||||
end
|
||||
|
||||
local gauge = ui.Gauge():area(self._area)
|
||||
@@ -1265,11 +1333,9 @@ return {
|
||||
end
|
||||
|
||||
local left = progress.total - progress.succ
|
||||
return {
|
||||
gauge
|
||||
:percent(percent)
|
||||
:label(ui.Span(string.format("%3d%%, %d left", percent, left)):style(th.status.progress_label)),
|
||||
}
|
||||
return gauge
|
||||
:percent(percent)
|
||||
:label(ui.Span(string.format("%3d%%, %d left", percent, left)):style(th.status.progress_label))
|
||||
end
|
||||
|
||||
if display_header_line then
|
||||
@@ -1280,7 +1346,7 @@ return {
|
||||
|
||||
return {
|
||||
config_paragraph(self._area, left_line),
|
||||
ui.Text(right_line):area(self._area):align(ui.Text.RIGHT),
|
||||
right_line:area(self._area):align(ui.Align.RIGHT),
|
||||
}
|
||||
end
|
||||
|
||||
@@ -1306,8 +1372,8 @@ return {
|
||||
|
||||
return {
|
||||
config_paragraph(self._area, left_line),
|
||||
ui.Text(right_line):area(self._area):align(ui.Text.RIGHT),
|
||||
table.unpack(Progress:new(self._area, right_width):redraw()),
|
||||
right_line:area(self._area):align(ui.Align.RIGHT),
|
||||
table.unpack(ui.redraw(Progress:new(self._area, right_width))),
|
||||
}
|
||||
end
|
||||
|
||||
@@ -1356,6 +1422,8 @@ return {
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(childrens, Modal:new(self._area))
|
||||
|
||||
self._children = childrens
|
||||
end
|
||||
end,
|
||||
|
||||
@@ -88,16 +88,6 @@ preloaders = [
|
||||
{mime = "video/*", run = "video"},
|
||||
{mime = "application/pdf", run = "pdf"},
|
||||
]
|
||||
prepend_preloaders = [
|
||||
# Office Documents
|
||||
{mime = "application/openxmlformats-officedocument.*", run = "office"},
|
||||
{mime = "application/oasis.opendocument.*", run = "office"},
|
||||
{mime = "application/ms-*", run = "office"},
|
||||
{mime = "application/msword", run = "office"},
|
||||
{name = "*.docx", run = "office"},
|
||||
{mime = "{audio,video,image}/*", run = "mediainfo"},
|
||||
{mime = "application/subrip", run = "mediainfo"},
|
||||
]
|
||||
previewers = [
|
||||
{name = "*/", run = "folder", sync = true},
|
||||
{mime = "text/*", run = "code"},
|
||||
|
||||
Reference in New Issue
Block a user