Update 2024-12-21

This commit is contained in:
Kristofers Solo 2024-12-21 19:33:54 +02:00
parent 9e0be0285a
commit 56d085310f
32 changed files with 210 additions and 137 deletions

0
config/HybridBar/scripts/change-active-workspace Executable file → Normal file
View File

0
config/HybridBar/scripts/get-active-workspace Executable file → Normal file
View File

0
config/HybridBar/scripts/get-window-title Executable file → Normal file
View File

0
config/HybridBar/scripts/get-workspaces Executable file → Normal file
View File

View File

@ -57,7 +57,7 @@ update_ms = 500
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
proc_sorting = "memory"
proc_sorting = "cpu direct"
#* Reverse sorting order, True or False.
proc_reversed = False

View File

@ -22,18 +22,18 @@
### Geometry ###
# dynamic width from 0 to 300
width = (0, 300)
width = 400
# constant width of 300
# width = 300
# The maximum height of a single notification, excluding the frame.
height = 300
height = 200
# Position the notification in the top right corner
origin = top-right
# Offset from the origin
offset = 5x25
offset = (5, 5)
# Scale factor. It is auto-detected if value is 0.
scale = 0
@ -55,13 +55,13 @@
progress_bar_frame_width = 1
# Set the minimum width for the progress bar
progress_bar_min_width = 150
progress_bar_min_width = 380
# Set the maximum width for the progress bar
progress_bar_max_width = 300
progress_bar_max_width = 380
# Corner radius for the progress bar. 0 disables rounded corners.
progress_bar_corner_radius = 0
progress_bar_corner_radius = 2
# Corner radius for the icon image.
icon_corner_radius = 0
@ -85,7 +85,7 @@
padding = 10
# Horizontal padding.
horizontal_padding = 10
horizontal_padding = 5
# Padding between text and icon.
text_icon_padding = 0
@ -208,7 +208,7 @@
enable_recursive_icon_lookup = true
# Set icon theme (only used for recursive icon lookup)
icon_theme = Papirus
icon_theme = "rose-pine-icons"
# You can also set multiple icon themes, with the leftmost one being used first.
# icon_theme = "Adwaita, breeze"

View File

@ -1,7 +1,7 @@
[global]
width = 400
offset = 5x5
offset = (5, 5)
progress_bar_min_width = 380
progress_bar_max_width = 380
progress_bar_corner_radius = 2
@ -10,11 +10,11 @@
horizontal_padding = 10
frame_width = 1
gap_size = 3
font = "Monospace 14"
font = "JetBrainsMono NF 14"
icon_theme = "rose-pine-icons"
enable_recursive_icon_lookup = true
corner_radius = 2
corner_radius = 20
background = "#26233a"
foreground = "#e0def4"

0
config/eww/scripts/change-active-workspace Executable file → Normal file
View File

0
config/eww/scripts/get-active-workspace Executable file → Normal file
View File

0
config/eww/scripts/get-music Executable file → Normal file
View File

0
config/eww/scripts/get-network Executable file → Normal file
View File

0
config/eww/scripts/get-window-title Executable file → Normal file
View File

0
config/eww/scripts/get-workspaces Executable file → Normal file
View File

0
config/eww/scripts/getvol Executable file → Normal file
View File

0
config/eww/scripts/github Executable file → Normal file
View File

0
config/lf/cleaner Executable file → Normal file
View File

0
config/lf/lfrc Executable file → Normal file
View File

0
config/nsxiv/exec/image-info Executable file → Normal file
View File

0
config/nsxiv/exec/key-handler Executable file → Normal file
View File

0
config/nsxiv/exec/nsxiv-url Executable file → Normal file
View File

0
config/nsxiv/exec/thumb-info Executable file → Normal file
View File

0
config/nsxiv/exec/win-title Executable file → Normal file
View File

2
config/x11/opt-apps Executable file → Normal file
View File

@ -1,6 +1,6 @@
#!/bin/sh
autostart="picom nextcloud discord transmission-daemon floorp discord syncthing mullvad-vpn spotify-launcher"
autostart="picom nextcloud transmission-daemon floorp discord syncthing mullvad-vpn spotify-launcher kotatogram-desktop easyeffects"
for program in $autostart; do
pidof -sx "$program" || "$program" &

View File

