mirror of
https://github.com/kristoferssolo/solorice.git
synced 2025-10-21 20:10:34 +00:00
Update: 2024-10-20
This commit is contained in:
parent
e2c877478c
commit
7da57cd023
0
config/HybridBar/scripts/change-active-workspace
Normal file → Executable file
0
config/HybridBar/scripts/change-active-workspace
Normal file → Executable file
0
config/HybridBar/scripts/get-active-workspace
Normal file → Executable file
0
config/HybridBar/scripts/get-active-workspace
Normal file → Executable file
0
config/HybridBar/scripts/get-window-title
Normal file → Executable file
0
config/HybridBar/scripts/get-window-title
Normal file → Executable file
0
config/HybridBar/scripts/get-workspaces
Normal file → Executable file
0
config/HybridBar/scripts/get-workspaces
Normal file → Executable file
0
config/eww/scripts/change-active-workspace
Normal file → Executable file
0
config/eww/scripts/change-active-workspace
Normal file → Executable file
0
config/eww/scripts/get-active-workspace
Normal file → Executable file
0
config/eww/scripts/get-active-workspace
Normal file → Executable file
0
config/eww/scripts/get-music
Normal file → Executable file
0
config/eww/scripts/get-music
Normal file → Executable file
0
config/eww/scripts/get-network
Normal file → Executable file
0
config/eww/scripts/get-network
Normal file → Executable file
0
config/eww/scripts/get-window-title
Normal file → Executable file
0
config/eww/scripts/get-window-title
Normal file → Executable file
0
config/eww/scripts/get-workspaces
Normal file → Executable file
0
config/eww/scripts/get-workspaces
Normal file → Executable file
0
config/eww/scripts/getvol
Normal file → Executable file
0
config/eww/scripts/getvol
Normal file → Executable file
0
config/eww/scripts/github
Normal file → Executable file
0
config/eww/scripts/github
Normal file → Executable file
0
config/lf/cleaner
Normal file → Executable file
0
config/lf/cleaner
Normal file → Executable file
0
config/lf/lfrc
Normal file → Executable file
0
config/lf/lfrc
Normal file → Executable file
0
config/nsxiv/exec/image-info
Normal file → Executable file
0
config/nsxiv/exec/image-info
Normal file → Executable file
0
config/nsxiv/exec/key-handler
Normal file → Executable file
0
config/nsxiv/exec/key-handler
Normal file → Executable file
0
config/nsxiv/exec/nsxiv-url
Normal file → Executable file
0
config/nsxiv/exec/nsxiv-url
Normal file → Executable file
0
config/nsxiv/exec/thumb-info
Normal file → Executable file
0
config/nsxiv/exec/thumb-info
Normal file → Executable file
0
config/nsxiv/exec/win-title
Normal file → Executable file
0
config/nsxiv/exec/win-title
Normal file → Executable file
0
config/x11/opt-apps
Normal file → Executable file
0
config/x11/opt-apps
Normal file → Executable file
@ -1,6 +1,5 @@
|
|||||||
require("relative-motions"):setup({ show_numbers = "relative", show_motion = true })
|
require("relative-motions"):setup({ show_numbers = "relative", show_motion = true })
|
||||||
require("full-border"):setup()
|
require("full-border"):setup()
|
||||||
require("starship"):setup()
|
|
||||||
require("augment-command"):setup({
|
require("augment-command"):setup({
|
||||||
prompt = false,
|
prompt = false,
|
||||||
default_item_group_for_prompt = "hovered",
|
default_item_group_for_prompt = "hovered",
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
[plugin]
|
[plugin]
|
||||||
deps = [
|
deps = [
|
||||||
{use = "AnirudhG07/nbpreview", rev = "52a14b3"},
|
{use = "AnirudhG07/nbpreview", rev = "52a14b3"},
|
||||||
{use = "Reledia/glow", rev = "d8b36ff"},
|
{use = "Reledia/glow", rev = "f52b382"},
|
||||||
{use = "Reledia/hexyl", rev = "ccc0a4a"},
|
{use = "Reledia/hexyl", rev = "ccc0a4a"},
|
||||||
{use = "Reledia/miller", rev = "40e0265"},
|
{use = "Reledia/miller", rev = "40e0265"},
|
||||||
{use = "Rolv-Apneseth/starship", rev = "77a65f5"},
|
|
||||||
{use = "Sonico98/exifaudio", rev = "d75db46"},
|
{use = "Sonico98/exifaudio", rev = "d75db46"},
|
||||||
{use = "dedukun/relative-motions", rev = "6aecfcd"},
|
{use = "dedukun/relative-motions", rev = "6aecfcd"},
|
||||||
{use = "hankertrix/augment-command", rev = "b0f113d"},
|
{use = "hankertrix/augment-command", rev = "7ea8dde"},
|
||||||
{use = "imsi32/yatline", rev = "7b56434"},
|
{use = "imsi32/yatline", rev = "7b56434"},
|
||||||
{use = "kirasok/torrent-preview", rev = "76970b6"},
|
{use = "kirasok/torrent-preview", rev = "76970b6"},
|
||||||
{use = "ndtoan96/ouch", rev = "251da69"},
|
{use = "ndtoan96/ouch", rev = "251da69"},
|
||||||
|
|||||||
@ -51,6 +51,16 @@ local Commands = {
|
|||||||
Pager = "pager",
|
Pager = "pager",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- The extract behaviour flags
|
||||||
|
-- https://documentation.help/7-Zip/overwrite.htm
|
||||||
|
---@enum ExtractBehaviour
|
||||||
|
local ExtractBehaviour = {
|
||||||
|
Overwrite = "-aoa",
|
||||||
|
Skip = "-aos",
|
||||||
|
Rename = "-aou",
|
||||||
|
RenameExisting = "-aot",
|
||||||
|
}
|
||||||
|
|
||||||
-- The default configuration for the plugin
|
-- The default configuration for the plugin
|
||||||
---@class (exact) Configuration
|
---@class (exact) Configuration
|
||||||
---@field prompt boolean
|
---@field prompt boolean
|
||||||
@ -508,8 +518,7 @@ local hovered_item_is_archive = ya.sync(function(_)
|
|||||||
local hovered_item = cx.active.current.hovered
|
local hovered_item = cx.active.current.hovered
|
||||||
|
|
||||||
-- Return if the hovered item exists and is an archive
|
-- Return if the hovered item exists and is an archive
|
||||||
return hovered_item
|
return hovered_item and is_archive_mime_type(hovered_item:mime())
|
||||||
and is_archive_mime_type(hovered_item:mime())
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Function to get the paths of the selected items
|
-- Function to get the paths of the selected items
|
||||||
@ -816,11 +825,11 @@ end
|
|||||||
-- The initial password is the password given to the extractor command
|
-- The initial password is the password given to the extractor command
|
||||||
-- and the test encryption is to test the archive password without
|
-- and the test encryption is to test the archive password without
|
||||||
-- actually executing the given extractor command.
|
-- actually executing the given extractor command.
|
||||||
---@param extractor_command function
|
---@param extractor_command function A function that extracts the archive
|
||||||
---@param config Configuration
|
---@param config Configuration The configuration object
|
||||||
---@param initial_password string|nil
|
---@param initial_password string|nil The initial password to try
|
||||||
---@param test_encryption boolean|nil
|
---@param test_encryption boolean|nil Whether to test the encryption or not
|
||||||
---@param archive_path string|nil
|
---@param archive_path string|nil The path to the archive file
|
||||||
---@return boolean successful Whether the extraction was successful
|
---@return boolean successful Whether the extraction was successful
|
||||||
---@return string|nil error_message An error message for unsuccessful extracts
|
---@return string|nil error_message An error message for unsuccessful extracts
|
||||||
---@return string|nil stdout The standard output of the extractor command
|
---@return string|nil stdout The standard output of the extractor command
|
||||||
@ -1034,20 +1043,16 @@ local function list_archive_items_command(
|
|||||||
:output()
|
:output()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- The function to get the items in the archive.
|
-- The function to get if the archive
|
||||||
|
-- file has more than one file in it.
|
||||||
---@param archive_path string The path to the archive file
|
---@param archive_path string The path to the archive file
|
||||||
---@param config Configuration The configuration object
|
---@param config Configuration The configuration object
|
||||||
---@param files_only boolean|nil Whether to only get the files in the archive
|
---@return boolean|nil has_one_file Whether the archive file has one file in it
|
||||||
---@return string[] archive_items The list of archive items
|
|
||||||
---@return string[] directories The list of directories in the archive
|
|
||||||
---@return string|nil error_message The error message for an incorrect password
|
---@return string|nil error_message The error message for an incorrect password
|
||||||
---@return string|nil correct_password The correct password to the archive
|
---@return string|nil correct_password The correct password to the archive
|
||||||
local function get_archive_items(archive_path, config, files_only)
|
local function archive_only_has_one_file(archive_path, config)
|
||||||
--
|
--
|
||||||
|
|
||||||
-- Initialise the files only flag to false if it's not given
|
|
||||||
files_only = files_only or false
|
|
||||||
|
|
||||||
-- The function to list the items in the archive
|
-- The function to list the items in the archive
|
||||||
local function list_items_in_archive(password, configuration, _)
|
local function list_items_in_archive(password, configuration, _)
|
||||||
return list_archive_items_command(
|
return list_archive_items_command(
|
||||||
@ -1058,9 +1063,9 @@ local function get_archive_items(archive_path, config, files_only)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Initialise the list of archive items
|
-- Initialise the list of files in the archive
|
||||||
---@type string[]
|
---@type string[]
|
||||||
local archive_items = {}
|
local files = {}
|
||||||
|
|
||||||
-- Initialise the list of directories
|
-- Initialise the list of directories
|
||||||
---@type string[]
|
---@type string[]
|
||||||
@ -1073,12 +1078,9 @@ local function get_archive_items(archive_path, config, files_only)
|
|||||||
|
|
||||||
-- If the extractor command was not successful,
|
-- If the extractor command was not successful,
|
||||||
-- or the output was nil,
|
-- or the output was nil,
|
||||||
-- then return the empty list of archive items,
|
-- then return nil the error message,
|
||||||
-- the empty list of directories in the archive,
|
-- and nil as the correct password
|
||||||
-- the error message, and nil as the correct password
|
if not successful or not output then return nil, error_message, nil end
|
||||||
if not successful or not output then
|
|
||||||
return archive_items, directories, error_message, nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Otherwise, split the output at the newline character
|
-- Otherwise, split the output at the newline character
|
||||||
local output_lines = string_split(output, "\n")
|
local output_lines = string_split(output, "\n")
|
||||||
@ -1104,20 +1106,34 @@ local function get_archive_items(archive_path, config, files_only)
|
|||||||
-- Add the directory to the list of directories
|
-- Add the directory to the list of directories
|
||||||
table.insert(directories, file_path)
|
table.insert(directories, file_path)
|
||||||
|
|
||||||
-- Continue the loop if only files are wanted
|
-- Continue the loop
|
||||||
if files_only then goto continue end
|
goto continue
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Otherwise, add the file path to the list of archive items
|
-- Otherwise, add the file path to the list of archive items
|
||||||
table.insert(archive_items, file_path)
|
table.insert(files, file_path)
|
||||||
|
|
||||||
-- The continue label to continue the loop
|
-- The continue label to continue the loop
|
||||||
::continue::
|
::continue::
|
||||||
|
|
||||||
|
-- If there is more than 1 file in the archive
|
||||||
|
-- then break out of the loop
|
||||||
|
if #files > 1 then break end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return the list of archive items, the list of directories,
|
-- If there are no files in the archive,
|
||||||
-- nil for the error message and the correct password
|
-- return nil, an error saying that there's
|
||||||
return archive_items, directories, nil, password
|
-- no files in the archive, and the password
|
||||||
|
if #files == 0 then return nil, "No files in the archive!", password end
|
||||||
|
|
||||||
|
-- If there is only one file in the archive and no directories,
|
||||||
|
-- then return true, the error message, and the password
|
||||||
|
if #files == 1 and #directories == 0 then
|
||||||
|
return true, error_message, password
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Otherwise, return false, the error message and the password
|
||||||
|
return false, error_message, password
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Function to get a temporary name.
|
-- Function to get a temporary name.
|
||||||
@ -1151,18 +1167,20 @@ local function get_temporary_directory_url(file_path)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- The extract command to extract an archive
|
-- The extract command to extract an archive
|
||||||
---@param archive_path string
|
---@param archive_path string The path to the archive
|
||||||
---@param destination_directory_path string
|
---@param destination_directory_path string The destination folder
|
||||||
---@param config Configuration
|
---@param config Configuration The configuration object
|
||||||
---@param password string|nil
|
---@param password string|nil The password to the archive
|
||||||
---@param extract_files_only boolean|nil
|
---@param extract_files_only boolean|nil Extract the files only or not
|
||||||
|
---@param extract_behaviour ExtractBehaviour|nil The extraction behaviour
|
||||||
---@return CommandOutput, integer
|
---@return CommandOutput, integer
|
||||||
local function extract_command(
|
local function extract_command(
|
||||||
archive_path,
|
archive_path,
|
||||||
destination_directory_path,
|
destination_directory_path,
|
||||||
config,
|
config,
|
||||||
password,
|
password,
|
||||||
extract_files_only
|
extract_files_only,
|
||||||
|
extract_behaviour
|
||||||
)
|
)
|
||||||
--
|
--
|
||||||
|
|
||||||
@ -1172,6 +1190,9 @@ local function extract_command(
|
|||||||
-- Initialise the extract files only flag to false if it's not given
|
-- Initialise the extract files only flag to false if it's not given
|
||||||
extract_files_only = extract_files_only or false
|
extract_files_only = extract_files_only or false
|
||||||
|
|
||||||
|
-- Initialise the extract behaviour to rename if it's not given
|
||||||
|
extract_behaviour = extract_behaviour or ExtractBehaviour.Rename
|
||||||
|
|
||||||
-- Initialise the extraction mode to use.
|
-- Initialise the extraction mode to use.
|
||||||
-- By default, it extracts the archive with
|
-- By default, it extracts the archive with
|
||||||
-- full paths, which keeps the archive structure.
|
-- full paths, which keeps the archive structure.
|
||||||
@ -1197,8 +1218,8 @@ local function extract_command(
|
|||||||
-- Assume yes to all prompts
|
-- Assume yes to all prompts
|
||||||
"-y",
|
"-y",
|
||||||
|
|
||||||
-- Configure the extraction behaviour to rename
|
-- Configure the extraction behaviour
|
||||||
"-aou",
|
extract_behaviour,
|
||||||
|
|
||||||
-- Pass the password to the command
|
-- Pass the password to the command
|
||||||
"-p" .. password,
|
"-p" .. password,
|
||||||
@ -1461,8 +1482,8 @@ local function extract_archive(archive_path, config)
|
|||||||
local error_message = nil
|
local error_message = nil
|
||||||
|
|
||||||
-- Get the list of archive items, the error message and the password
|
-- Get the list of archive items, the error message and the password
|
||||||
local archive_items, archive_directories, archive_error, correct_password =
|
local has_only_one_file, archive_error, correct_password =
|
||||||
get_archive_items(archive_path, config, true)
|
archive_only_has_one_file(archive_path, config)
|
||||||
|
|
||||||
-- Initialise the extracted items path to nil
|
-- Initialise the extracted items path to nil
|
||||||
local extracted_items_path = nil
|
local extracted_items_path = nil
|
||||||
@ -1470,14 +1491,13 @@ local function extract_archive(archive_path, config)
|
|||||||
-- If there are no files in the archive,
|
-- If there are no files in the archive,
|
||||||
-- then return the successful variable,
|
-- then return the successful variable,
|
||||||
-- the error message, and the extracted items path
|
-- the error message, and the extracted items path
|
||||||
if #archive_items == 0 then
|
if has_only_one_file == nil then
|
||||||
return successful, archive_error, extracted_items_path
|
return successful, archive_error, extracted_items_path
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Otherwise, if the number of archive items is 1,
|
-- Otherwise, the archive only has one file,
|
||||||
-- and the number of directories in the archive is 0,
|
|
||||||
-- then set the files only flag to true
|
-- then set the files only flag to true
|
||||||
if #archive_items == 1 and #archive_directories == 0 then
|
if has_only_one_file then
|
||||||
extract_files_only = true
|
extract_files_only = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1509,6 +1529,26 @@ local function extract_archive(archive_path, config)
|
|||||||
return successful, "Archive file name is empty", extracted_items_path
|
return successful, "Archive file name is empty", extracted_items_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Initialise the extract behaviour to rename
|
||||||
|
local extract_behaviour = ExtractBehaviour.Rename
|
||||||
|
|
||||||
|
-- Initialise the test archive boolean to true
|
||||||
|
local test_archive = true
|
||||||
|
|
||||||
|
-- Get the size of the archive
|
||||||
|
local archive_size = fs.cha(archive_url).length
|
||||||
|
|
||||||
|
-- If the size of the archive is greater than 50 MiB
|
||||||
|
if archive_size > 50 * 1024 * 1024 then
|
||||||
|
--
|
||||||
|
|
||||||
|
-- Set the extract behaviour to overwrite
|
||||||
|
extract_behaviour = ExtractBehaviour.Overwrite
|
||||||
|
|
||||||
|
-- Set the test archive boolean to false
|
||||||
|
test_archive = false
|
||||||
|
end
|
||||||
|
|
||||||
-- Create the extractor command
|
-- Create the extractor command
|
||||||
local function extractor_command(password, configuration)
|
local function extractor_command(password, configuration)
|
||||||
return extract_command(
|
return extract_command(
|
||||||
@ -1516,7 +1556,8 @@ local function extract_archive(archive_path, config)
|
|||||||
tostring(temporary_directory_url),
|
tostring(temporary_directory_url),
|
||||||
configuration,
|
configuration,
|
||||||
password,
|
password,
|
||||||
extract_files_only
|
extract_files_only,
|
||||||
|
extract_behaviour
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1525,7 +1566,7 @@ local function extract_archive(archive_path, config)
|
|||||||
extractor_command,
|
extractor_command,
|
||||||
config,
|
config,
|
||||||
correct_password,
|
correct_password,
|
||||||
true,
|
test_archive,
|
||||||
archive_path
|
archive_path
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1916,11 +1957,11 @@ local function fix_bat_default_pager_shell_command(command)
|
|||||||
-- when replacing the less command when it is quoted
|
-- when replacing the less command when it is quoted
|
||||||
local modified_command, replacement_count = command:gsub(
|
local modified_command, replacement_count = command:gsub(
|
||||||
"("
|
"("
|
||||||
.. bat_command_with_pager_pattern
|
.. bat_command_with_pager_pattern
|
||||||
.. "['\"]+%s*"
|
.. "['\"]+%s*"
|
||||||
.. ")"
|
.. ")"
|
||||||
.. "less"
|
.. "less"
|
||||||
.. "(%s*['\"]+)",
|
.. "(%s*['\"]+)",
|
||||||
"%1" .. bat_default_pager_command_without_f_flag .. "%2"
|
"%1" .. bat_default_pager_command_without_f_flag .. "%2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -17,13 +17,9 @@ local function setup(_, opts)
|
|||||||
return v4("bar", ui.Rect.default, ui.Bar.TOP)
|
return v4("bar", ui.Rect.default, ui.Bar.TOP)
|
||||||
end
|
end
|
||||||
|
|
||||||
return ui.Bar(
|
return v4(
|
||||||
ui.Rect({
|
"bar",
|
||||||
x = x,
|
ui.Rect { x = x, y = math.max(0, y), w = ya.clamp(0, self._area.w - x, 1), h = math.min(1, self._area.h) },
|
||||||
y = math.max(0, y),
|
|
||||||
w = ya.clamp(0, self._area.w - x, 1),
|
|
||||||
h = math.min(1, self._area.h),
|
|
||||||
}),
|
|
||||||
ui.Bar.TOP
|
ui.Bar.TOP
|
||||||
):symbol(c)
|
):symbol(c)
|
||||||
end
|
end
|
||||||
@ -37,9 +33,9 @@ local function setup(_, opts)
|
|||||||
|
|
||||||
local style = THEME.manager.border_style
|
local style = THEME.manager.border_style
|
||||||
self._base = ya.list_merge(self._base or {}, {
|
self._base = ya.list_merge(self._base or {}, {
|
||||||
ui.Border(self._area, ui.Border.ALL):type(type):style(style),
|
v4("border", self._area, ui.Border.ALL):type(type):style(style),
|
||||||
ui.Bar(self._chunks[1], ui.Bar.RIGHT):style(style),
|
v4("bar", self._chunks[1], ui.Bar.RIGHT):style(style),
|
||||||
ui.Bar(self._chunks[3], ui.Bar.LEFT):style(style),
|
v4("bar", self._chunks[3], ui.Bar.LEFT):style(style),
|
||||||
|
|
||||||
bar("┬", c[1].right - 1, c[1].y),
|
bar("┬", c[1].right - 1, c[1].y),
|
||||||
bar("┴", c[1].right - 1, c[1].bottom - 1),
|
bar("┴", c[1].right - 1, c[1].bottom - 1),
|
||||||
|
|||||||
@ -42,7 +42,7 @@ function M:peek()
|
|||||||
)
|
)
|
||||||
else
|
else
|
||||||
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
|
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
|
||||||
ya.preview_widgets(self, { ui.Paragraph.parse(self.area, lines) })
|
ya.preview_widgets(self, { ui.Text.parse(lines):area(self.area) })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ function M:fallback_to_builtin()
|
|||||||
ya.manager_emit("peek", { bound, only_if = self.file.url, upper_bound = true })
|
ya.manager_emit("peek", { bound, only_if = self.file.url, upper_bound = true })
|
||||||
elseif err and not err:find("cancelled", 1, true) then
|
elseif err and not err:find("cancelled", 1, true) then
|
||||||
ya.preview_widgets(self, {
|
ya.preview_widgets(self, {
|
||||||
ui.Paragraph(self.area, { ui.Line(err):reverse() }),
|
ui.Text({ ui.Line(err):reverse() }):area(self.area),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
themes/zathura-gruvbox-light
|
themes/rose-pine
|
||||||
0
dotter.arm
Normal file → Executable file
0
dotter.arm
Normal file → Executable file
0
dotter.exe
Normal file → Executable file
0
dotter.exe
Normal file → Executable file
Loading…
Reference in New Issue
Block a user