diff --git a/config/HybridBar/scripts/change-active-workspace b/config/HybridBar/scripts/change-active-workspace old mode 100644 new mode 100755 diff --git a/config/HybridBar/scripts/get-active-workspace b/config/HybridBar/scripts/get-active-workspace old mode 100644 new mode 100755 diff --git a/config/HybridBar/scripts/get-window-title b/config/HybridBar/scripts/get-window-title old mode 100644 new mode 100755 diff --git a/config/HybridBar/scripts/get-workspaces b/config/HybridBar/scripts/get-workspaces old mode 100644 new mode 100755 diff --git a/config/eww/scripts/change-active-workspace b/config/eww/scripts/change-active-workspace old mode 100644 new mode 100755 diff --git a/config/eww/scripts/get-active-workspace b/config/eww/scripts/get-active-workspace old mode 100644 new mode 100755 diff --git a/config/eww/scripts/get-music b/config/eww/scripts/get-music old mode 100644 new mode 100755 diff --git a/config/eww/scripts/get-network b/config/eww/scripts/get-network old mode 100644 new mode 100755 diff --git a/config/eww/scripts/get-window-title b/config/eww/scripts/get-window-title old mode 100644 new mode 100755 diff --git a/config/eww/scripts/get-workspaces b/config/eww/scripts/get-workspaces old mode 100644 new mode 100755 diff --git a/config/eww/scripts/getvol b/config/eww/scripts/getvol old mode 100644 new mode 100755 diff --git a/config/eww/scripts/github b/config/eww/scripts/github old mode 100644 new mode 100755 diff --git a/config/lf/cleaner b/config/lf/cleaner old mode 100644 new mode 100755 diff --git a/config/lf/lfrc b/config/lf/lfrc old mode 100644 new mode 100755 diff --git a/config/nsxiv/exec/image-info b/config/nsxiv/exec/image-info old mode 100644 new mode 100755 diff --git a/config/nsxiv/exec/key-handler b/config/nsxiv/exec/key-handler old mode 100644 new mode 100755 diff --git a/config/nsxiv/exec/nsxiv-url b/config/nsxiv/exec/nsxiv-url old mode 100644 new mode 100755 diff --git a/config/nsxiv/exec/thumb-info b/config/nsxiv/exec/thumb-info old mode 100644 new mode 100755 diff --git a/config/nsxiv/exec/win-title b/config/nsxiv/exec/win-title old mode 100644 new mode 100755 diff --git a/config/x11/opt-apps b/config/x11/opt-apps old mode 100644 new mode 100755 diff --git a/config/yazi/init.lua b/config/yazi/init.lua index bdf6db08..06f84395 100644 --- a/config/yazi/init.lua +++ b/config/yazi/init.lua @@ -1,6 +1,5 @@ require("relative-motions"):setup({ show_numbers = "relative", show_motion = true }) require("full-border"):setup() -require("starship"):setup() require("augment-command"):setup({ prompt = false, default_item_group_for_prompt = "hovered", diff --git a/config/yazi/package.toml b/config/yazi/package.toml index cf3d3b8b..8f33775a 100644 --- a/config/yazi/package.toml +++ b/config/yazi/package.toml @@ -1,13 +1,12 @@ [plugin] deps = [ {use = "AnirudhG07/nbpreview", rev = "52a14b3"}, - {use = "Reledia/glow", rev = "d8b36ff"}, + {use = "Reledia/glow", rev = "f52b382"}, {use = "Reledia/hexyl", rev = "ccc0a4a"}, {use = "Reledia/miller", rev = "40e0265"}, - {use = "Rolv-Apneseth/starship", rev = "77a65f5"}, {use = "Sonico98/exifaudio", rev = "d75db46"}, {use = "dedukun/relative-motions", rev = "6aecfcd"}, - {use = "hankertrix/augment-command", rev = "b0f113d"}, + {use = "hankertrix/augment-command", rev = "7ea8dde"}, {use = "imsi32/yatline", rev = "7b56434"}, {use = "kirasok/torrent-preview", rev = "76970b6"}, {use = "ndtoan96/ouch", rev = "251da69"}, diff --git a/config/yazi/plugins/augment-command.yazi/init.lua b/config/yazi/plugins/augment-command.yazi/init.lua index 3c38d6fe..d9980fba 100644 --- a/config/yazi/plugins/augment-command.yazi/init.lua +++ b/config/yazi/plugins/augment-command.yazi/init.lua @@ -51,6 +51,16 @@ local Commands = { 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 ---@class (exact) Configuration ---@field prompt boolean @@ -508,8 +518,7 @@ local hovered_item_is_archive = ya.sync(function(_) local hovered_item = cx.active.current.hovered -- Return if the hovered item exists and is an archive - return hovered_item - and is_archive_mime_type(hovered_item:mime()) + return hovered_item and is_archive_mime_type(hovered_item:mime()) end) -- 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 -- and the test encryption is to test the archive password without -- actually executing the given extractor command. ----@param extractor_command function ----@param config Configuration ----@param initial_password string|nil ----@param test_encryption boolean|nil ----@param archive_path string|nil +---@param extractor_command function A function that extracts the archive +---@param config Configuration The configuration object +---@param initial_password string|nil The initial password to try +---@param test_encryption boolean|nil Whether to test the encryption or not +---@param archive_path string|nil The path to the archive file ---@return boolean successful Whether the extraction was successful ---@return string|nil error_message An error message for unsuccessful extracts ---@return string|nil stdout The standard output of the extractor command @@ -1034,20 +1043,16 @@ local function list_archive_items_command( :output() 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 config Configuration The configuration object ----@param files_only boolean|nil Whether to only get the files in the archive ----@return string[] archive_items The list of archive items ----@return string[] directories The list of directories in the archive +---@return boolean|nil has_one_file Whether the archive file has one file in it ---@return string|nil error_message The error message for an incorrect password ---@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 local function list_items_in_archive(password, configuration, _) return list_archive_items_command( @@ -1058,9 +1063,9 @@ local function get_archive_items(archive_path, config, files_only) ) end - -- Initialise the list of archive items + -- Initialise the list of files in the archive ---@type string[] - local archive_items = {} + local files = {} -- Initialise the list of directories ---@type string[] @@ -1073,12 +1078,9 @@ local function get_archive_items(archive_path, config, files_only) -- If the extractor command was not successful, -- or the output was nil, - -- then return the empty list of archive items, - -- the empty list of directories in the archive, - -- the error message, and nil as the correct password - if not successful or not output then - return archive_items, directories, error_message, nil - end + -- then return nil the error message, + -- and nil as the correct password + if not successful or not output then return nil, error_message, nil end -- Otherwise, split the output at the newline character 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 table.insert(directories, file_path) - -- Continue the loop if only files are wanted - if files_only then goto continue end + -- Continue the loop + goto continue end -- 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 ::continue:: + + -- If there is more than 1 file in the archive + -- then break out of the loop + if #files > 1 then break end end - -- Return the list of archive items, the list of directories, - -- nil for the error message and the correct password - return archive_items, directories, nil, password + -- If there are no files in the archive, + -- return nil, an error saying that there's + -- 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 -- Function to get a temporary name. @@ -1151,18 +1167,20 @@ local function get_temporary_directory_url(file_path) end -- The extract command to extract an archive ----@param archive_path string ----@param destination_directory_path string ----@param config Configuration ----@param password string|nil ----@param extract_files_only boolean|nil +---@param archive_path string The path to the archive +---@param destination_directory_path string The destination folder +---@param config Configuration The configuration object +---@param password string|nil The password to the archive +---@param extract_files_only boolean|nil Extract the files only or not +---@param extract_behaviour ExtractBehaviour|nil The extraction behaviour ---@return CommandOutput, integer local function extract_command( archive_path, destination_directory_path, config, 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 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. -- By default, it extracts the archive with -- full paths, which keeps the archive structure. @@ -1197,8 +1218,8 @@ local function extract_command( -- Assume yes to all prompts "-y", - -- Configure the extraction behaviour to rename - "-aou", + -- Configure the extraction behaviour + extract_behaviour, -- Pass the password to the command "-p" .. password, @@ -1461,8 +1482,8 @@ local function extract_archive(archive_path, config) local error_message = nil -- Get the list of archive items, the error message and the password - local archive_items, archive_directories, archive_error, correct_password = - get_archive_items(archive_path, config, true) + local has_only_one_file, archive_error, correct_password = + archive_only_has_one_file(archive_path, config) -- Initialise the extracted items path to 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, -- then return the successful variable, -- 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 end - -- Otherwise, if the number of archive items is 1, - -- and the number of directories in the archive is 0, + -- Otherwise, the archive only has one file, -- 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 end @@ -1509,6 +1529,26 @@ local function extract_archive(archive_path, config) return successful, "Archive file name is empty", extracted_items_path 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 local function extractor_command(password, configuration) return extract_command( @@ -1516,7 +1556,8 @@ local function extract_archive(archive_path, config) tostring(temporary_directory_url), configuration, password, - extract_files_only + extract_files_only, + extract_behaviour ) end @@ -1525,7 +1566,7 @@ local function extract_archive(archive_path, config) extractor_command, config, correct_password, - true, + test_archive, archive_path ) @@ -1916,11 +1957,11 @@ local function fix_bat_default_pager_shell_command(command) -- when replacing the less command when it is quoted local modified_command, replacement_count = command:gsub( "(" - .. bat_command_with_pager_pattern - .. "['\"]+%s*" - .. ")" - .. "less" - .. "(%s*['\"]+)", + .. bat_command_with_pager_pattern + .. "['\"]+%s*" + .. ")" + .. "less" + .. "(%s*['\"]+)", "%1" .. bat_default_pager_command_without_f_flag .. "%2" ) diff --git a/config/yazi/plugins/full-border.yazi/init.lua b/config/yazi/plugins/full-border.yazi/init.lua index 42f88657..958ae67a 100644 --- a/config/yazi/plugins/full-border.yazi/init.lua +++ b/config/yazi/plugins/full-border.yazi/init.lua @@ -17,13 +17,9 @@ local function setup(_, opts) return v4("bar", ui.Rect.default, ui.Bar.TOP) end - return ui.Bar( - 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), - }), + return v4( + "bar", + 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) }, ui.Bar.TOP ):symbol(c) end @@ -37,9 +33,9 @@ local function setup(_, opts) local style = THEME.manager.border_style self._base = ya.list_merge(self._base or {}, { - ui.Border(self._area, ui.Border.ALL):type(type):style(style), - ui.Bar(self._chunks[1], ui.Bar.RIGHT):style(style), - ui.Bar(self._chunks[3], ui.Bar.LEFT):style(style), + v4("border", self._area, ui.Border.ALL):type(type):style(style), + v4("bar", self._chunks[1], ui.Bar.RIGHT):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].bottom - 1), diff --git a/config/yazi/plugins/glow.yazi/init.lua b/config/yazi/plugins/glow.yazi/init.lua index bb383042..da3a75ed 100644 --- a/config/yazi/plugins/glow.yazi/init.lua +++ b/config/yazi/plugins/glow.yazi/init.lua @@ -42,7 +42,7 @@ function M:peek() ) else 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 @@ -63,7 +63,7 @@ function M:fallback_to_builtin() ya.manager_emit("peek", { bound, only_if = self.file.url, upper_bound = true }) elseif err and not err:find("cancelled", 1, true) then ya.preview_widgets(self, { - ui.Paragraph(self.area, { ui.Line(err):reverse() }), + ui.Text({ ui.Line(err):reverse() }):area(self.area), }) end end diff --git a/config/zathura/zathurarc b/config/zathura/zathurarc index 05d6654a..98aa2205 120000 --- a/config/zathura/zathurarc +++ b/config/zathura/zathurarc @@ -1 +1 @@ -themes/zathura-gruvbox-light \ No newline at end of file +themes/rose-pine \ No newline at end of file diff --git a/dotter b/dotter old mode 100644 new mode 100755 diff --git a/dotter.arm b/dotter.arm old mode 100644 new mode 100755 diff --git a/dotter.exe b/dotter.exe old mode 100644 new mode 100755