@ -6,16 +6,16 @@ deps = [
{use = "Reledia/miller", rev = "40e0265" },
{use = "Sonico98/exifaudio", rev = "d794614" },
{use = "dedukun/relative-motions", rev = "df97039" },
{use = "hankertrix/augment-command", rev = "4d64860" },
{use = "hankertrix/augment-command", rev = "369f992" },
{use = "imsi32/yatline", rev = "1b4a9a1" },
{use = "kirasok/torrent-preview", rev = "76970b6" },
{use = "ndtoan96/ouch", rev = "b869886" },
{use = "pirafrank/what-size", rev = "f08f7f2" },
{use = "yazi-rs/plugins:chmod", rev = "ec97f88" },
{use = "yazi-rs/plugins:full-border", rev = "ec97f88" },
{use = "yazi-rs/plugins:git", rev = "ec97f88" },
{use = "yazi-rs/plugins:hide-preview", rev = "ec97f88" },
{use = "yazi-rs/plugins:max-preview", rev = "ec97f88" },
{use = "yazi-rs/plugins:chmod", rev = "7afba3a" },
{use = "yazi-rs/plugins:full-border", rev = "7afba3a" },
{use = "yazi-rs/plugins:git", rev = "7afba3a" },
{use = "yazi-rs/plugins:hide-preview", rev = "7afba3a" },
{use = "yazi-rs/plugins:max-preview", rev = "7afba3a" },
]
[flavor]

View File

@ -6,6 +6,19 @@
-- The type for the arguments
---@alias Arguments table<string|number, string|number|boolean>
-- The type for the job object
---@alias Job string[] | { args: Arguments }
-- The type for the input event
--
-- The event for the input function
-- can be one of 3 values:
-- 0: Unknown error
-- 1: The user has confirmed the input
-- 2: The user has cancelled the input
-- 3: The user has changed the input (only if realtime is true)
---@alias InputEvent integer
-- The type for the extractor command
---@alias ExtractorFunction fun(
--- password: string|nil,
@ -13,6 +26,32 @@
-- Custom types
-- The type of the user configuration table
-- The user configuration for the plugin
---@class (exact) UserConfiguration
---@field prompt boolean Whether or not to prompt the user
---@field default_item_group_for_prompt ItemGroup The default prompt item group
---@field smart_enter boolean Whether to use smart enter
---@field smart_paste boolean Whether to use smart paste
---@field smart_tab_create boolean Whether to use smart tab create
---@field smart_tab_switch boolean Whether to use smart tab switch
---@field enter_archives boolean Whether to enter archives
---@field extract_retries number How many times to retry extracting
---@field extract_archives_recursively boolean Re-extract inner archives or not
---@field must_have_hovered_item boolean Whether to stop when no item is hovered
---@field skip_single_subdirectory_on_enter boolean Skip single subdir on enter
---@field skip_single_subdirectory_on_leave boolean Skip single subdir on leave
---@field ignore_hidden_items boolean Whether to ignore hidden items
---@field wraparound_file_navigation boolean Have wraparound navigation or not
---@field sort_directories_first boolean Informs the plugin if dirs are first
-- The additional data passed to the function to initialise the configuration
---@class (exact) AdditionalData
---@field extractor_command string The extractor shell command, like 7z
-- The full configuration for the plugin
---@class (exact) Configuration: UserConfiguration, AdditionalData
-- The type for the state
---@class (exact) State
---@field config Configuration
@ -83,24 +122,10 @@ local ExtractBehaviour = {
RenameExisting = "-aot",
}
-- The user configuration for the plugin
-- The default configuration for the plugin
---@class (exact) Configuration
---@field prompt boolean
---@field default_item_group_for_prompt ItemGroup
---@field smart_enter boolean
---@field smart_paste boolean
---@field smart_tab_create boolean
---@field smart_tab_switch boolean
---@field enter_archives boolean
---@field extract_retries number
---@field extract_archives_recursively boolean
---@field must_have_hovered_item boolean
---@field skip_single_subdirectory_on_enter boolean
---@field skip_single_subdirectory_on_leave boolean
---@field ignore_hidden_items boolean
---@field wraparound_file_navigation boolean
---@field sort_directories_first boolean
---@field extractor_command string
---@type UserConfiguration
local DEFAULT_CONFIG = {
prompt = false,
default_item_group_for_prompt = ItemGroup.Hovered,
@ -340,67 +365,61 @@ local function parse_args(args)
local parsed_arguments = {}
-- Iterates over the arguments given
for index, argument in ipairs(args) do
for _, argument in ipairs(args) do
--
-- If the index isn't 1,
-- which means it is the arguments to the command given
if index ~= 1 then
-- If the argument doesn't start with a double dash
if not argument:find(double_dash_pattern) then
--
-- If the argument doesn't start with a double dash
if not argument:find(double_dash_pattern) then
--
-- Try to convert the argument to a number
local number_argument = tonumber(argument)
-- Try to convert the argument to a number
local number_argument = tonumber(argument)
-- Add the argument to the list of options
table.insert(
parsed_arguments,
number_argument and number_argument or argument
)
-- Add the argument to the list of options
table.insert(
parsed_arguments,
number_argument and number_argument or argument
)
-- Continue the loop
goto continue
end
-- Otherwise, remove the double dash from the front of the argument
local cleaned_argument = argument:gsub(double_dash_pattern, "")
-- Replace all of the dashes with underscores
cleaned_argument = cleaned_argument:gsub("%-", "_")
-- Split the arguments at the = character
local arg_name, arg_value =
table.unpack(string_split(cleaned_argument, "="))
-- If the argument value is nil
if arg_value == nil then
--
-- Set the argument name to the cleaned argument
arg_name = cleaned_argument
-- Set the argument value to true
arg_value = true
-- Otherwise
else
--
-- Try to convert the argument value to a number
local number_arg_value = tonumber(arg_value)
-- Set the argument value to the number
-- if the the argument value can be converted to a number
arg_value = number_arg_value and number_arg_value or arg_value
end
-- Add the argument name and value to the options
parsed_arguments[arg_name] = arg_value
-- Continue the loop
goto continue
end
-- Otherwise, remove the double dash from the front of the argument
local cleaned_argument = argument:gsub(double_dash_pattern, "")
-- Replace all of the dashes with underscores
cleaned_argument = cleaned_argument:gsub("%-", "_")
-- Split the arguments at the = character
local arg_name, arg_value =
table.unpack(string_split(cleaned_argument, "="))
-- If the argument value is nil
if arg_value == nil then
--
-- Set the argument name to the cleaned argument
arg_name = cleaned_argument
-- Set the argument value to true
arg_value = true
-- Otherwise
else
--
-- Try to convert the argument value to a number
local number_arg_value = tonumber(arg_value)
-- Set the argument value to the number
-- if the the argument value can be converted to a number
arg_value = number_arg_value and number_arg_value or arg_value
end
-- Add the argument name and value to the options
parsed_arguments[arg_name] = arg_value
-- The label to continue the loop
::continue::
end
@ -409,9 +428,39 @@ local function parse_args(args)
return parsed_arguments
end
-- Function to warn the user
---@param warning string The warning message
---@return nil
local function warn_user(warning)
return ya.notify(merge_tables(DEFAULT_NOTIFICATION_OPTIONS, {
content = warning,
level = "warn",
}))
end
-- Function to show an error
---@param error_message string The error message
---@return nil
local function show_error(error_message)
return ya.notify(merge_tables(DEFAULT_NOTIFICATION_OPTIONS, {
content = error_message,
level = "error",
}))
end
-- Function to get the user's input
---@param prompt string The prompt to show to the user
---@return string|nil user_input The user's input
---@return InputEvent event The event for the input function
local function get_user_input(prompt)
return ya.input(merge_tables(DEFAULT_INPUT_OPTIONS, {
title = prompt,
}))
end
-- Function to merge the given configuration table with the default one
---@param config Configuration|nil The configuration table to merge
---@return Configuration merged_config The merged configuration table
---@param config UserConfiguration|nil The configuration table to merge
---@return UserConfiguration merged_config The merged configuration table
local function merge_configuration(config)
--
@ -458,12 +507,11 @@ local function merge_configuration(config)
-- then return the merged configuration
if #invalid_configuration_options <= 0 then return merged_config end
-- Otherwise, notify the user of the invalid configuration options
ya.notify(merge_tables(DEFAULT_NOTIFICATION_OPTIONS, {
content = "Invalid configuration options: "
.. table.concat(invalid_configuration_options, ", "),
level = "warn",
}))
-- Otherwise, warn the user of the invalid configuration options
warn_user(
"Invalid configuration options: "
.. table.concat(invalid_configuration_options, ", ")
)
-- Return the merged configuration
return merged_config
@ -472,7 +520,7 @@ end
-- Function to initialise the configuration
---@param state State The state object
---@param user_config Configuration|nil The configuration object
---@param additional_data table<string, string|number|boolean> Additional data
---@param additional_data AdditionalData The additional data
---@return Configuration config The initialised configuration object
local initialise_config = ya.sync(function(state, user_config, additional_data)
--
@ -489,7 +537,7 @@ end)
-- The function to try if a shell command exists
---@param shell_command string The shell command to check
---@return boolean Whether the shell command exists
---@return boolean shell_command_exists Whether the shell command exists
local function shell_command_exists(shell_command)
--
@ -811,9 +859,12 @@ local function prompt_for_desired_item_group()
if default_item_group == ItemGroup.None then default_item_group = nil end
-- Prompt the user for their input
local user_input, event = ya.input(merge_tables(DEFAULT_INPUT_OPTIONS, {
title = "Operate on hovered or selected items? " .. input_options,
}))
local user_input, event = get_user_input(
"Operate on hovered or selected items? " .. input_options
)
-- If the user input is empty, then exit the function
if not user_input then return end
-- Lowercase the user's input
user_input = user_input:lower()
@ -1067,14 +1118,14 @@ local function retry_extractor(
end
-- Ask the user for the password
local user_input, event = ya.input(merge_tables(DEFAULT_INPUT_OPTIONS, {
title = tries == 0 and initial_password_prompt
or wrong_password_prompt,
}))
local user_input, event = get_user_input(
tries == 0 and initial_password_prompt or wrong_password_prompt
)
-- If the user has confirmed the input,
-- and the user input is not nil,
-- set the password to the user's input
if event == 1 then
if event == 1 and user_input ~= nil then
password = user_input
-- Otherwise, return false, the error message,
@ -1885,13 +1936,12 @@ local function handle_open(args, config, command_table)
-- If the extraction is not successful, notify the user
if not extraction_result.successful then
ya.notify(merge_tables(DEFAULT_NOTIFICATION_OPTIONS, {
content = "Failed to extract archive at: "
show_error(
"Failed to extract archive at: "
.. extraction_result.archive_path
.. "\nError: "
.. extraction_result.error_message,
level = "error",
}))
.. extraction_result.error_message
)
end
end
@ -2374,7 +2424,7 @@ end)
-- Function to handle the tab switch command
---@param args Arguments The arguments passed to the plugin
---@return nil
local function handle_tab_switch(args, config)
local function handle_tab_switch(args)
--
-- Call the function to execute the tab switch command
@ -2688,20 +2738,46 @@ local function run_command_func(command, args, config)
-- If the function isn't found, notify the user and exit the function
if not command_func then
return ya.notify(merge_tables(DEFAULT_NOTIFICATION_OPTIONS, {
content = "Unknown command: " .. command,
level = "error",
}))
return show_error("Unknown command: " .. command)
end
-- Parse the arguments and set it to the args variable
---@type Arguments
args = parse_args(args)
-- Otherwise, call the function for the command
command_func(args, config, command_table)
end
-- The function to handle the arguments from the job object
---@param job Job The job object given by Yazi
---@return Arguments args The arguments from the job object
local function get_args_from_job(job)
--
-- If the job object has no argument field
-- that means the arguments are given
-- as a list of strings (Yazi v0.3.x and below)
if not job.args then
return parse_args(job)
-- Otherwise, the arguments are given as a table (Yazi v0.4.x and above)
else
--
-- Get the string arguments from the job object
local string_args = job.args.args
-- If the string arguments are nil,
-- then return the job arguments
if not string_args then return job.args end
-- Otherwise, if the string arguments are not a string,
-- return an empty table of arguments
if type(string_args) ~= "string" then return {} end
-- Otherwise, split the string arguments, parse them,
-- and return the result
return parse_args(string_split(string_args, " "))
end
end
-- The setup function to setup the plugin
---@param _ any
---@param opts Configuration|nil The options given to the plugin
@ -2715,18 +2791,22 @@ end
-- The function to be called to use the plugin
---@param _ any
---@param args string[] The list of string arguments given by Yazi
---@param job Job The job object given by Yazi
---@return nil
local function entry(_, args)
local function entry(_, job)
--
-- Gets the command passed to the plugin
local command = args[1]
-- Get the arguments to the plugin
---@type Arguments
local args = get_args_from_job(job)
-- Get the command passed to the plugin
local command = table.remove(args, 1)
-- If the command isn't given, exit the function
if not command then return end
-- Gets the configuration object
-- Get the configuration object
local config = get_config()
-- If the configuration hasn't been initialised yet,

View File

@ -1,7 +1,7 @@
# git.yazi
> [!NOTE]
> Yazi v0.3.3 or later is required for this plugin to work.
> Yazi v0.4.1 or later is required for this plugin to work.
Show the status of Git file changes as linemode in the file list.
@ -37,9 +37,6 @@ run = "git"
## Advanced
> [!NOTE]
> This section currently requires Yazi nightly that includes https://github.com/sxyazi/yazi/pull/1637
You can customize the [Style](https://yazi-rs.github.io/docs/plugins/layout#style) of the status sign with:
- `THEME.git.modified`

View File

@ -17,9 +17,7 @@ Add this to your `~/.config/yazi/keymap.toml`:
```toml
[[manager.prepend_keymap]]
on = "T"
run = "plugin --sync hide-preview"
# For upcoming Yazi 0.4 (nightly version):
# run = "plugin hide-preview"
run = "plugin hide-preview"
desc = "Hide or show preview"
```

View File

@ -17,9 +17,7 @@ Add this to your `~/.config/yazi/keymap.toml`:
```toml
[[manager.prepend_keymap]]
on = "T"
run = "plugin --sync max-preview"
# For upcoming Yazi 0.4 (nightly version):
# run = "plugin max-preview"
run = "plugin max-preview"
desc = "Maximize or restore preview"
```

0
dotter Executable file → Normal file
View File

0
dotter.arm Executable file → Normal file
View File

0
dotter.exe Executable file → Normal file
View File

0
local/bin/typst-port Normal file → Executable file
View File