Update 2024-07-16

This commit is contained in:
Kristofers Solo 2024-07-16 22:42:32 +03:00
parent 8afdbc8322
commit a2bd1bc111
115 changed files with 8299 additions and 1049 deletions

View File

@ -1,64 +1,65 @@
import = ["~/.config/alacritty/rose-pine.toml"]
[colors]
draw_bold_text_with_bright_colors = true
transparent_background_colors = false
[[colors.indexed_colors]]
color = "0xff9e64"
index = 16
# [[colors.indexed_colors]]
# index = 16
# color = "#ff9e64"
[[colors.indexed_colors]]
color = "0xdb4b4b"
index = 17
# [[colors.indexed_colors]]
# index = 17
# color = "#db4b4b"
[colors.bright]
black = "0x414868"
blue = "0x7aa2f7"
cyan = "0x7dcfff"
green = "0x9ece6a"
magenta = "0xbb9af7"
red = "0xf7768e"
white = "0xc0caf5"
yellow = "0xe0af68"
# [colors.bright]
# black = "#414868"
# red = "#f7768e"
# green = "#9ece6a"
# yellow = "#e0af68"
# blue = "#7aa2f7"
# magenta = "#bb9af7"
# cyan = "#7dcfff"
# white = "#c0caf5"
[colors.cursor]
cursor = "CellForeground"
text = "CellBackground"
[colors.hints.end]
background = "#282a36"
foreground = "#f1fa8c"
# [colors.hints.end]
# background = "#282a36"
# foreground = "#f1fa8c"
#
# [colors.hints.start]
# background = "#f1fa8c"
# foreground = "#282a36"
[colors.hints.start]
background = "#f1fa8c"
foreground = "#282a36"
# [colors.normal]
# black = "#15161e"
# red = "#f7768e"
# green = "#9ece6a"
# yellow = "#e0af68"
# blue = "#7aa2f7"
# magenta = "#bb9af7"
# cyan = "#7dcfff"
# white = "#a9b1d6"
[colors.normal]
black = "0x15161e"
blue = "0x7aa2f7"
cyan = "0x7dcfff"
green = "0x9ece6a"
magenta = "0xbb9af7"
red = "0xf7768e"
white = "0xa9b1d6"
yellow = "0xe0af68"
# [colors.primary]
# background = "#1a1b26"
# bright_foreground = "#ffffff"
# dim_foreground = "#828482"
# foreground = "#c0caf5"
[colors.primary]
background = "#1a1b26"
bright_foreground = "#ffffff"
dim_foreground = "#828482"
foreground = "#c0caf5"
[colors.search.focused_match]
background = "#ffb86c"
foreground = "#44475a"
# [colors.search.focused_match]
# background = "#ffb86c"
# foreground = "#44475a"
# [colors.search.footer_bar]
# background = "#282a36"
# foreground = "#f8f8f2"
[colors.search.matches]
background = "#50fa7b"
foreground = "#44475a"
# [colors.search.matches]
# background = "#50fa7b"
# foreground = "#44475a"
[colors.selection]
background = "CellForeground"
@ -203,7 +204,7 @@ decorations = "none"
decorations_theme_variant = "Dark"
dynamic_padding = true
dynamic_title = true
opacity = 0.9
opacity = 0.95
startup_mode = "Windowed"
title = "Alacritty"

View File

@ -1,845 +0,0 @@
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# Import additional configuration files
#
# Imports are loaded in order, skipping all missing files, with the importing
# file being loaded last. If a field is already present in a previous import, it
# will be replaced.
#
# All imports must either be absolute paths starting with `/`, or paths relative
# to the user's home directory starting with `~/`.
#import:
# - /path/to/alacritty.yml
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty itself.
env:
# TERM variable
#
# This value is used to set the `$TERM` environment variable for
# each instance of Alacritty. If it is not present, alacritty will
# check the local terminfo database and use `alacritty` if it is
# available, otherwise `xterm-256color` is used.
TERM: alacritty
# Background opacity
#
# Window opacity as a floating point number from `0.0` to `1.0`.
# The value `0.0` is completely transparent and `1.0` is opaque.
# background_opacity: 0.9
window:
# Window dimensions (changes require restart)
#
# Number of lines/columns (not pixels) in the terminal. The number of columns
# must be at least `2`, while using a value of `0` for columns and lines will
# fall back to the window manager's recommended size.
dimensions:
columns: 0
lines: 0
opacity: 0.9
# Window position (changes require restart)
#
# Specified in number of pixels.
# If the position is not set, the window manager will handle the placement.
#position:
# x: 0
# y: 0
# Window padding (changes require restart)
#
# Blank space added around the window in pixels. This padding is scaled
# by DPI and the specified value is always added at both opposing sides.
padding:
x: 0
y: 0
# Spread additional padding evenly around the terminal content.
dynamic_padding: true
# Window decorations
#
# Values for `decorations`:
# - full: Borders and title bar
# - none: Neither borders nor title bar
#
# Values for `decorations` (macOS only):
# - transparent: Title bar, transparent background and title bar buttons
# - buttonless: Title bar, transparent background and no title bar buttons
decorations: none
# Startup Mode (changes require restart)
#
# Values for `startup_mode`:
# - Windowed
# - Maximized
# - Fullscreen
#
# Values for `startup_mode` (macOS only):
# - SimpleFullscreen
startup_mode: Windowed
# Window title
title: Alacritty
# Allow terminal applications to change Alacritty's window title.
dynamic_title: true
# Window class (Linux/BSD only):
# class:
# Application instance name
# instance: Alacritty
# General application class
# general: Alacritty
# GTK theme variant (Linux/BSD only)
#
# Override the variant of the GTK theme. Commonly supported values are `dark`
# and `light`. Set this to `None` to use the default theme variant.
decorations_theme_variant: Dark
scrolling:
# Maximum number of lines in the scrollback buffer.
# Specifying '0' will disable scrolling.
history: 10000
# Scrolling distance multiplier.
multiplier: 3
# Font configuration
font:
# Normal (roman) font face
normal:
# Font family
#
# Default:
# - (macOS) Menlo
# - (Linux/BSD) monospace
# - (Windows) Consolas
family: JetBrainsMono NF
# The `style` can be specified to pick a specific face.
style: Regular
# Bold font face
bold:
# Font family
#
# If the bold family is not specified, it will fall back to the
# value specified for the normal font.
family: JetBrainsMono NF
# The `style` can be specified to pick a specific face.
style: Bold
# Italic font face
italic:
# Font family
#
# If the italic family is not specified, it will fall back to the
# value specified for the normal font.
family: JetBrainsMono NF
# The `style` can be specified to pick a specific face.
style: Italic
# Bold italic font face
bold_italic:
# Font family
#
# If the bold italic family is not specified, it will fall back to the
# value specified for the normal font.
family: JetBrainsMono NF
# The `style` can be specified to pick a specific face.
style: Bold Italic
# Point size
size: 11.0
# Offset is the extra space around each character. `offset.y` can be thought
# of as modifying the line spacing, and `offset.x` as modifying the letter
# spacing.
offset:
x: 0
y: -1
# Glyph offset determines the locations of the glyphs within their cells with
# the default being at the bottom. Increasing `x` moves the glyph to the
# right, increasing `y` moves the glyph upward.
glyph_offset:
x: 0
y: 0
# Thin stroke font rendering (macOS only)
#
# Thin strokes are suitable for retina displays, but for non-retina screens
# it is recommended to set `use_thin_strokes` to `false`.
# use_thin_strokes: false
# If `true`, bold text is drawn using the bright color variants.
draw_bold_text_with_bright_colors: true
# Colors (Tomorrow Night)
colors:
# Default colors
primary:
# background: "#282a36"
# foreground: "#f8f8f2"
background: "#1a1b26"
foreground: "#c0caf5"
# Bright and dim foreground colors
#
# The dimmed foreground color is calculated automatically if it is not
# present. If the bright foreground color is not set, or
# `draw_bold_text_with_bright_colors` is `false`, the normal foreground
# color will be used.
dim_foreground: "#828482"
bright_foreground: "#ffffff"
# Cursor colors
#
# Colors which should be used to draw the terminal cursor.
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
cursor:
text: CellBackground
cursor: CellForeground
# Vi mode cursor colors
#
# Colors for the cursor when the vi mode is active.
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
vi_mode_cursor:
text: CellBackground
cursor: CellForeground
# Search colors
#
# Colors used for the search bar and match highlighting.
search:
# Allowed values are CellForeground/CellBackground, whichq reference the
# affected cell, or hexadecimal colors like #ff00ff.
matches:
foreground: "#44475a"
background: "#50fa7b"
focused_match:
foreground: "#44475a"
background: "#ffb86c"
footer_bar:
background: "#282a36"
foreground: "#f8f8f2"
# Keyboard regex hints
hints:
# First character in the hint label
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
start:
foreground: "#282a36"
background: "#f1fa8c"
# All characters after the first one in the hint label
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
end:
foreground: "#f1fa8c"
background: "#282a36"
# Line indicator
#
# Color used for the indicator displaying the position in history during
# search and vi mode.
#
# By default, these will use the opposing primary color.
#line_indicator:
# foreground: None
# background: None
# Selection colors
#
# Colors which should be used to draw the selection area.
#
# Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff.
selection:
text: CellBackground
background: CellForeground
# Normal colors
normal:
# black: "#21222c"
# red: "#ff5555"
# green: "#50fa7b"
# yellow: "#f1fa8c"
# blue: "#bd93f9"
# magenta: "#ff79c6"
# cyan: "#8be9fd"
# white: "#f8f8f2"
black: "0x15161e"
red: "0xf7768e"
green: "0x9ece6a"
yellow: "0xe0af68"
blue: "0x7aa2f7"
magenta: "0xbb9af7"
cyan: "0x7dcfff"
white: "0xa9b1d6"
#
# Bright colors
bright:
# black: "#6272a4"
# red: "#ff6e6e"
# green: "#69ff94"
# yellow: "#ffffa5"
# blue: "#d6acff"
# magenta: "#ff92df"
# cyan: "#a4ffff"
# white: "#ffffff"
black: "0x414868"
red: "0xf7768e"
green: "0x9ece6a"
yellow: "0xe0af68"
blue: "0x7aa2f7"
magenta: "0xbb9af7"
cyan: "0x7dcfff"
white: "0xc0caf5"
# Dim colors
#
# If the dim colors are not set, they will be calculated automatically based
# on the `normal` colors.
# dim:
# black: "#676f78"
# red: "#b55454"
# green: "#78a670"
# yellow: "#faf380"
# blue: "#707fd0"
# magenta: "#c583d0"
# cyan: "#8adaf1"
# white: "#e0e3e7"
# Indexed Colors
#
# The indexed colors include all colors from 16 to 256.
# When these are not set, they're filled with sensible defaults.
#
# Example:
# `- { index: 16, color: '#ff00ff' }`
#
indexed_colors:
- {index: 16, color: "0xff9e64"}
- {index: 17, color: "0xdb4b4b"}
# Transparent cell backgrounds
#
# Whether or not `window.opacity` applies to all cell backgrounds or only to
# the default background. When set to `true` all cells will be transparent
# regardless of their background color.
transparent_background_colors: false
# Bell
#
# The bell is rung every time the BEL control character is received.
#bell:
# Visual Bell Animation
#
# Animation effect for flashing the screen when the visual bell is rung.
#
# Values for `animation`:
# - Ease
# - EaseOut
# - EaseOutSine
# - EaseOutQuad
# - EaseOutCubic
# - EaseOutQuart
# - EaseOutQuint
# - EaseOutExpo
# - EaseOutCirc
# - Linear
#animation: EaseOutExpo
# Duration of the visual bell flash in milliseconds. A `duration` of `0` will
# disable the visual bell animation.
#duration: 0
# Visual bell animation color.
#color: '#ffffff'
# Bell Command
#
# This program is executed whenever the bell is rung.
#
# When set to `command: None`, no command will be executed.
#
# Example:
# command:
# program: notify-send
# args: ["Hello, World!"]
#
#command: None
selection:
# This string contains all characters that are used as separators for
# "semantic words" in Alacritty.
semantic_escape_chars: ",│`|:\"' ()[]{}<>\t"
# When set to `true`, selected text will be copied to the primary clipboard.
save_to_clipboard: true
cursor:
# Cursor style
style:
# Cursor shape
#
# Values for `shape`:
# - ▇ Block
# - _ Underline
# - | Beam
shape: Beam
# Cursor blinking state
#
# Values for `blinking`:
# - Never: Prevent the cursor from ever blinking
# - Off: Disable blinking by default
# - On: Enable blinking by default
# - Always: Force the cursor to always blink
#blinking: Off
# Vi mode cursor style
#
# If the vi mode cursor style is `None` or not specified, it will fall back to
# the style of the active value of the normal cursor.
#
# See `cursor.style` for available options.
vi_mode_style: Block
# Cursor blinking interval in milliseconds.
#blink_interval: 750
# If this is `true`, the cursor will be rendered as a hollow box when the
# window is not focused.
unfocused_hollow: false
# Thickness of the cursor relative to the cell width as floating point number
# from `0.0` to `1.0`.
#thickness: 0.15
# Live config reload (changes require restart)
#live_config_reload: true
# Shell
#
# You can set `shell.program` to the path of your favorite shell, e.g.
# `/bin/fish`. Entries in `shell.args` are passed unmodified as arguments to the
# shell.
#
# Default:
# - (macOS) /bin/bash --login
# - (Linux/BSD) user login shell
# - (Windows) powershell
shell:
program: /bin/zsh
# args:
# - --login
# Startup directory
#
# Directory the shell is started in. If this is unset, or `None`, the working
# directory of the parent process will be used.
#working_directory: None
# Send ESC (\x1b) before characters when alt is pressed.
#alt_send_esc: true
# Offer IPC using `alacritty msg` (unix only)
#ipc_socket: true
#mouse:
# Click settings
#
# The `double_click` and `triple_click` settings control the time
# alacritty should wait for accepting multiple clicks as one double
# or triple click.
#double_click: { threshold: 300 }
#triple_click: { threshold: 300 }
# If this is `true`, the cursor is temporarily hidden when typing.
#hide_when_typing: false
# Regex hints
#
# Terminal hints can be used to find text in the visible part of the terminal
# and pipe it to other applications.
#hints:
# Keys used for the hint labels.
#alphabet: "jfkdls;ahgurieowpq"
# List with all available hints
#
# Each hint must have a `regex` and either an `action` or a `command` field.
# The fields `mouse`, `binding` and `post_processing` are optional.
#
# The fields `command`, `binding.key`, `binding.mods`, `binding.mode` and
# `mouse.mods` accept the same values as they do in the `key_bindings` section.
#
# The `mouse.enabled` field controls if the hint should be underlined while
# the mouse with all `mouse.mods` keys held or the vi mode cursor is above it.
#
# If the `post_processing` field is set to `true`, heuristics will be used to
# shorten the match if there are characters likely not to be part of the hint
# (e.g. a trailing `.`). This is most useful for URIs.
#
# Values for `action`:
# - Copy
# Copy the hint's text to the clipboard.
# - Paste
# Paste the hint's text to the terminal or search.
# - Select
# Select the hint's text.
# - MoveViModeCursor
# Move the vi mode cursor to the beginning of the hint.
#enabled:
# - regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\
# [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+"
# command: xdg-open
# post_processing: true
# mouse:
# enabled: true
# mods: None
# binding:
# key: U
# mods: Control|Shift
# Mouse bindings
#
# Mouse bindings are specified as a list of objects, much like the key
# bindings further below.
#
# To trigger mouse bindings when an application running within Alacritty
# captures the mouse, the `Shift` modifier is automatically added as a
# requirement.
#
# Each mouse binding will specify a:
#
# - `mouse`:
#
# - Middle
# - Left
# - Right
# - Numeric identifier such as `5`
#
# - `action` (see key bindings for actions not exclusive to mouse mode)
#
# - Mouse exclusive actions:
#
# - ExpandSelection
# Expand the selection to the current mouse cursor location.
#
# And optionally:
#
# - `mods` (see key bindings)
mouse_bindings:
# - { mouse: Right, action: ExpandSelection }
- {mouse: Middle, mode: ~Vi, action: PasteSelection}
# Key bindings
#
# Key bindings are specified as a list of objects. For example, this is the
# default paste binding:
#
# `- { key: V, mods: Control|Shift, action: Paste }`
#
# Each key binding will specify a:
#
# - `key`: Identifier of the key pressed
#
# - A-Z
# - F1-F24
# - Key0-Key9
#
# A full list with available key codes can be found here:
# https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants
#
# Instead of using the name of the keys, the `key` field also supports using
# the scancode of the desired key. Scancodes have to be specified as a
# decimal number. This command will allow you to display the hex scancodes
# for certain keys:
#
# `showkey --scancodes`.
#
# Then exactly one of:
#
# - `chars`: Send a byte sequence to the running application
#
# The `chars` field writes the specified string to the terminal. This makes
# it possible to pass escape sequences. To find escape codes for bindings
# like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside
# of tmux. Note that applications use terminfo to map escape sequences back
# to keys. It is therefore required to update the terminfo when changing an
# escape sequence.
#
# - `action`: Execute a predefined action
#
# - ToggleViMode
# - SearchForward
# Start searching toward the right of the search origin.
# - SearchBackward
# Start searching toward the left of the search origin.
# - Copy
# - Paste
# - IncreaseFontSize
# - DecreaseFontSize
# - ResetFontSize
# - ScrollPageUp
# - ScrollPageDown
# - ScrollHalfPageUp
# - ScrollHalfPageDown
# - ScrollLineUp
# - ScrollLineDown
# - ScrollToTop
# - ScrollToBottom
# - ClearHistory
# Remove the terminal's scrollback history.
# - Hide
# Hide the Alacritty window.
# - Minimize
# Minimize the Alacritty window.
# - Quit
# Quit Alacritty.
# - ToggleFullscreen
# - SpawnNewInstance
# Spawn a new instance of Alacritty.
# - CreateNewWindow
# Create a new Alacritty window from the current process.
# - ClearLogNotice
# Clear Alacritty's UI warning and error notice.
# - ClearSelection
# Remove the active selection.
# - ReceiveChar
# - None
#
# - Vi mode exclusive actions:
#
# - Open
# Perform the action of the first matching hint under the vi mode cursor
# with `mouse.enabled` set to `true`.
# - ToggleNormalSelection
# - ToggleLineSelection
# - ToggleBlockSelection
# - ToggleSemanticSelection
# Toggle semantic selection based on `selection.semantic_escape_chars`.
#
# - Vi mode exclusive cursor motion actions:
#
# - Up
# One line up.
# - Down
# One line down.
# - Left
# One character left.
# - Right
# One character right.
# - First
# First column, or beginning of the line when already at the first column.
# - Last
# Last column, or beginning of the line when already at the last column.
# - FirstOccupied
# First non-empty cell in this terminal row, or first non-empty cell of
# the line when already at the first cell of the row.
# - High
# Top of the screen.
# - Middle
# Center of the screen.
# - Low
# Bottom of the screen.
# - SemanticLeft
# Start of the previous semantically separated word.
# - SemanticRight
# Start of the next semantically separated word.
# - SemanticLeftEnd
# End of the previous semantically separated word.
# - SemanticRightEnd
# End of the next semantically separated word.
# - WordLeft
# Start of the previous whitespace separated word.
# - WordRight
# Start of the next whitespace separated word.
# - WordLeftEnd
# End of the previous whitespace separated word.
# - WordRightEnd
# End of the next whitespace separated word.
# - Bracket
# Character matching the bracket at the cursor's location.
# - SearchNext
# Beginning of the next match.
# - SearchPrevious
# Beginning of the previous match.
# - SearchStart
# Start of the match to the left of the vi mode cursor.
# - SearchEnd
# End of the match to the right of the vi mode cursor.
#
# - Search mode exclusive actions:
# - SearchFocusNext
# Move the focus to the next search match.
# - SearchFocusPrevious
# Move the focus to the previous search match.
# - SearchConfirm
# - SearchCancel
# - SearchClear
# Reset the search regex.
# - SearchDeleteWord
# Delete the last word in the search regex.
# - SearchHistoryPrevious
# Go to the previous regex in the search history.
# - SearchHistoryNext
# Go to the next regex in the search history.
#
# - macOS exclusive actions:
# - ToggleSimpleFullscreen
# Enter fullscreen without occupying another space.
#
# - Linux/BSD exclusive actions:
#
# - CopySelection
# Copy from the selection buffer.
# - PasteSelection
# Paste from the selection buffer.
#
# - `command`: Fork and execute a specified command plus arguments
#
# The `command` field must be a map containing a `program` string and an
# `args` array of command line parameter strings. For example:
# `{ program: "alacritty", args: ["-e", "vttest"] }`
#
# And optionally:
#
# - `mods`: Key modifiers to filter binding actions
#
# - Command
# - Control
# - Option
# - Super
# - Shift
# - Alt
#
# Multiple `mods` can be combined using `|` like this:
# `mods: Control|Shift`.
# Whitespace and capitalization are relevant and must match the example.
#
# - `mode`: Indicate a binding for only specific terminal reported modes
#
# This is mainly used to send applications the correct escape sequences
# when in different modes.
#
# - AppCursor
# - AppKeypad
# - Search
# - Alt
# - Vi
#
# A `~` operator can be used before a mode to apply the binding whenever
# the mode is *not* active, e.g. `~Alt`.
#
# Bindings are always filled by default, but will be replaced when a new
# binding with the same triggers is defined. To unset a default binding, it can
# be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for
# a no-op if you do not wish to receive input characters for that binding.
#
# If the same trigger is assigned to multiple actions, all of them are executed
# in the order they were defined in.
key_bindings:
#- { key: Paste, action: Paste }
#- { key: Copy, action: Copy }
# - { key: L, mods: Control, action: clear }
#- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" }
- {key: Up, mods: Shift, mode: ~Alt, action: ScrollPageUp}
- {key: Down, mods: Shift, mode: ~Alt, action: ScrollPageDown}
- {key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop}
- {key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom,}
# - { key: Delete, actions: Del }
# - { key: Key9, mods: Control|Shift, action: CreateNewWindow, }
# Vi Mode
# - { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode }
# - { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom }
# - { key: Escape, mode: ~Search, action: ToggleViMode }
# - { key: Escape, mode: Vi|~Search, action: ClearSelection }
# - { key: I, mode: Vi|~Search, action: ToggleViMode }
# - { key: I, mode: Vi|~Search, action: ScrollToBottom }
# - { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode }
# - { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp }
# - { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown }
# - { key: G, mode: Vi|~Search, action: ScrollToTop }
# - { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom }
# - { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp }
# - { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown }
# - { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp }
# - { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown }
# - { key: Y, mode: Vi|~Search, action: Copy }
# - { key: Y, mode: Vi|~Search, action: ClearSelection }
# - { key: Copy, mode: Vi|~Search, action: ClearSelection }
# - { key: V, mode: Vi|~Search, action: ToggleNormalSelection }
# - { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection }
# - { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection }
# - { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection }
# - { key: Return, mode: Vi|~Search, action: Open }
# - { key: K, mode: Vi|~Search, action: Up }
# - { key: J, mode: Vi|~Search, action: Down }
# - { key: H, mode: Vi|~Search, action: Left }
# - { key: L, mode: Vi|~Search, action: Right }
# - { key: Up, mode: Vi|~Search, action: Up }
# - { key: Down, mode: Vi|~Search, action: Down }
# - { key: Left, mode: Vi|~Search, action: Left }
# - { key: Right, mode: Vi|~Search, action: Right }
# - { key: Key0, mode: Vi|~Search, action: First }
# - { key: Key4, mods: Shift, mode: Vi|~Search, action: Last }
# - { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied }
# - { key: H, mods: Shift, mode: Vi|~Search, action: High }
# - { key: M, mods: Shift, mode: Vi|~Search, action: Middle }
# - { key: L, mods: Shift, mode: Vi|~Search, action: Low }
# - { key: B, mode: Vi|~Search, action: SemanticLeft }
# - { key: W, mode: Vi|~Search, action: SemanticRight }
# - { key: E, mode: Vi|~Search, action: SemanticRightEnd }
# - { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft }
# - { key: W, mods: Shift, mode: Vi|~Search, action: WordRight }
# - { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd }
# - { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket }
# - { key: Slash, mode: Vi|~Search, action: SearchForward }
# - { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward }
# - { key: N, mode: Vi|~Search, action: SearchNext }
# - { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious }
# Search Mode
#- { key: Return, mode: Search|Vi, action: SearchConfirm }
#- { key: Escape, mode: Search, action: SearchCancel }
#- { key: C, mods: Control, mode: Search, action: SearchCancel }
#- { key: U, mods: Control, mode: Search, action: SearchClear }
#- { key: W, mods: Control, mode: Search, action: SearchDeleteWord }
#- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious }
#- { key: N, mods: Control, mode: Search, action: SearchHistoryNext }
#- { key: Up, mode: Search, action: SearchHistoryPrevious }
#- { key: Down, mode: Search, action: SearchHistoryNext }
#- { key: Return, mode: Search|~Vi, action: SearchFocusNext }
#- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious }
# (Windows, Linux, and BSD only)
- {key: V, mods: Control|Shift, mode: ~Vi, action: Paste}
- {key: C, mods: Control|Shift, action: Copy}
- {key: F, mods: Control|Shift, mode: ~Search, action: SearchForward}
- {key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward}
#- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection }
#- { key: Insert, mods: Shift, action: PasteSelection }
- {key: Key0, mods: Control, action: ResetFontSize}
- {key: Equals, mods: Control, action: IncreaseFontSize}
# - { key: Plus, mods: Control, action: IncreaseFontSize }
- {key: NumpadAdd, mods: Control, action: IncreaseFontSize}
- {key: Minus, mods: Control, action: DecreaseFontSize}
- {key: NumpadSubtract, mods: Control, action: DecreaseFontSize}
- {key: Q, mods: Control|Shift, action: Quit,}
# (Windows only)
# - {key: F11, action: ToggleFullscreen,}
# (macOS only)
#- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" }
#- { key: K, mods: Command, mode: ~Vi|~Search, action: ClearHistory }
#- { key: Key0, mods: Command, action: ResetFontSize }
#- { key: Equals, mods: Command, action: IncreaseFontSize }
#- { key: Plus, mods: Command, action: IncreaseFontSize }
#- { key: NumpadAdd, mods: Command, action: IncreaseFontSize }
#- { key: Minus, mods: Command, action: DecreaseFontSize }
#- { key: NumpadSubtract, mods: Command, action: DecreaseFontSize }
#- { key: V, mods: Command, action: Paste }
#- { key: C, mods: Command, action: Copy }
#- { key: C, mods: Command, mode: Vi|~Search, action: ClearSelection }
#- { key: H, mods: Command, action: Hide }
#- { key: H, mods: Command|Alt, action: HideOtherApplications }
#- { key: M, mods: Command, action: Minimize }
#- { key: Q, mods: Command, action: Quit }
#- { key: W, mods: Command, action: Quit }
#- { key: N, mods: Command, action: SpawnNewInstance }
#- { key: F, mods: Command|Control, action: ToggleFullscreen }
#- { key: F, mods: Command, mode: ~Search, action: SearchForward }
#- { key: B, mods: Command, mode: ~Search, action: SearchBackward }
#debug:
# Display the time it takes to redraw each frame.
#render_timer: false
# Keep the log file after quitting Alacritty.
#persistent_logging: false
# Log level
#
# Values for `log_level`:
# - Off
# - Error
# - Warn
# - Info
# - Debug
# - Trace
#log_level: Warn
# Print all received window events.
#print_events: false

View File

@ -0,0 +1,75 @@
# Colors section of "Alacritty - TOML configuration file format"
# https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd#colors
[colors.primary]
foreground = "#575279"
background = "#faf4ed"
dim_foreground = "#797593"
bright_foreground = "#575279"
[colors.cursor]
text = "#575279"
cursor = "#cecacd"
[colors.vi_mode_cursor]
text = "#575279"
cursor = "#cecacd"
[colors.search.matches]
foreground = "#797593"
background = "#f2e9e1"
[colors.search.focused_match]
foreground = "#faf4ed"
background = "#d7827e"
[colors.hints.start]
foreground = "#797593"
background = "#fffaf3"
[colors.hints.end]
foreground = "#9893a5"
background = "#fffaf3"
[colors.line_indicator]
foreground = "None"
background = "None"
[colors.footer_bar]
foreground = "#575279"
background = "#fffaf3"
[colors.selection]
text = "#575279"
background = "#dfdad9"
[colors.normal]
black = "#f2e9e1"
red = "#b4637a"
green = "#286983"
yellow = "#ea9d34"
blue = "#56949f"
magenta = "#907aa9"
cyan = "#d7827e"
white = "#575279"
[colors.bright]
black = "#9893a5"
red = "#b4637a"
green = "#286983"
yellow = "#ea9d34"
blue = "#56949f"
magenta = "#907aa9"
cyan = "#d7827e"
white = "#575279"
[colors.dim]
black = "#9893a5"
red = "#b4637a"
green = "#286983"
yellow = "#ea9d34"
blue = "#56949f"
magenta = "#907aa9"
cyan = "#d7827e"
white = "#575279"

View File

@ -0,0 +1,75 @@
# Colors section of "Alacritty - TOML configuration file format"
# https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd#colors
[colors.primary]
foreground = "#e0def4"
background = "#232136"
dim_foreground = "#908caa"
bright_foreground = "#e0def4"
[colors.cursor]
text = "#e0def4"
cursor = "#56526e"
[colors.vi_mode_cursor]
text = "#e0def4"
cursor = "#56526e"
[colors.search.matches]
foreground = "#908caa"
background = "#393552"
[colors.search.focused_match]
foreground = "#232136"
background = "#ea9a97"
[colors.hints.start]
foreground = "#908caa"
background = "#2a273f"
[colors.hints.end]
foreground = "#6e6a86"
background = "#2a273f"
[colors.line_indicator]
foreground = "None"
background = "None"
[colors.footer_bar]
foreground = "#e0def4"
background = "#2a273f"
[colors.selection]
text = "#e0def4"
background = "#44415a"
[colors.normal]
black = "#393552"
red = "#eb6f92"
green = "#3e8fb0"
yellow = "#f6c177"
blue = "#9ccfd8"
magenta = "#c4a7e7"
cyan = "#ea9a97"
white = "#e0def4"
[colors.bright]
black = "#6e6a86"
red = "#eb6f92"
green = "#3e8fb0"
yellow = "#f6c177"
blue = "#9ccfd8"
magenta = "#c4a7e7"
cyan = "#ea9a97"
white = "#e0def4"
[colors.dim]
black = "#6e6a86"
red = "#eb6f92"
green = "#3e8fb0"
yellow = "#f6c177"
blue = "#9ccfd8"
magenta = "#c4a7e7"
cyan = "#ea9a97"
white = "#e0def4"

View File

@ -0,0 +1,75 @@
# Colors section of "Alacritty - TOML configuration file format"
# https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd#colors
[colors.primary]
foreground = "#e0def4"
background = "#191724"
dim_foreground = "#908caa"
bright_foreground = "#e0def4"
[colors.cursor]
text = "#e0def4"
cursor = "#524f67"
[colors.vi_mode_cursor]
text = "#e0def4"
cursor = "#524f67"
[colors.search.matches]
foreground = "#908caa"
background = "#26233a"
[colors.search.focused_match]
foreground = "#191724"
background = "#ebbcba"
[colors.hints.start]
foreground = "#908caa"
background = "#1f1d2e"
[colors.hints.end]
foreground = "#6e6a86"
background = "#1f1d2e"
[colors.line_indicator]
foreground = "None"
background = "None"
[colors.footer_bar]
foreground = "#e0def4"
background = "#1f1d2e"
[colors.selection]
text = "#e0def4"
background = "#403d52"
[colors.normal]
black = "#26233a"
red = "#eb6f92"
green = "#31748f"
yellow = "#f6c177"
blue = "#9ccfd8"
magenta = "#c4a7e7"
cyan = "#ebbcba"
white = "#e0def4"
[colors.bright]
black = "#6e6a86"
red = "#eb6f92"
green = "#31748f"
yellow = "#f6c177"
blue = "#9ccfd8"
magenta = "#c4a7e7"
cyan = "#ebbcba"
white = "#e0def4"
[colors.dim]
black = "#6e6a86"
red = "#eb6f92"
green = "#31748f"
yellow = "#f6c177"
blue = "#9ccfd8"
magenta = "#c4a7e7"
cyan = "#ebbcba"
white = "#e0def4"

View File

@ -13,22 +13,38 @@ local theme = {}
theme.font = "JetBrainsMono NF 8"
theme.bg_normal = "#1a1b26"
theme.bg_focus = "#292e42"
theme.bg_urgent = "#db4b4b"
theme.bg_minimize = "#444444"
local base = "#191724"
local surface = "#1f1d2e"
local overlay = "#26233a"
local muted = "#6e6a86"
local subtle = "#908caa"
local text = "#e0def4"
local love = "#eb6f92"
local gold = "#f6c177"
local rose = "#ebbcba"
local pine = "#31748f"
local foam = "#9ccfd8"
local iris = "#c4a7e7"
local highlightLow = "#21202e"
local highlightMed = "#403d52"
local highlightHigh = "#524f67"
theme.bg_normal = base
theme.bg_focus = surface
theme.bg_urgent = love
theme.bg_minimize = highlightMed
theme.bg_systray = theme.bg_normal
theme.fg_normal = "#a9b1d6"
theme.fg_urgent = "#c0caf5"
theme.fg_focus = "#c0caf5"
theme.fg_minimize = "#a9b1d6"
theme.fg_normal = subtle
theme.fg_urgent = text
theme.fg_focus = text
theme.fg_minimize = subtle
theme.useless_gap = dpi(4)
theme.border_width = dpi(2)
theme.border_normal = "#15161e"
theme.border_focus = "#27a1b9"
theme.border_marked = "#713137"
theme.border_normal = surface
theme.border_focus = rose
theme.border_marked = love
-- There are other variable sets
-- overriding the default one when
@ -41,7 +57,7 @@ theme.border_marked = "#713137"
-- prompt_[fg|bg|fg_cursor|bg_cursor|font]
-- hotkeys_[bg|fg|border_width|border_color|shape|opacity|modifiers_fg|label_bg|label_fg|group_margin|font|description_font]
-- theme.taglist_bg_focus = "#db4b4b"
-- theme.taglist_bg_focus = love
-- Generate taglist squares:
local taglist_square_size = dpi(4)
@ -64,7 +80,7 @@ theme.menu_width = dpi(100)
-- You can add as many variables as
-- you wish and access them by using
-- beautiful.variable in your rc.lua
-- theme.bg_widget = "#db4b4b"
-- theme.bg_widget = love
-- Define the image to load
theme.titlebar_close_button_normal = themes_path .. "default/titlebar/close_normal.png"
@ -118,7 +134,7 @@ theme.awesome_icon = theme_assets.awesome_icon(theme.menu_height, theme.bg_focus
-- Define the icon theme for application icons. If not set then the icons
-- from /usr/share/icons and /usr/share/icons/hicolor will be used.
theme.icon_theme = nil
theme.icon_theme = "/usr/share/icons/rose-pine-icons/"
return theme

View File

@ -13,6 +13,7 @@ local weather_widget = require("awesome-wm-widgets.weather-widget.weather")
local github_activity_widget = require("awesome-wm-widgets.github-activity-widget.github-activity-widget")
local github_contributions_widget =
require("awesome-wm-widgets.github-contributions-widget.github-contributions-widget")
-- local docker_widget = require("awesome-wm-widgets.docker-widget.docker")
-- Standard awesome library
local gears = require("gears")
@ -316,6 +317,7 @@ awful.screen.connect_for_each_screen(function(s)
timeout = 1,
}),
net_speed_widget(),
-- docker_widget(),
spotify_widget({
play_icon = "/usr/share/icons/Papirus-Light/24x24/categories/spotify.svg",
pause_icon = "/usr/share/icons/Papirus-Dark/24x24/panel/spotify-indicator.svg",
@ -702,22 +704,19 @@ awful.rules.rules = {
-- "steam_app_289070",
-- "steam_app_1172380",
"steam_app_1774580",
"steam_app_1182480",
},
},
properties = { screen = 1, fullscreen = true, floating = true },
},
{
rule_any = { class = { "steam_app_1182480" } },
properties = { fullscreen = true },
rule_any = { class = { "Ferdium" } },
properties = { screen = 2, tag = "5" },
},
{
rule_any = { class = { "discord", "TelegramDesktop", "ripcord", "Ferdium" } },
rule_any = { class = { "discord", "TelegramDesktop", "ripcord", "KotatogramDesktop" } },
properties = { screen = 2, tag = "8" },
},
{
rule_any = { class = { "discord" } },
properties = { screen = 2, tag = "8", minimized = true },
},
{
rule_any = { class = { "easyeffects" } },
properties = { screen = 1, tag = "9" },

View File

@ -1,8 +1,8 @@
#? Config file for btop v. 1.3.0
#? Config file for btop v. 1.3.2
#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes.
#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes"
color_theme = "/usr/share/btop/themes/tokyo-night.theme"
color_theme = "/home/kristofers/.config/btop/themes/rose-pine.theme"
#* If the theme set background should be shown, set to False if you want terminal background transparency.
theme_background = False
@ -47,7 +47,7 @@ graph_symbol_net = "default"
graph_symbol_proc = "default"
#* Manually set which boxes to show. Available values are "cpu mem net proc" and "gpu0" through "gpu5", separate values with whitespace.
shown_boxes = "cpu mem net proc"
shown_boxes = "mem net proc cpu"
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
update_ms = 500
@ -196,7 +196,7 @@ net_download = 100
net_upload = 100
#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest.
net_auto = True
net_auto = False
#* Sync the auto scaling for download and upload to whichever currently has the highest scale.
net_sync = False
@ -210,6 +210,9 @@ show_battery = True
#* Which battery to use if multiple are present. "Auto" for auto detection.
selected_battery = "Auto"
#* Show power stats of battery next to charge indicator.
show_battery_watts = True
#* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG".
#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info.
log_level = "WARNING"

View File

@ -61,3 +61,21 @@
2024/02/10 (14:03:02) | ===> btop++ v.1.3.0
2024/02/10 (14:03:02) | WARNING: ROCm SMI: Failed to get maximum GPU temperature, defaulting to 110°C
2024/06/25 (11:32:57) | ===> btop++ v.1.3.2
2024/06/25 (11:32:57) | WARNING: Failed to get disk/partition stats for mount "/var/lib/docker/tmp/buildkit-mount718854079" with statvfs error code: 13. Ignoring...
2024/07/02 (11:14:28) | ===> btop++ v.1.3.2
2024/07/02 (11:14:28) | WARNING: Failed to get disk/partition stats for mount "/var/lib/docker/tmp/buildkit-mount867640473" with statvfs error code: 13. Ignoring...
2024/07/02 (11:33:51) | WARNING: Failed to get disk/partition stats for mount "/var/lib/docker/tmp/buildkit-mount740292060" with statvfs error code: 13. Ignoring...
2024/07/02 (11:39:13) | WARNING: Failed to get disk/partition stats for mount "/var/lib/docker/tmp/buildkit-mount3234715954" with statvfs error code: 13. Ignoring...
2024/07/02 (12:41:57) | WARNING: Failed to get disk/partition stats for mount "/var/lib/docker/tmp/buildkit-mount1914072710" with statvfs error code: 13. Ignoring...
2024/07/04 (13:29:46) | ===> btop++ v.1.3.2
2024/07/04 (13:29:46) | WARNING: Failed to get disk/partition stats for mount "/var/lib/docker/tmp/buildkit-mount2679386477" with statvfs error code: 13. Ignoring...
2024/07/04 (13:36:41) | WARNING: Failed to get disk/partition stats for mount "/var/lib/docker/tmp/buildkit-mount517752449" with statvfs error code: 13. Ignoring...
2024/07/04 (13:40:08) | WARNING: Failed to get disk/partition stats for mount "/var/lib/docker/tmp/buildkit-mount2944448055" with statvfs error code: 13. Ignoring...
2024/07/04 (14:01:51) | WARNING: Failed to get disk/partition stats for mount "/var/lib/docker/tmp/buildkit-mount1643050152" with statvfs error code: 13. Ignoring...
2024/07/04 (17:22:17) | ===> btop++ v.1.3.2
2024/07/04 (17:22:17) | WARNING: Failed to get disk/partition stats for mount "/var/lib/docker/tmp/buildkit-mount1778594762" with statvfs error code: 13. Ignoring...

View File

@ -0,0 +1,89 @@
# Main background, empty for terminal default, need to be empty if you want transparent background
theme[main_bg]="#faf4ed"
# Main text color
theme[main_fg]="#575279"
# Title color for boxes
theme[title]="#797593"
# Highlight color for keyboard shortcuts
theme[hi_fg]="#575279"
# Background color of selected item in processes box
theme[selected_bg]="#cecacd"
# Foreground color of selected item in processes box
theme[selected_fg]="#ea9d34"
# Color of inactive/disabled text
theme[inactive_fg]="#dfdad9"
# Color of text appearing on top of graphs, i.e uptime and current network graph scaling
theme[graph_text]="#56949f"
# Background color of the percentage meters
theme[meter_bg]="#56949f"
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
theme[proc_misc]="#907aa9"
# Cpu box outline color
theme[cpu_box]="#d7827e"
# Memory/disks box outline color
theme[mem_box]="#286983"
# Net up/down box outline color
theme[net_box]="#907aa9"
# Processes box outline color
theme[proc_box]="#b4637a"
# Box divider line and small boxes line color
theme[div_line]="#9893a5"
# Temperature graph colors
theme[temp_start]="#d7827e"
theme[temp_mid]="#ea9d34"
theme[temp_end]="#b4637a"
# CPU graph colors
theme[cpu_start]="#ea9d34"
theme[cpu_mid]="#d7827e"
theme[cpu_end]="#b4637a"
# Mem/Disk free meter
theme[free_start]="#b4637a"
theme[free_mid]="#b4637a"
theme[free_end]="#b4637a"
# Mem/Disk cached meter
theme[cached_start]="#907aa9"
theme[cached_mid]="#907aa9"
theme[cached_end]="#907aa9"
# Mem/Disk available meter
theme[available_start]="#286983"
theme[available_mid]="#286983"
theme[available_end]="#286983"
# Mem/Disk used meter
theme[used_start]="#d7827e"
theme[used_mid]="#d7827e"
theme[used_end]="#d7827e"
# Download graph colors
theme[download_start]="#286983"
theme[download_mid]="#56949f"
theme[download_end]="#56949f"
# Upload graph colors
theme[upload_start]="#d7827e"
theme[upload_mid]="#b4637a"
theme[upload_end]="#b4637a"
# Process box color gradient for threads, mem and cpu usage
theme[process_start]="#286983"
theme[process_mid]="#56949f"
theme[process_end]="#56949f"

View File

@ -0,0 +1,89 @@
# Main background, empty for terminal default, need to be empty if you want transparent background
theme[main_bg]="#232136"
# Main text color
theme[main_fg]="#e0def4"
# Title color for boxes
theme[title]="#908caa"
# Highlight color for keyboard shortcuts
theme[hi_fg]="#e0def4"
# Background color of selected item in processes box
theme[selected_bg]="#56526e"
# Foreground color of selected item in processes box
theme[selected_fg]="#f6c177"
# Color of inactive/disabled text
theme[inactive_fg]="#44415a"
# Color of text appearing on top of graphs, i.e uptime and current network graph scaling
theme[graph_text]="#9ccfd8"
# Background color of the percentage meters
theme[meter_bg]="#9ccfd8"
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
theme[proc_misc]="#c4a7e7"
# Cpu box outline color
theme[cpu_box]="#ea9a97"
# Memory/disks box outline color
theme[mem_box]="#3e8fb0"
# Net up/down box outline color
theme[net_box]="#c4a7e7"
# Processes box outline color
theme[proc_box]="#eb6f92"
# Box divider line and small boxes line color
theme[div_line]="#6e6a86"
# Temperature graph colors
theme[temp_start]="#ea9a97"
theme[temp_mid]="#f6c177"
theme[temp_end]="#eb6f92"
# CPU graph colors
theme[cpu_start]="#f6c177"
theme[cpu_mid]="#ea9a97"
theme[cpu_end]="#eb6f92"
# Mem/Disk free meter
theme[free_start]="#eb6f92"
theme[free_mid]="#eb6f92"
theme[free_end]="#eb6f92"
# Mem/Disk cached meter
theme[cached_start]="#c4a7e7"
theme[cached_mid]="#c4a7e7"
theme[cached_end]="#c4a7e7"
# Mem/Disk available meter
theme[available_start]="#3e8fb0"
theme[available_mid]="#3e8fb0"
theme[available_end]="#3e8fb0"
# Mem/Disk used meter
theme[used_start]="#ea9a97"
theme[used_mid]="#ea9a97"
theme[used_end]="#ea9a97"
# Download graph colors
theme[download_start]="#3e8fb0"
theme[download_mid]="#9ccfd8"
theme[download_end]="#9ccfd8"
# Upload graph colors
theme[upload_start]="#ea9a97"
theme[upload_mid]="#eb6f92"
theme[upload_end]="#eb6f92"
# Process box color gradient for threads, mem and cpu usage
theme[process_start]="#3e8fb0"
theme[process_mid]="#9ccfd8"
theme[process_end]="#9ccfd8"

View File

@ -0,0 +1,119 @@
# Main background, empty for terminal default, need to be empty if you want transparent background
theme[main_bg]="#191724"
# Base
# Main text color
theme[main_fg]="#e0def4"
# Text
# Title color for boxes
theme[title]="#908caa"
# Subtle
# Highlight color for keyboard shortcuts
theme[hi_fg]="#e0def4"
# Text
# Background color of selected item in processes box
theme[selected_bg]="#524f67"
# HL High
# Foreground color of selected item in processes box
theme[selected_fg]="#f6c177"
# Gold
# Color of inactive/disabled text
theme[inactive_fg]="#403d52"
# HL Med
# Color of text appearing on top of graphs, i.e uptime and current network graph scaling
theme[graph_text]="#9ccfd8"
# Foam
# Background color of the percentage meters
theme[meter_bg]="#9ccfd8"
# Foam
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
theme[proc_misc]="#c4a7e7"
# Iris
# Cpu box outline color
theme[cpu_box]="#ebbcba"
# Rose
# Memory/disks box outline color
theme[mem_box]="#31748f"
# Pine
# Net up/down box outline color
theme[net_box]="#c4a7e7"
# Iris
# Processes box outline color
theme[proc_box]="#eb6f92"
# Love
# Box divider line and small boxes line color
theme[div_line]="#6e6a86"
# Muted
# Temperature graph colors
theme[temp_start]="#ebbcba"
# Rose
theme[temp_mid]="#f6c177"
# Gold
theme[temp_end]="#eb6f92"
# Love
# CPU graph colors
theme[cpu_start]="#f6c177"
# Gold
theme[cpu_mid]="#ebbcba"
# Rose
theme[cpu_end]="#eb6f92"
# Love
# Mem/Disk free meter
# all love
theme[free_start]="#eb6f92"
theme[free_mid]="#eb6f92"
theme[free_end]="#eb6f92"
# Mem/Disk cached meter
# all iris
theme[cached_start]="#c4a7e7"
theme[cached_mid]="#c4a7e7"
theme[cached_end]="#c4a7e7"
# Mem/Disk available meter
# all pine
theme[available_start]="#31748f"
theme[available_mid]="#31748f"
theme[available_end]="#31748f"
# Mem/Disk used meter
# all rose
theme[used_start]="#ebbcba"
theme[used_mid]="#ebbcba"
theme[used_end]="#ebbcba"
# Download graph colors
# Pine for start, foam for the rest
theme[download_start]="#31748f"
theme[download_mid]="#9ccfd8"
theme[download_end]="#9ccfd8"
# Upload graph colors
theme[upload_start]="#ebbcba"
# Rose for start
theme[upload_mid]="#eb6f92"
# Love for mid and end
theme[upload_end]="#eb6f92"
# Process box color gradient for threads, mem and cpu usage
theme[process_start]="#31748f"
# Pine
theme[process_mid]="#9ccfd8"
# Foam for mid and end
theme[process_end]="#9ccfd8"

View File

@ -82,17 +82,17 @@
separator_height = 1
# Padding between text and separator.
padding = 8
padding = 10
# Horizontal padding.
horizontal_padding = 8
horizontal_padding = 10
# Padding between text and icon.
text_icon_padding = 0
# Defines width in pixels of frame around the notification window.
# Set to 0 to disable.
frame_width = 2
frame_width = 1
# Defines color of the frame around the notification window.
frame_color = "#15161e"
@ -101,7 +101,7 @@
# If value is greater than 0, separator_height will be ignored and a border
# of size frame_width will be drawn around each notification instead.
# Click events on gaps do not currently propagate to applications below.
gap_size = 1
gap_size = 3
# Define a color for the separator.
# possible values are:
@ -123,7 +123,14 @@
### Text ###
font = JetBrainsMono NF 8
font = JetBrainsMono NF 14
icon_theme = "rose-pine-icons"
enable_recursive_icon_lookup = true
corner_radius = 2
background = "#26233a"
foreground = "#e0def4"
# The spacing between lines. If the height is smaller than the
# font height, it will get raised to the font height.
@ -312,26 +319,32 @@
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment.
background = "#16161e"
foreground = "#c0caf5"
frame_color = "#29a4bd"
background = "#26273d"
highlight = "#31748f"
frame_color = "#31748f"
timeout = 5
default_icon = "dialog-information"
format = "<b><span foreground='#31748f'>%s</span></b>\n%b"
# Icon for notifications with low urgency, uncomment to enable
#new_icon = /path/to/icon
[urgency_normal]
background = "#1a1b26"
foreground = "#c0caf5"
frame_color = "#29a4bd"
background = "#362e3c"
highlight = "#f6c177"
frame_color = "#f6c177"
timeout = 10
default_icon = "dialog-warning"
format = "<b><span foreground='#f6c177'>%s</span></b>\n%b"
# Icon for notifications with normal urgency, uncomment to enable
#new_icon = /path/to/icon
[urgency_critical]
background = "#292e42"
foreground = "#db4b4b"
frame_color = "#db4b4b"
background = "#35263d"
highlight = "#eb6f92"
frame_color = "#eb6f92"
timeout = 0
default_icon = "dialog-error"
format = "<b><span foreground='#eb6f92'>%s</span></b>\n%b"
# Icon for notifications with critical urgency, uncomment to enable
#new_icon = /path/to/icon

View File

@ -0,0 +1,42 @@
[global]
width = 400
offset = 5x5
progress_bar_min_width = 380
progress_bar_max_width = 380
progress_bar_corner_radius = 2
padding = 10
horizontal_padding = 10
frame_width = 1
gap_size = 3
font = "Monospace 14"
icon_theme = "rose-pine-icons"
enable_recursive_icon_lookup = true
corner_radius = 2
background = "#26233a"
foreground = "#e0def4"
[urgency_low]
background = "#26273d"
highlight = "#31748f"
frame_color = "#31748f"
default_icon = "dialog-information"
format = "<b><span foreground='#31748f'>%s</span></b>\n%b"
[urgency_normal]
background = "#362e3c"
highlight = "#f6c177"
frame_color = "#f6c177"
default_icon = "dialog-warning"
format = "<b><span foreground='#f6c177'>%s</span></b>\n%b"
[urgency_critical]
background = "#35263d"
highlight = "#eb6f92"
frame_color = "#eb6f92"
default_icon = "dialog-error"
format = "<b><span foreground='#eb6f92'>%s</span></b>\n%b"

View File

@ -61,7 +61,8 @@ $yellow: #e0af68;
}
//Global Styles
.bar {
.bar,
.bar-1 {
background-color: rgba(22, 22, 30, 0.7);
color: $fg;
font-family: "JetBrainsMono NF";

View File

@ -183,3 +183,16 @@
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar))
(defwindow bar-1
:monitor 1
:exclusive true
:geometry (geometry
:x "0%"
:y "0%"
:width "100%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar))

View File

@ -2,5 +2,7 @@
hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id'
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - |
socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - |
stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}'
# socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}'

View File

@ -1,3 +1,2 @@
#!/bin/sh
hyprctl activewindow -j | jq --raw-output .title
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 awk -F '>>|,' '/^activewindow>>/{print $3}'

View File

@ -1,6 +1,7 @@
[General]
contrastOpacity=188
drawColor=#ff0046
drawColor=#ff0000
drawThickness=3
filenamePattern=%Y-%m-%d_%H-%M-%S
saveAfterCopy=true
savePath=/home/kristofers/Pictures/screenshots

View File

@ -8,26 +8,31 @@
#
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,preferred,auto,1
monitor=eDP-1,2880x1800@60,auto,1.5
#monitor=,preferred,auto-up,1
monitor=DP-1,disable
#monitor=HDMI-A-1,highres,auto-up,1,mirror,eDP-1
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
# Execute your favorite apps at launch
# exec-once = waybar & hyprpaper & firefox
exec-once = pipewire & pipewire-pulse & wireplumber & eww daemon & eww open bar & tuxedo-control-center & flameshot & librewolf & nextcloud & /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & xrdb "$XDG_CONFIG_HOME/x11/xresources" & spotifyd --no-daemon & syncthing & dbus-update-activation-environment DISPLAY XAUTHORITY WAYLAND_DISPLAY & transmission-daemon #& hyprpaper
exec-once = pipewire & pipewire-pulse & wireplumber & eww daemon & eww open bar & nextcloud & /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & xrdb "$XDG_CONFIG_HOME/x11/xresources" & spotifyd --no-daemon & syncthing & transmission-daemon & dunst & dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP DISPLAY XAUTHORITY
exec-once=[workspace 1 silent] librewolf
exec-once=[workspace 8 silent] discord & telegram-desktop
exec-once=[workspace 9 silent] spotify
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
source=~/.config/hypr/rose-pine.conf
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout = lv
kb_variant =
kb_model =
kb_options =
kb_options = caps:escape
kb_rules =
numlock_by_default = true
repeat_rate = 50
@ -43,19 +48,23 @@ input {
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
}
debug {
disable_logs = false
enable_stdout_logs = true
}
general {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
gaps_in = 5
gaps_out = 10
border_size = 2
col.active_border = rgb(27a1b9)
col.inactive_border = rgba(15161eaa)
col.active_border = $rose
col.inactive_border = $muted
layout = master
}
plugin {
split-monitor-workspaces {
count = 10
@ -74,13 +83,13 @@ decoration {
drop_shadow = yes
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
col.shadow = $highlightMed
}
animations {
enabled = no
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for moreqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ctqt6ct
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
@ -99,7 +108,7 @@ dwindle {
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
new_is_master = true
new_status = master
}
gestures {
@ -109,17 +118,13 @@ gestures {
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more
device:epic mouse V1 {
sensitivity = -0.5
}
#device:epic mouse V1 {
#sensitivity = -0.5
#}
# Example windowrule v1
windowrulev2 = fullscreen, class:mpv
windowrulev2 = workspace 5, class:steam
windowrulev2 = workspace 7, class:tuxedo-control-center
windowrulev2 = workspace 7, class:corectrl
windowrulev2 = opacity 0.95, class:thunderbird
windowrulev2 = workspace 8, class:discord
@ -127,15 +132,14 @@ windowrulev2 = opacity 0.95, class:discord
windowrulev2 = workspace 8, class:Ripcord
windowrulev2 = workspace 8, class:TelegramDesktop
windowrulev2 = opacity 0.95, class:TelegramDesktop
windowrulev2 = opacity 0.9, class:teams-for-linux
windowrulev2 = workspace 8, class:Ferdium
windowrulev2 = opacity 0.9, class:Ferdium
windowrulev2 = workspace 9, class:Spotify
windowrulev2 = opacity 0.9, class:Spotify
windowrulev2 = tile, class:Spotify
windowrulev2 = opacity 0.95, class:qbittorrent
windowrulev2 = opacity 0.95, class:lutris
windowrulev2 = opacity 0.95, class:pacfinder
@ -147,6 +151,11 @@ windowrulev2 = opacity 0.9, class:kdeconnect
windowrulev2 = move 100%-250 100%-250, class:galculator
windowrulev2 = size 250 250, class:galculator
windowrulev2 = float, class:galculator
windowrulev2=float,title:^(flameshot)
windowrulev2=move 0 0,title:^(flameshot)
windowrulev2=suppressevent fullscreen,title:^(flameshot)
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
@ -164,7 +173,7 @@ bind = $mainMod, P, exec, wofi --show drun -ib
bind = $mainMod, F, fullscreen
bind = $mainMod, M, bringactivetotop
bind = $mainMod, A, pin
# bind = $mainMod, O, split-changemonitor
#bind = $mainMod, O, split-changemonitor, +1
# Resize window
bind = $mainMod, L, splitratio, 0.05
@ -185,18 +194,38 @@ bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
#bind = $mainMod, 1, split-workspace, 1
#bind = $mainMod, 2, split-workspace, 2
#bind = $mainMod, 3, split-workspace, 3
#bind = $mainMod, 4, split-workspace, 4
#bind = $mainMod, 5, split-workspace, 5
#bind = $mainMod, 6, split-workspace, 6
#bind = $mainMod, 7, split-workspace, 7
#bind = $mainMod, 8, split-workspace, 8
#bind = $mainMod, 9, split-workspace, 9
#bind = $mainMod, 0, split-workspace, 10
#
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
bind = $mainMod SHIFT, 1, movetoworkspacesilent, 1
bind = $mainMod SHIFT, 2, movetoworkspacesilent, 2
bind = $mainMod SHIFT, 3, movetoworkspacesilent, 3
bind = $mainMod SHIFT, 4, movetoworkspacesilent, 4
bind = $mainMod SHIFT, 5, movetoworkspacesilent, 5
bind = $mainMod SHIFT, 6, movetoworkspacesilent, 6
bind = $mainMod SHIFT, 7, movetoworkspacesilent, 7
bind = $mainMod SHIFT, 8, movetoworkspacesilent, 8
bind = $mainMod SHIFT, 9, movetoworkspacesilent, 9
bind = $mainMod SHIFT, 0, movetoworkspacesilent, 10
#bind = $mainMod SHIFT, 1, split-movetoworkspace, 1
#bind = $mainMod SHIFT, 2, split-movetoworkspace, 2
#bind = $mainMod SHIFT, 3, split-movetoworkspace, 3
#bind = $mainMod SHIFT, 4, split-movetoworkspace, 4
#bind = $mainMod SHIFT, 5, split-movetoworkspace, 5
#bind = $mainMod SHIFT, 6, split-movetoworkspace, 6
#bind = $mainMod SHIFT, 7, split-movetoworkspace, 7
#bind = $mainMod SHIFT, 8, split-movetoworkspace, 8
#bind = $mainMod SHIFT, 9, split-movetoworkspace, 9
#bind = $mainMod SHIFT, 0, split-movetoworkspace, 10
# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, right, workspace, e+1
@ -220,7 +249,6 @@ bind = , PRINT, exec, hyprshot -m output
bind = SHIFT, PRINT, exec, hyprshot -m window
bind = $mainMod ALT, P, exec, hyprpicker -a # colorpicker
# bind = $mainMod SHIFT, L, exec, lock # lock
# Control keybinds
bindel = , XF86MonBrightnessUp, exec, doas brightnessctl set +2% # increase brightness by 2%
@ -229,5 +257,6 @@ bindel = , XF86AudioRaiseVolume, exec, pulsemixer --change-volume +2 # increase
bindel = , XF86AudioLowerVolume, exec, pulsemixer --change-volume -2 # decrease volume by 2
bindel = , XF86AudioMute, exec, pulsemixer --toggle-mute # mute volume
bindel = , XF86AudioPlay, exec, playerctl -a play-pause # pause/play everything
bindel = $mainMod, Space, exec, hyprlock
bindl = , switch:Lid Switch, exec, swaylock
bindl = , switch:Lid Switch, exec, hyprlock

View File

@ -0,0 +1,88 @@
$font = JetBrainsMonoNF
$bg = rgb(1a1b26)
$fg = rgb(c0caf5)
$border_highlight = rgb(27a1b9)
$error = rgb(db4b4b)
$warning = rgb(e0af68)
background {
monitor =
path = screenshot
color = $bg
blur_passes = 1
blur_size = 10
noise = 0.1
contrast = 0.9
brightness = 0.8
vibrancy = 0.1696
vibrancy_darkness = 0.0
}
# TIME
label {
monitor =
text = cmd[update:1000] echo "<span foreground='##c0caf5'>$(date +"%H:%M:%S")</span>"
color = $text
font_size = 90
font_family = $font
position = -30, 0
halign = right
valign = top
}
# DATE
label {
monitor =
text = cmd[update:43200000] echo "<span foreground='##c0caf5'>$(date +"%d.%m.%Y")</span>"
color = $text
font_size = 25
font_family = $font
position = -30, -150
halign = right
valign = top
}
image {
monitor =
path = ~/.local/share/profile
size = 300
border_color = $border_highlight
position = 0, 200
halign = center
valign = center
}
input-field {
monitor =
size = 300, 60
outline_thickness = 4
dots_size = 0.2
dots_spacing = 0.2
dots_center = true
dots_rounding = -1 # -1 default circle, -2 follow input-field rounding
outer_color = $border_highlight
inner_color = $fg
font_color = $bg
fade_on_empty = true
fade_timeout = 1000 # Milliseconds before fade_on_empty is triggered.
placeholder_text = <i>Input Password...</i> # Text rendered in the input box when it's empty.
hide_input = false
rounding = -1 # -1 means complete rounding (circle/oval)
check_color = rgb(e0af68)
fail_color = rgb(db4b4b) # if authentication failed, changes outer_color and fail message color
fail_text = <i>$FAIL <b>($ATTEMPTS)</b></i> # can be set to empty
fail_transition = 300 # transition time in ms between normal outer_color and fail_color
capslock_color = -1
numlock_color = -1
bothlock_color = -1 # when both locks are active. -1 means don't change outer color (same for above)
invert_numlock = false # change color if numlock is off
swap_font_color = false
position = 0, -35
halign = center
valign = center
}

View File

@ -0,0 +1,20 @@
# name: Rosé Pine
# author: jishnurajendran
# upstream: https://github.com/jishnurajendran/hyprland-rosepine/blob/main/rose-pine.conf
# All natural pine, faux fur and a bit of soho vibes for the classy minimalist
$base = 0xff191724
$surface = 0xff1f1d2e
$overlay = 0xff26233a
$muted = 0xff6e6a86
$subtle = 0xff908caa
$text = 0xffe0def4
$love = 0xffeb6f92
$gold = 0xfff6c177
$rose = 0xffebbcba
$pine = 0xff31748f
$foam = 0xff9ccfd8
$iris = 0xffc4a7e7
$highlightLow = 0xff21202e
$highlightMed = 0xff403d52
$highlightHigh = 0xff524f67

View File

@ -17,6 +17,10 @@ set shellopts '-eu'
# Custom Functions
cmd trash ${{
trash-put $f
}}
cmd moveto ${{
clear; tput cup $(($(tput lines)/3)); tput bold
set -f

View File

@ -18,5 +18,5 @@ UpgradeMenu
# Binary OPTIONS
#
[bin]
FileManager = lfub
FileManager = yazi
Sudo = /bin/doas

View File

@ -431,6 +431,7 @@ opacity-rule = [
"95:class_g = 'Ferdium'",
"95:class_g = 'Ripcord'",
"95:class_g = 'TelegramDesktop'",
"95:class_g = 'KotatogramDesktop'",
"95:class_g = 'Thunderbird'",
"95:class_g = 'VSCodium'",
"95:class_g = 'discord'",

View File

@ -0,0 +1,19 @@
[general]
# Whether to hide empty columns or not
auto_hide = false
# Possible values: Red, Green, Blue, Yellow, Magenta, Cyan.
# Use prefix "Light" for a brighter color.
# It can also be a hex, e.g. "#3cb371"
accent_color = "LightMagenta"
# If enabled, shows various keybindings throughout the program at the cost of a
# little bit cluttered interface.
beginner_mode = true
[connection]
url = "http://localhost:9091/transmission/rpc" # REQUIRED!
# If you need username and password to authenticate:
# username = "CHANGE_ME"
# password = "CHANGE_ME"

View File

@ -12,6 +12,7 @@ alias \
mv="mv -iv" \
nsxiv="nsxiv -a" \
rm="rm -vI" \
wget="wget --hsts-file=$XDG_DATA_HOME/wget-hsts" \
keychain="keychain --dir $XDG_RUNTIME_DIR/keychain"
# Colorize commands when possible
@ -47,8 +48,7 @@ alias \
v="$EDITOR" \
weather="curl wttr.in/" \
ww="$EDITOR ~/neorg/" \
x="xplr -C ~/.config/xplr/hack.lua" \
z="zathura"
yy="yazi"
# doas not required for some system commands
for command in mount umount rsv sv pacman updatedb su shutdown poweroff reboot zzz systemctl wg wg-quick; do

View File

@ -12,7 +12,7 @@ export PATH="$PATH:${$(find ~/.local/bin -type d -printf %p:)%%:}"
# Disable files
export LESSHISTFILE=-
export $(dbus-launch)
# export $(dbus-launch)
unsetopt PROMPT_SP
@ -37,13 +37,20 @@ export XDG_RUNTIME_DIR="$HOME/.cache/xdgr"
export HYPRSHOT_DIR="$HOME/Pictures/screenshots"
export NODE_REPL_HISTORY="$XDG_DATA_HOME/node_repl_history"
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
export ANDROID_SDK_HOME="$XDG_CONFIG_HOME/android"
export ANDROID_USER_HOME="$XDG_DATA_HOME/android"
export ANDROID_HOME="$XDG_CONFIG_HOME/android"
export ANSIBLE_CONFIG="$XDG_CONFIG_HOME/ansible/ansible.cfg"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export CUDA_CACHE_PATH="$XDG_CACHE_HOME/nv"
export ELECTRUMDIR="$XDG_DATA_HOME/electrum"
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export GRADLE_USER_HOME="$XDG_DATA_HOME/gradle"
export XCURSOR_PATH="/usr/share/icons:$XDG_DATA_HOME/icons"
export IPYTHONDIR="$XDG_CONFIG_HOME/ipython"
export GOPATH="$XDG_DATA_HOME/go"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
export HISTFILE="$XDG_CONFIG_HOME/zsh/history"
@ -71,7 +78,12 @@ export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"
export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME/java"
export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=${XDG_CONFIG_HOME}/java - Djavafx.cachedir=${XDG_CACHE_HOME}/openjfx"
export PARALLEL_HOME="$XDG_CONFIG_HOME/parallel"
export MYSQL_HISTFILE="$XDG_DATA_HOME/mysql_history"
export HISTFILE="$XDG_STATE_HOME/bash/history"
export W3M_DIR="$XDG_DATA_HOME/w3m"
export RYE_HOME="$XDG_DATA_HOME/rye"
# Other program settings
export AWT_TOOLKIT="MToolkit wmname LG3D" # May have to install wmname
@ -87,8 +99,12 @@ export LESS_TERMCAP_so="$(printf '%b' '')"
export LESS_TERMCAP_ue="$(printf '%b' '')"
export LESS_TERMCAP_us="$(printf '%b' '')"
export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads.
export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
export QT_QPA_PLATFORMTHEME="gtk3" # Have QT use gtk3 theme.
# export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
# export QT_QPA_PLATFORMTHEME="gtk3" # Have QT use gtk3 theme.
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_SCREEN_SCALE_FACTORS="1;1"
export SUDO_ASKPASS="$HOME/.local/bin/dmenupass"
export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm
. "$XDG_DATA_HOME/cargo/env"
. "$XDG_DATA_HOME/rye/env"

View File

@ -1,5 +1,6 @@
ignore-empty-password
font="Fira Sans Semibold"
font-size=128
clock
timestr=%T
@ -12,7 +13,7 @@ screenshots
# image=~/.cache/current_wallpaper.jpg
# Fade in time
# fade-in=1
#fade-in=0.5
# Effect for background
effect-blur=10x5
@ -23,12 +24,12 @@ effect-blur=10x5
indicator
# smaller indicator
indicator-radius=200
#indicator-radius=200
# bigger indicator
# indicator-radius=300
indicator-radius=300
indicator-thickness=20
indicator-thickness=0
indicator-caps-lock
# Define all colors
@ -36,7 +37,7 @@ indicator-caps-lock
key-hl-color=00000066
separator-color=00000000
inside-color=00000033
inside-color=00000000
inside-clear-color=c0caf500
inside-caps-lock-color=c0caf500
inside-ver-color=c0caf500

View File

@ -45,7 +45,14 @@ set -g @plugin "tmux-plugins/tpm"
set -g @plugin "tmux-plugins/tmux-sensible"
set -g @plugin "christoomey/vim-tmux-navigator"
set -g @plugin "tmux-plugins/tmux-yank"
set -g @plugin "ofirgall/tmux-window-name"
# set -g @plugin "ofirgall/tmux-window-name"
set -g @plugin "tmux-plugins/tmux-resurrect"
set -g @plugin "rose-pine/tmux"
set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
# set vi-mode
set-window-option -g mode-keys vi
@ -54,39 +61,89 @@ bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selectet-and-cancel
# Rose pine
set -g @rose_pine_variant 'main' # Options are 'main', 'moon' or 'dawn'
set -g @rose_pine_host 'on' # Enables hostname in the status bar
set -g @rose_pine_date_time '' # It accepts the date UNIX command format (man date for info)
set -g @rose_pine_user 'on' # Turn on the username component in the statusbar
set -g @rose_pine_directory 'on' # Turn on the current folder component in the status bar
set -g @rose_pine_bar_bg_disable 'default' # Disables background color, for transparent terminal emulators
# If @rose_pine_bar_bg_disable is set to 'on', uses the provided value to set the background color
# It can be any of the on tmux (named colors, 256-color set, `default` or hex colors)
# See more on http://man.openbsd.org/OpenBSD-current/man1/tmux.1#STYLES
set -g @rose_pine_bar_bg_disabled_color_option 'default'
set -g @rose_pine_only_windows 'on' # Leaves only the window module, for max focus and space
set -g @rose_pine_disable_active_window_menu 'on' # Disables the menu that shows the active window on the left
set -g @rose_pine_default_window_behavior 'on' # Forces tmux default window list behaviour
set -g @rose_pine_show_current_program 'on' # Forces tmux to show the current running program as window name
set -g @rose_pine_show_pane_directory 'on' # Forces tmux to show the current directory as window name
# Previously set -g @rose_pine_window_tabs_enabled
# Example values for these can be:
set -g @rose_pine_left_separator ' > ' # The strings to use as separators are 1-space padded
set -g @rose_pine_right_separator ' < ' # Accepts both normal chars & nerdfont icons
set -g @rose_pine_field_separator ' | ' # Again, 1-space padding, it updates with prefix + I
set -g @rose_pine_window_separator ' - ' # Replaces the default `:` between the window number and name
# These are not padded
set -g @rose_pine_session_icon '' # Changes the default icon to the left of the session name
set -g @rose_pine_current_window_icon '' # Changes the default icon to the left of the active window name
set -g @rose_pine_folder_icon '' # Changes the default icon to the left of the current directory folder
set -g @rose_pine_username_icon '' # Changes the default icon to the right of the hostname
set -g @rose_pine_hostname_icon '󰒋' # Changes the default icon to the right of the hostname
set -g @rose_pine_date_time_icon '󰃰' # Changes the default icon to the right of the date module
set -g @rose_pine_window_status_separator "  " # Changes the default icon that appears between window names
# Very beta and specific opt-in settings, tested on v3.2a, look at issue #10
set -g @rose_pine_prioritize_windows 'on' # Disables the right side functionality in a certain window count / terminal width
set -g @rose_pine_width_to_hide '80' # Specify a terminal width to toggle off most of the right side functionality
set -g @rose_pine_window_count '5' # Specify a number of windows, if there are more than the number, do the same as width_to_hide
# TokyoNight colors for Tmux
set -g mode-style "fg=#7aa2f7,bg=#3b4261"
set -g message-style "fg=#7aa2f7,bg=#3b4261"
set -g message-command-style "fg=#7aa2f7,bg=#3b4261"
set -g pane-border-style "fg=#3b4261"
set -g pane-active-border-style "fg=#7aa2f7"
set -g status "on"
set -g status-justify "left"
set -g status-style "fg=#7aa2f7,bg=#16161e"
set -g status-left-length "100"
set -g status-right-length "100"
set -g status-left-style NONE
set -g status-right-style NONE
set -g status-left "#[fg=#15161e,bg=#7aa2f7,bold] #S #[fg=#7aa2f7,bg=#16161e,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#16161e,bg=#16161e,nobold,nounderscore,noitalics]#[fg=#7aa2f7,bg=#16161e] #{prefix_highlight} #[fg=#3b4261,bg=#16161e,nobold,nounderscore,noitalics]#[fg=#7aa2f7,bg=#3b4261] %H:%M | %d.%m.%Y #[fg=#7aa2f7,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#15161e,bg=#7aa2f7,bold] #h "
setw -g window-status-activity-style "underscore,fg=#a9b1d6,bg=#16161e"
setw -g window-status-separator ""
setw -g window-status-style "NONE,fg=#a9b1d6,bg=#16161e"
setw -g window-status-format "#[fg=#16161e,bg=#16161e,nobold,nounderscore,noitalics]#[default] #I #W #F #[fg=#16161e,bg=#16161e,nobold,nounderscore,noitalics]"
setw -g window-status-current-format "#[fg=#16161e,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#7aa2f7,bg=#3b4261,bold] #I #W #F #[fg=#3b4261,bg=#16161e,nobold,nounderscore,noitalics]"
# set -g mode-style "fg=#7aa2f7,bg=#3b4261"
#
# set -g message-style "fg=#7aa2f7,bg=#3b4261"
# set -g message-command-style "fg=#7aa2f7,bg=#3b4261"
#
# set -g pane-border-style "fg=#3b4261"
# set -g pane-active-border-style "fg=#7aa2f7"
#
# set -g status "on"
# set -g status-justify "left"
#
# set -g status-style "fg=#7aa2f7,bg=#16161e"
#
# set -g status-left-length "100"
# set -g status-right-length "100"
#
# set -g status-left-style NONE
# set -g status-right-style NONE
#
# set -g status-left "#[fg=#15161e,bg=#7aa2f7,bold] #S #[fg=#7aa2f7,bg=#16161e,nobold,nounderscore,noitalics]"
# set -g status-right "#[fg=#16161e,bg=#16161e,nobold,nounderscore,noitalics]#[fg=#7aa2f7,bg=#16161e] #{prefix_highlight} #[fg=#3b4261,bg=#16161e,nobold,nounderscore,noitalics]#[fg=#7aa2f7,bg=#3b4261] %H:%M | %d.%m.%Y #[fg=#7aa2f7,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#15161e,bg=#7aa2f7,bold] #h "
#
# setw -g window-status-activity-style "underscore,fg=#a9b1d6,bg=#16161e"
# setw -g window-status-separator ""
# setw -g window-status-style "NONE,fg=#a9b1d6,bg=#16161e"
# setw -g window-status-format "#[fg=#16161e,bg=#16161e,nobold,nounderscore,noitalics]#[default] #I #W #F #[fg=#16161e,bg=#16161e,nobold,nounderscore,noitalics]"
# setw -g window-status-current-format "#[fg=#16161e,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#7aa2f7,bg=#3b4261,bold] #I #W #F #[fg=#3b4261,bg=#16161e,nobold,nounderscore,noitalics]"
# tmux-plugins/tmux-prefix-highlight support
set -g @prefix_highlight_output_prefix "#[fg=#e0af68]#[bg=#16161e]#[fg=#16161e]#[bg=#e0af68]"
set -g @prefix_highlight_output_suffix ""
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @tmux_window_dir_programs "['nvim', 'vim', 'vi', 'git']"
set -g @tmux_window_name_ignored_programs "[]"
set -g @tmux_window_name_max_name_len "20"
set -g @tmux_window_name_use_tilde "True"
set -g @tmux_window_name_show_program_args "True"
run "~/.config/tmux/plugins/tpm/tpm"

58
.config/wofi/style.css Normal file
View File

@ -0,0 +1,58 @@
window {
margin: 0px;
background-color: #191724;
border-radius: 0px;
border: 2px solid #eb6f92;
color: #e0def4;
font-family: 'JetBrainsMono NF';
font-size: 14px;
}
#input {
margin: 0px;
border-radius: 0px;
border: none;
border-radius: 0px;
color: #eb6f92;
background-color: #26233a;
}
#inner-box {
margin: 0px;
border: none;
background-color: #26233a;
color: #191724;
border-radius: 0px;
}
#outer-box {
margin: 0px;
border: none;
background-color: #191724;
}
#scroll {
margin: 0px;
border: none;
}
#text {
margin: 0px;
border: none;
color: #e0def4;
}
#entry:selected {
background-color: #eb6f92;
color: #191724;
border-radius: 0px;
outline: none;
}
#entry:selected * {
background-color: #eb6f92;
color: #191724;
border-radius: 0px;
outline: none;
}

View File

@ -1,14 +1,13 @@
#!/bin/sh
autostart="picom nextcloud telegram-desktop spotify-launcher discord transmission-daemon librewolf discord syncthing mullvad-vpn"
autostart="picom nextcloud discord transmission-daemon librewolf discord syncthing mullvad-vpn spotify-launcher"
for program in $autostart; do
pidof -sx "$program" || "$program" &
done
# >/dev/null 2>&1
setxkbmap lv &
remaps & # run the remaps script, switching caps/esc and more; check it for more info
xrandr --output DisplayPort-0 --mode 1920x1080 --rate 75 --output HDMI-A-0 --mode 1920x1080 --rate 60 --left-of DisplayPort-0 &
xrandr --output DisplayPort-0 --rate 60 --output HDMI-A-0 --rate 60 --left-of DisplayPort-0 &
# spotifyd --no-daemon &
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &

View File

@ -15,3 +15,4 @@ else
fi
ssh-agent awesome
# dbus-launch --sh-syntax --exit-with-session awesome

View File

@ -1,22 +1,36 @@
! TokyoNight colors for Xresources
! special
*.foreground: #e0def4
*.background: #191724
*.cursorColor: #e0def4
*background: #1a1b26
*foreground: #c0caf5
! black
*.color0: #1f1d2e
*.color8: #26233a
*color0: #15161e
*color1: #f7768e
*color2: #9ece6a
*color3: #e0af68
*color4: #7aa2f7
*color5: #bb9af7
*color6: #7dcfff
*color7: #a9b1d6
! red
*.color1: #eb6f92
*.color9: #eb6f92
*color8: #414868
*color9: #f7768e
*color10: #9ece6a
*color11: #e0af68
*color12: #7aa2f7
*color13: #bb9af7
*color14: #7dcfff
*color15: #c0caf5
! green
*.color2: #f6c177
*.color10: #f6c177
! yellow
*.color3: #ebbcba
*.color11: #ebbcba
! blue
*.color4: #31748f
*.color12: #31748f
! magenta
*.color5: #c4a7e7
*.color13: #c4a7e7
! cyan
*.color6: #9ccfd8
*.color14: #9ccfd8
! white
*.color7: #6e6a86
*.color15: #908caa

View File

@ -0,0 +1,23 @@
Xft.dpi: 144
! TokyoNight colors for Xresources
*background: #1a1b26
*foreground: #c0caf5
*color0: #15161e
*color1: #f7768e
*color2: #9ece6a
*color3: #e0af68
*color4: #7aa2f7
*color5: #bb9af7
*color6: #7dcfff
*color7: #a9b1d6
*color8: #414868
*color9: #f7768e
*color10: #9ece6a
*color11: #e0af68
*color12: #7aa2f7
*color13: #bb9af7
*color14: #7dcfff
*color15: #c0caf5

10
.config/yazi/.luarc.json Normal file
View File

@ -0,0 +1,10 @@
{
"diagnostics.globals": [
"Status",
"cx",
"ui",
"Progress",
"ya"
],
}

@ -0,0 +1 @@
Subproject commit 4101d0d9c475f23d94b7262e7fd945930378807e

@ -0,0 +1 @@
Subproject commit 024fb096821e7d2f9d09a338f088918d8cfadf34

16
.config/yazi/init.lua Normal file
View File

@ -0,0 +1,16 @@
-- 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",
smart_enter = true,
smart_paste = false,
enter_archives = true,
extract_behaviour = "skip",
must_have_hovered_item = true,
skip_single_subdirectory_on_enter = false,
skip_single_subdirectory_on_leave = false,
ignore_hidden_items = false,
wraparound_file_navigation = false,
})

857
.config/yazi/keymap.toml Normal file
View File

@ -0,0 +1,857 @@
# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config.
# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas.
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"
[manager]
keymap = [
{ on = [
"<Esc>",
], run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
{ on = [
"<C-[>",
], run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
{ on = [
"q",
], run = "quit", desc = "Exit the process" },
{ on = [
"Q",
], run = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" },
{ on = [
"<C-q>",
], run = "close", desc = "Close the current tab, or quit if it is last tab" },
{ on = [
"<C-z>",
], run = "suspend", desc = "Suspend the process" },
# Navigation
{ on = [
"k",
], run = "arrow -1", desc = "Move cursor up" },
{ on = [
"j",
], run = "arrow 1", desc = "Move cursor down" },
{ on = [
"K",
], run = "arrow -5", desc = "Move cursor up 5 lines" },
{ on = [
"J",
], run = "arrow 5", desc = "Move cursor down 5 lines" },
{ on = [
"<S-Up>",
], run = "arrow -5", desc = "Move cursor up 5 lines" },
{ on = [
"<S-Down>",
], run = "arrow 5", desc = "Move cursor down 5 lines" },
{ on = [
"<C-u>",
], run = "arrow -50%", desc = "Move cursor up half page" },
{ on = [
"<C-d>",
], run = "arrow 50%", desc = "Move cursor down half page" },
{ on = [
"<C-b>",
], run = "arrow -100%", desc = "Move cursor up one page" },
{ on = [
"<C-f>",
], run = "arrow 100%", desc = "Move cursor down one page" },
{ on = [
"<C-PageUp>",
], run = "arrow -50%", desc = "Move cursor up half page" },
{ on = [
"<C-PageDown>",
], run = "arrow 50%", desc = "Move cursor down half page" },
{ on = [
"<PageUp>",
], run = "arrow -100%", desc = "Move cursor up one page" },
{ on = [
"<PageDown>",
], run = "arrow 100%", desc = "Move cursor down one page" },
{ on = [
"h",
], run = "leave", desc = "Go back to the parent directory" },
{ on = [
"l",
], run = "enter", desc = "Enter the child directory" },
{ on = [
"H",
], run = "back", desc = "Go back to the previous directory" },
{ on = [
"L",
], run = "forward", desc = "Go forward to the next directory" },
{ on = [
"<A-h>",
], run = "seek -5", desc = "Seek up 5 units in the preview" },
{ on = [
"<A-l>",
], run = "seek 5", desc = "Seek down 5 units in the preview" },
{ on = [
"g",
"g",
], run = "arrow -99999999", desc = "Move cursor to the top" },
{ on = [
"G",
], run = "arrow 99999999", desc = "Move cursor to the bottom" },
# Selection
{ on = [
"<Space>",
], run = [
"select --state=none",
"arrow 1",
], desc = "Toggle the current selection state" },
{ on = [
"v",
], run = "visual_mode", desc = "Enter visual mode (selection mode)" },
{ on = [
"V",
], run = "visual_mode --unset", desc = "Enter visual mode (unset mode)" },
{ on = [
"<C-a>",
], run = "select_all --state=true", desc = "Select all files" },
{ on = [
"<C-r>",
], run = "select_all --state=none", desc = "Inverse selection of all files" },
# Operation
{ on = [
"e",
], run = "open", desc = "Open the selected files" },
{ on = [
"o",
], run = "open", desc = "Open the selected files" },
{ on = [
"O",
], run = "open --interactive", desc = "Open the selected files interactively" },
{ on = [
"<Enter>",
], run = "open", desc = "Open the selected files" },
{ on = [
"<C-Enter>",
], run = "open --interactive", desc = "Open the selected files interactively" },
{ on = [
"y",
], run = "yank", desc = "Copy the selected files" },
{ on = [
"Y",
], run = "unyank", desc = "Cancel the yank status of files" },
{ on = [
"x",
], run = "yank --cut", desc = "Cut the selected files" },
{ on = [
"X",
], run = "unyank", desc = "Cancel the yank status of files" },
{ on = [
"p",
], run = "paste", desc = "Paste the files" },
{ on = [
"P",
], run = "paste --force", desc = "Paste the files (overwrite if the destination exists)" },
{ on = [
"-",
], run = "link", desc = "Symlink the absolute path of files" },
{ on = [
"_",
], run = "link --relative", desc = "Symlink the relative path of files" },
{ on = [
"d",
], run = "remove", desc = "Move the files to the trash" },
{ on = [
"D",
], run = "remove --permanently", desc = "Permanently delete the files" },
{ on = [
"a",
], run = "create", desc = "Create a file or directory (ends with / for directories)" },
{ on = [
"r",
], run = "rename --cursor=before_ext", desc = "Rename a file or directory" },
{ on = [
";",
], run = "shell --interactive", desc = "Run a shell command" },
{ on = [
":",
], run = "shell --block --interactive", desc = "Run a shell command (block the UI until the command finishes)" },
{ on = [
".",
], run = "hidden toggle", desc = "Toggle the visibility of hidden files" },
{ on = [
"s",
], run = "search fd", desc = "Search files by name using fd" },
{ on = [
"S",
], run = "search rg", desc = "Search files by content using ripgrep" },
{ on = [
"<C-c>",
], run = "search none", desc = "Cancel the ongoing search" },
{ on = [
"z",
], run = "plugin zoxide", desc = "Jump to a directory using zoxide" },
{ on = [
"Z",
], run = "plugin fzf", desc = "Jump to a directory, or reveal a file using fzf" },
# Linemode
{ on = [
"m",
"s",
], run = "linemode size", desc = "Set linemode to size" },
{ on = [
"m",
"p",
], run = "linemode permissions", desc = "Set linemode to permissions" },
{ on = [
"m",
"m",
], run = "linemode mtime", desc = "Set linemode to mtime" },
{ on = [
"m",
"n",
], run = "linemode none", desc = "Set linemode to none" },
# Copy
{ on = [
"c",
"c",
], run = "copy path", desc = "Copy the absolute path" },
{ on = [
"c",
"d",
], run = "copy dirname", desc = "Copy the path of the parent directory" },
{ on = [
"c",
"f",
], run = "copy filename", desc = "Copy the name of the file" },
{ on = [
"c",
"n",
], run = "copy name_without_ext", desc = "Copy the name of the file without the extension" },
# Filter
{ on = [
"f",
], run = "filter --smart", desc = "Filter the files" },
# Find
{ on = [
"/",
], run = "find --smart", desc = "Find next file" },
{ on = [
"?",
], run = "find --previous --smart", desc = "Find previous file" },
{ on = [
"n",
], run = "find_arrow", desc = "Go to next found file" },
{ on = [
"N",
], run = "find_arrow --previous", desc = "Go to previous found file" },
# Sorting
{ on = [
",",
"m",
], run = "sort modified --dir-first", desc = "Sort by modified time" },
{ on = [
",",
"M",
], run = "sort modified --reverse --dir-first", desc = "Sort by modified time (reverse)" },
{ on = [
",",
"c",
], run = "sort created --dir-first", desc = "Sort by created time" },
{ on = [
",",
"C",
], run = "sort created --reverse --dir-first", desc = "Sort by created time (reverse)" },
{ on = [
",",
"e",
], run = "sort extension --dir-first", desc = "Sort by extension" },
{ on = [
",",
"E",
], run = "sort extension --reverse --dir-first", desc = "Sort by extension (reverse)" },
{ on = [
",",
"a",
], run = "sort alphabetical --dir-first", desc = "Sort alphabetically" },
{ on = [
",",
"A",
], run = "sort alphabetical --reverse --dir-first", desc = "Sort alphabetically (reverse)" },
{ on = [
",",
"n",
], run = "sort natural --dir-first", desc = "Sort naturally" },
{ on = [
",",
"N",
], run = "sort natural --reverse --dir-first", desc = "Sort naturally (reverse)" },
{ on = [
",",
"s",
], run = "sort size --dir-first", desc = "Sort by size" },
{ on = [
",",
"S",
], run = "sort size --reverse --dir-first", desc = "Sort by size (reverse)" },
# Tabs
{ on = [
"t",
], run = "tab_create --current", desc = "Create a new tab using the current path" },
{ on = [
"1",
], run = "tab_switch 0", desc = "Switch to the first tab" },
{ on = [
"2",
], run = "tab_switch 1", desc = "Switch to the second tab" },
{ on = [
"3",
], run = "tab_switch 2", desc = "Switch to the third tab" },
{ on = [
"4",
], run = "tab_switch 3", desc = "Switch to the fourth tab" },
{ on = [
"5",
], run = "tab_switch 4", desc = "Switch to the fifth tab" },
{ on = [
"6",
], run = "tab_switch 5", desc = "Switch to the sixth tab" },
{ on = [
"7",
], run = "tab_switch 6", desc = "Switch to the seventh tab" },
{ on = [
"8",
], run = "tab_switch 7", desc = "Switch to the eighth tab" },
{ on = [
"9",
], run = "tab_switch 8", desc = "Switch to the ninth tab" },
{ on = [
"[",
], run = "tab_switch -1 --relative", desc = "Switch to the previous tab" },
{ on = [
"]",
], run = "tab_switch 1 --relative", desc = "Switch to the next tab" },
{ on = [
"{",
], run = "tab_swap -1", desc = "Swap the current tab with the previous tab" },
{ on = [
"}",
], run = "tab_swap 1", desc = "Swap the current tab with the next tab" },
# Tasks
{ on = [
"w",
], run = "tasks_show", desc = "Show the tasks manager" },
# Goto
{ on = [
"g",
"h",
], run = "cd ~", desc = "Go to the Home directory" },
{ on = [
"g",
"c",
], run = "cd ~/.config", desc = "Go to the .config directory" },
{ on = [
"g",
"d",
], run = "cd ~/Downloads", desc = "Go to the Downloads directory" },
{ on = [
"g",
"t",
], run = "cd /tmp", desc = "Go to the tmp directory" },
{ on = [
"g",
"D",
], run = "cd ~/Documents", desc = "Go to the Documents directory" },
{ on = [
"g",
"l",
], run = "cd ~/.local", desc = "Go to the .local directory" },
{ on = [
"g",
"n",
], run = "cd ~/Nextcloud", desc = "Go to the Nextcloud directory" },
{ on = [
"g",
"p",
], run = "cd ~/Pictures", desc = "Go to the Pictures directory" },
{ on = [
"g",
"v",
], run = "cd ~/Videos", desc = "Go to the Videos directory" },
{ on = [
"g",
"r",
], run = "cd ~/repos", desc = "Go to the repos directory" },
{ on = [
"g",
"<Space>",
], run = "cd --interactive", desc = "Go to a directory interactively" },
# Help
{ on = [
"~",
], run = "help", desc = "Open help" },
]
prepend_keymap = [
# Custom
{ on = [
"y",
], run = [
''' shell 'fd -a "$1" | xclip -selection clipboard' --confirm ''',
"yank",
], desc = "Yank the selected files" },
{ on = [
"y",
], run = [
''' shell 'fd -a "$1" | wl-copy' --confirm ''',
"yank",
], desc = "Yank the selected files" },
{ on = [
"b",
"g",
], run = [
''' shell 'setbg "$1"' --confirm ''',
], desc = "Set the background image" },
# chmod
{ on = [
"c",
"m",
], run = "plugin chmod", desc = "Chmod on selected files" },
# Archive
{ on = [
"c",
"a",
], run = "plugin archive", desc = "Archive selected files" },
# Augment Command
{ on = [
"l",
], run = "plugin augment-command --args='enter'", desc = "Enter a directory and skip directories with only a single subdirectory" },
{ on = [
"k",
], run = "plugin augment-command --args='arrow -1'", desc = "Move cursor up" },
{ on = [
"r",
], run = "plugin augment-command --args='rename --cursor=before_ext'", desc = "Rename a file or directory" },
{ on = [
"D",
], run = "plugin augment-command --args='remove --permanently'", desc = "Permanently delete the files" },
# Dragon
{ on = [
"m",
"a",
], run = ''' shell 'ripdrag -atk "$@"' --confirm ''', desc = "Drag and drop all" },
{ on = [
"m",
"i",
], run = ''' shell 'ripdrag -tk "$@"' --confirm ''', desc = "Drag and drop individual" },
# Max Preview
{ on = "T", run = "plugin --sync max-preview", desc = "Maximize or restore preview" },
# Hide Preview
{ on = "<C-t>", run = "plugin --sync hide-preview", desc = "Hide or show preview" },
# Relative motions
# { on = [
# "1",
# ], run = "plugin relative-motions --args=1", desc = "Move in relative steps" },
# { on = [
# "2",
# ], run = "plugin relative-motions --args=2", desc = "Move in relative steps" },
# { on = [
# "3",
# ], run = "plugin relative-motions --args=3", desc = "Move in relative steps" },
# { on = [
# "4",
# ], run = "plugin relative-motions --args=4", desc = "Move in relative steps" },
# { on = [
# "5",
# ], run = "plugin relative-motions --args=5", desc = "Move in relative steps" },
# { on = [
# "6",
# ], run = "plugin relative-motions --args=6", desc = "Move in relative steps" },
# { on = [
# "7",
# ], run = "plugin relative-motions --args=7", desc = "Move in relative steps" },
# { on = [
# "8",
# ], run = "plugin relative-motions --args=8", desc = "Move in relative steps" },
# { on = [
# "9",
# ], run = "plugin relative-motions --args=9", desc = "Move in relative steps" },
]
[tasks]
keymap = [
{ on = [
"<Esc>",
], run = "close", desc = "Hide the task manager" },
{ on = [
"<C-[>",
], run = "close", desc = "Hide the task manager" },
{ on = [
"<C-q>",
], run = "close", desc = "Hide the task manager" },
{ on = [
"w",
], run = "close", desc = "Hide the task manager" },
{ on = [
"k",
], run = "arrow -1", desc = "Move cursor up" },
{ on = [
"j",
], run = "arrow 1", desc = "Move cursor down" },
{ on = [
"<Up>",
], run = "arrow -1", desc = "Move cursor up" },
{ on = [
"<Down>",
], run = "arrow 1", desc = "Move cursor down" },
{ on = [
"<Enter>",
], run = "inspect", desc = "Inspect the task" },
{ on = [
"x",
], run = "cancel", desc = "Cancel the task" },
{ on = [
"~",
], run = "help", desc = "Open help" },
]
[select]
keymap = [
{ on = [
"<Esc>",
], run = "close", desc = "Cancel selection" },
{ on = [
"<C-[>",
], run = "close", desc = "Cancel selection" },
{ on = [
"<C-q>",
], run = "close", desc = "Cancel selection" },
{ on = [
"<Enter>",
], run = "close --submit", desc = "Submit the selection" },
{ on = [
"k",
], run = "arrow -1", desc = "Move cursor up" },
{ on = [
"j",
], run = "arrow 1", desc = "Move cursor down" },
{ on = [
"K",
], run = "arrow -5", desc = "Move cursor up 5 lines" },
{ on = [
"J",
], run = "arrow 5", desc = "Move cursor down 5 lines" },
{ on = [
"<Up>",
], run = "arrow -1", desc = "Move cursor up" },
{ on = [
"<Down>",
], run = "arrow 1", desc = "Move cursor down" },
{ on = [
"<S-Up>",
], run = "arrow -5", desc = "Move cursor up 5 lines" },
{ on = [
"<S-Down>",
], run = "arrow 5", desc = "Move cursor down 5 lines" },
{ on = [
"~",
], run = "help", desc = "Open help" },
]
[input]
keymap = [
{ on = [
"<C-q>",
], run = "close", desc = "Cancel input" },
{ on = [
"<Enter>",
], run = "close --submit", desc = "Submit the input" },
{ on = [
"<Esc>",
], run = "escape", desc = "Go back the normal mode, or cancel input" },
{ on = [
"<C-[>",
], run = "escape", desc = "Go back the normal mode, or cancel input" },
# Mode
{ on = [
"i",
], run = "insert", desc = "Enter insert mode" },
{ on = [
"a",
], run = "insert --append", desc = "Enter append mode" },
{ on = [
"I",
], run = [
"move -999",
"insert",
], desc = "Move to the BOL, and enter insert mode" },
{ on = [
"A",
], run = [
"move 999",
"insert --append",
], desc = "Move to the EOL, and enter append mode" },
{ on = [
"v",
], run = "visual", desc = "Enter visual mode" },
{ on = [
"V",
], run = [
"move -999",
"visual",
"move 999",
], desc = "Enter visual mode and select all" },
# Character-wise movement
{ on = [
"h",
], run = "move -1", desc = "Move back a character" },
{ on = [
"l",
], run = "move 1", desc = "Move forward a character" },
{ on = [
"<Left>",
], run = "move -1", desc = "Move back a character" },
{ on = [
"<Right>",
], run = "move 1", desc = "Move forward a character" },
{ on = [
"<C-b>",
], run = "move -1", desc = "Move back a character" },
{ on = [
"<C-f>",
], run = "move 1", desc = "Move forward a character" },
# Word-wise movement
{ on = [
"b",
], run = "backward", desc = "Move back to the start of the current or previous word" },
{ on = [
"w",
], run = "forward", desc = "Move forward to the start of the next word" },
{ on = [
"e",
], run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
{ on = [
"<A-b>",
], run = "backward", desc = "Move back to the start of the current or previous word" },
{ on = [
"<A-f>",
], run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
# Line-wise movement
{ on = [
"0",
], run = "move -999", desc = "Move to the BOL" },
{ on = [
"$",
], run = "move 999", desc = "Move to the EOL" },
{ on = [
"<C-a>",
], run = "move -999", desc = "Move to the BOL" },
{ on = [
"<C-e>",
], run = "move 999", desc = "Move to the EOL" },
{ on = [
"<Home>",
], run = "move -999", desc = "Move to the BOL" },
{ on = [
"<End>",
], run = "move 999", desc = "Move to the EOL" },
# Delete
{ on = [
"<Backspace>",
], run = "backspace", desc = "Delete the character before the cursor" },
{ on = [
"<Delete>",
], run = "backspace --under", desc = "Delete the character under the cursor" },
{ on = [
"<C-h>",
], run = "backspace", desc = "Delete the character before the cursor" },
{ on = [
"<C-d>",
], run = "backspace --under", desc = "Delete the character under the cursor" },
# Kill
{ on = [
"<C-u>",
], run = "kill bol", desc = "Kill backwards to the BOL" },
{ on = [
"<C-k>",
], run = "kill eol", desc = "Kill forwards to the EOL" },
{ on = [
"<C-w>",
], run = "kill backward", desc = "Kill backwards to the start of the current word" },
{ on = [
"<A-d>",
], run = "kill forward", desc = "Kill forwards to the end of the current word" },
# Cut/Yank/Paste
{ on = [
"d",
], run = "delete --cut", desc = "Cut the selected characters" },
{ on = [
"D",
], run = [
"delete --cut",
"move 999",
], desc = "Cut until the EOL" },
{ on = [
"c",
], run = "delete --cut --insert", desc = "Cut the selected characters, and enter insert mode" },
{ on = [
"C",
], run = [
"delete --cut --insert",
"move 999",
], desc = "Cut until the EOL, and enter insert mode" },
{ on = [
"x",
], run = [
"delete --cut",
"move 1 --in-operating",
], desc = "Cut the current character" },
{ on = [
"y",
], run = "yank", desc = "Copy the selected characters" },
{ on = [
"p",
], run = "paste", desc = "Paste the copied characters after the cursor" },
{ on = [
"P",
], run = "paste --before", desc = "Paste the copied characters before the cursor" },
# Undo/Redo
{ on = [
"u",
], run = "undo", desc = "Undo the last operation" },
{ on = [
"<C-r>",
], run = "redo", desc = "Redo the last operation" },
# Help
{ on = [
"~",
], run = "help", desc = "Open help" },
]
[completion]
keymap = [
{ on = [
"<C-q>",
], run = "close", desc = "Cancel completion" },
{ on = [
"<Tab>",
], run = "close --submit", desc = "Submit the completion" },
{ on = [
"<Enter>",
], run = [
"close --submit",
"close_input --submit",
], desc = "Submit the completion and input" },
{ on = [
"<A-k>",
], run = "arrow -1", desc = "Move cursor up" },
{ on = [
"<A-j>",
], run = "arrow 1", desc = "Move cursor down" },
{ on = [
"<Up>",
], run = "arrow -1", desc = "Move cursor up" },
{ on = [
"<Down>",
], run = "arrow 1", desc = "Move cursor down" },
{ on = [
"<C-p>",
], run = "arrow -1", desc = "Move cursor up" },
{ on = [
"<C-n>",
], run = "arrow 1", desc = "Move cursor down" },
{ on = [
"~",
], run = "help", desc = "Open help" },
]
[help]
keymap = [
{ on = [
"<Esc>",
], run = "escape", desc = "Clear the filter, or hide the help" },
{ on = [
"<C-[>",
], run = "escape", desc = "Clear the filter, or hide the help" },
{ on = [
"q",
], run = "close", desc = "Exit the process" },
{ on = [
"<C-q>",
], run = "close", desc = "Hide the help" },
# Navigation
{ on = [
"k",
], run = "arrow -1", desc = "Move cursor up" },
{ on = [
"j",
], run = "arrow 1", desc = "Move cursor down" },
{ on = [
"K",
], run = "arrow -5", desc = "Move cursor up 5 lines" },
{ on = [
"J",
], run = "arrow 5", desc = "Move cursor down 5 lines" },
{ on = [
"<Up>",
], run = "arrow -1", desc = "Move cursor up" },
{ on = [
"<Down>",
], run = "arrow 1", desc = "Move cursor down" },
{ on = [
"<S-Up>",
], run = "arrow -5", desc = "Move cursor up 5 lines" },
{ on = [
"<S-Down>",
], run = "arrow 5", desc = "Move cursor down 5 lines" },
# Filtering
{ on = [
"/",
], run = "filter", desc = "Apply a filter for the help items" },
]

View File

@ -0,0 +1,5 @@
[plugin]
deps = [{ use = "AnirudhG07/nbpreview", commit = "f0149a4" }, { use = "kirasok/torrent-preview", commit = "76970b6" }, { use = "Sonico98/exifaudio", commit = "92366cf" }, { use = "Reledia/miller", commit = "75f0002" }, { use = "Reledia/glow", commit = "536185a" }, { use = "yazi-rs/plugins#chmod", commit = "3783ea0" }, { use = "yazi-rs/plugins#full-border", commit = "3783ea0" }, { use = "KKV9/archive", commit = "9f3b049" }, { use = "Rolv-Apneseth/starship", commit = "6197e4c" }, { use = "Reledia/hexyl", commit = "64daf93" }, { use = "hankertrix/augment-command", commit = "d81ddb8" }, { use = "imsi32/yatline", commit = "d26ffbc" }, { use = "dedukun/relative-motions", commit = "a5465c0" }, { use = "yazi-rs/plugins#max-preview", commit = "3783ea0" }, { use = "yazi-rs/plugins#hide-preview", commit = "3783ea0" }]
[flavor]
deps = []

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Ciarán O'Brien
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,47 @@
# archive.yazi
A Yazi plugin that compresses selected files to an archive.
## Supported file types
| Extention | Unix Command | Windows Command |
| ------------- | ------------- | --------------- |
| .zip | zip -r | 7z a -tzip |
| .7z | 7z a | 7z a |
| .tar | tar rpf | tar rpf |
| .tar.gz | gzip | 7z a -tgzip |
| .tar.bz2 | bzip2 | 7z a -tbzip2 |
| .tar.xz | xz | 7z a -txz |
**NOTE:** Windows users are required to install 7-Zip and add 7z.exe to the `path` environment variable, only tar archives will be available otherwise.
## Install
```bash
# For Unix platforms
git clone https://github.com/KKV9/archive.yazi.git ~/.config/yazi/plugins/archive.yazi
## For Windows
git clone https://github.com/KKV9/archive.yazi.git %AppData%\yazi\config\plugins\archive.yazi
# Or with yazi plugin manager
ya pack -a KKV9/archive
```
- Add this to your `keymap.toml`:
```toml
[[manager.prepend_keymap]]
on = [ "c", "a" ]
run = "plugin archive"
desc = "Archive selected files"
```
## Usage
- Select files or folders to add, then press `c` `a` to create a new archive.
- Type a name for the new file.
- The file extention must match one of the supported filetype extentions.
- The desired archive/compression command must be installed on your system.

View File

@ -0,0 +1,210 @@
-- Send error notification
local function notify_error(message, urgency)
ya.notify({
title = "Archive",
content = message,
level = urgency,
timeout = 5,
})
end
-- Check for windows
local is_windows = package.config:sub(1, 1) == "\\"
-- Make table of selected or hovered: path = filenames
local selected_or_hovered = ya.sync(function()
local tab, paths, names, path_fnames = cx.active, {}, {}, {}
for _, u in pairs(tab.selected) do
paths[#paths + 1] = tostring(u:parent())
names[#names + 1] = tostring(u:name())
end
if #paths == 0 and tab.current.hovered then
paths[1] = tostring(tab.current.hovered.url:parent())
names[1] = tostring(tab.current.hovered.name)
end
for idx, name in ipairs(names) do
if not path_fnames[paths[idx]] then
path_fnames[paths[idx]] = {}
end
table.insert(path_fnames[paths[idx]], name)
end
return path_fnames, tostring(tab.current.cwd)
end)
-- Check if archive command is available
local function is_command_available(cmd)
local stat_cmd
if is_windows then
stat_cmd = string.format("where %s > nul 2>&1", cmd)
else
stat_cmd = string.format("command -v %s >/dev/null 2>&1", cmd)
end
local cmd_exists = os.execute(stat_cmd)
if cmd_exists then
return true
else
notify_error(string.format("%s not available", cmd), "error")
return false
end
end
-- Check if file exists
local function file_exists(name)
local f = io.open(name, "r")
if f ~= nil then
io.close(f)
return true
else
return false
end
end
-- Append filename to it's parent directory
local function combine_url(path, file)
path, file = Url(path), Url(file)
return tostring(path:join(file))
end
return {
entry = function()
-- Exit visual mode
ya.manager_emit("escape", { visual = true })
-- Define file table and output_dir (pwd)
local path_fnames, output_dir = selected_or_hovered()
-- Get input
local output_name, event = ya.input({
title = "Create archive:",
position = { "top-center", y = 3, w = 40 },
})
if event ~= 1 then
return
end
-- Use appropriate archive command
local archive_commands = {
["%.zip$"] = { command = "zip", args = { "-r" } },
["%.7z$"] = { command = "7z", args = { "a" } },
["%.tar.gz$"] = { command = "tar", args = { "rpf" }, compress = "gzip" },
["%.tar.xz$"] = { command = "tar", args = { "rpf" }, compress = "xz" },
["%.tar.bz2$"] = { command = "tar", args = { "rpf" }, compress = "bzip2" },
["%.tar$"] = { command = "tar", args = { "rpf" } },
}
if is_windows then
archive_commands = {
["%.zip$"] = { command = "7z", args = { "a", "-tzip" } },
["%.7z$"] = { command = "7z", args = { "a" } },
["%.tar.gz$"] = {
command = "tar",
args = { "rpf" },
compress = "7z",
compress_args = { "a", "-tgzip", "-sdel", output_name },
},
["%.tar.xz$"] = {
command = "tar",
args = { "rpf" },
compress = "7z",
compress_args = { "a", "-txz", "-sdel", output_name },
},
["%.tar.bz2$"] = {
command = "tar",
args = { "rpf" },
compress = "7z",
compress_args = { "a", "-tbzip2", "-sdel", output_name },
},
["%.tar$"] = { command = "tar", args = { "rpf" } },
}
end
-- Match user input to archive command
local archive_cmd, archive_args, archive_compress, archive_compress_args
for pattern, cmd_pair in pairs(archive_commands) do
if output_name:match(pattern) then
archive_cmd = cmd_pair.command
archive_args = cmd_pair.args
archive_compress = cmd_pair.compress
archive_compress_args = cmd_pair.compress_args or {}
end
end
-- Check if no archive command is available for the extention
if not archive_cmd then
notify_error("Unsupported file extention", "error")
return
end
-- Exit if archive command is not available
if not is_command_available(archive_cmd) then
return
end
-- Exit if compress command is not available
if archive_compress and not is_command_available(archive_compress) then
return
end
-- If file exists show overwrite prompt
local output_url = combine_url(output_dir, output_name)
while true do
if file_exists(output_url) then
local overwrite_answer = ya.input({
title = "Overwrite " .. output_name .. "? y/N:",
position = { "top-center", y = 3, w = 40 },
})
if overwrite_answer:lower() ~= "y" then
notify_error("Operation canceled", "warn")
return -- If no overwrite selected, exit
else
local rm_status, rm_err = os.remove(output_url)
if not rm_status then
notify_error(string.format("Failed to remove %s, exit code %s", output_name, rm_err), "error")
return
end -- If overwrite fails, exit
end
end
if archive_compress and not output_name:match("%.tar$") then
output_name = output_name:match("(.*%.tar)") -- Test for .tar and .tar.*
output_url = combine_url(output_dir, output_name) -- Update output_url
else
break
end
end
-- Add to output archive in each path, their respective files
for path, names in pairs(path_fnames) do
local archive_status, archive_err =
Command(archive_cmd):args(archive_args):arg(output_url):args(names):cwd(path):spawn():wait()
if not archive_status or not archive_status.success then
notify_error(
string.format(
"%s with selected files failed, exit code %s",
archive_args,
archive_status and archive_status.code or archive_err
),
"error"
)
end
end
-- Use compress command if needed
if archive_compress then
local compress_status, compress_err =
Command(archive_compress):args(archive_compress_args):arg(output_name):cwd(output_dir):spawn():wait()
if not compress_status or not compress_status.success then
notify_error(
string.format(
"%s with %s failed, exit code %s",
archive_compress,
output_name,
compress_status and compress_status.code or compress_err
),
"error"
)
end
end
end,
}

View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -0,0 +1,334 @@
# augment-command.yazi
A [Yazi](https://github.com/sxyazi/yazi)
plugin that enhances Yazi's default commands.
This plugin is inspired by the
[Yazi tips page](https://yazi-rs.github.io/docs/tips),
the [bypass.yazi](https://github.com/Rolv-Apneseth/bypass.yazi) plugin
and the [fast-enter.yazi](https://github.com/ourongxing/fast-enter.yazi) plugin.
## Table of Contents
- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [What about the commands are augmented?](#what-about-the-commands-are-augmented)
- [Augmented commands](#augmented-commands)
- [New commands](#new-commands)
- [Usage](#usage)
- [Windows support?](#windows-support)
- [Licence](#licence)
## Requirements
- [Yazi](https://github.com/sxyazi/yazi) v0.2.4+
- [Unarchiver (unar)](https://theunarchiver.com/command-line)
- [ls](https://www.gnu.org/software/coreutils/manual/html_node/ls-invocation.html#ls-invocation)
- Linux or macOS
## Installation
### Yazi v0.2.5 and before (manual installation)
```sh
git clone https://github.com/hankertrix/augment-command.yazi ~/.config/yazi/plugins/augment-command.yazi
```
### Yazi nightly (latest Git commit) (package manager)
```sh
# Add the plugin
ya pack -a hankertrix/augment-command
# Install plugin
ya pack -i
# Update plugin
ya pack -u
```
## Configuration
| Configuration | Values | Default | Description |
| ----------------------------------- | -------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `prompt` | `true` or `false` | `false` | Create a prompt to choose between hovered and selected items when both exist. If this option is disabled, selected items will only be operated on when the hovered item is selected, otherwise the hovered item will be the default item that is operated on. |
| `default_item_group_for_prompt` | `hovered`, `selected` or `none` | `hovered` | The default item group to operate on when the prompt is submitted without any value. `hovered` means the hovered item is operated on, `selected` means the selected items are operated on, and `none` just cancels the operation. |
| `smart_enter` | `true` or `false` | `true` | Use one command to open files or enter a directory. With this option set, the `enter` and `open` commands will both call the `enter` command when a directory is hovered and call the `open` command when a regular file is hovered. |
| `smart_paste` | `true` or `false` | `false` | Paste items into a directory without entering it. The behaviour is exactly the same as the [smart-paste tip on Yazi's documentation](https://yazi-rs.github.io/docs/tips#smart-paste). Setting this option to `false` will use the default `paste` behaviour. You can also enable smart pasting by passing the `--smart` flag to the paste command. |
| `enter_archives` | `true` or `false` | `true` | Automatically extract and enter archive files. This option requires [Unarchiver (unar)](https://theunarchiver.com/command-line) to be installed. |
| `extract_behaviour` | `overwrite`, `rename`, or `skip` | `skip` | Determines how unar deals with existing files when extracting an archive. `overwrite` results in unar overwriting existing files when extracting. `rename` results in unar renaming the new files with the same name as existing files. `skip` results in unar skipping files that have the same name as existing files. Use the `man unar` command for more information. |
| `must_have_hovered_item` | `true` or `false` | `true` | This option stops the plugin from executing any commands when there is no hovered item. |
| `skip_single_subdirectory_on_enter` | `true` or `false` | `true` | Skip directories when there is only one subdirectory and no other files when entering directories. This behaviour can be turned off by passing the `--no-skip` flag to the `enter` or `open` commands. |
| `skip_single_subdirectory_on_leave` | `true` or `false` | `true` | Skip directories when there is only one subdirectory and no other files when leaving directories. This behaviour can be turned off by passing the `--no-skip` flag to the `leave` command. |
| `ignore_hidden_items` | `true` or `false` | `false` | Ignore hidden items when determining whether a directory only has one subdirectory and no other items. Setting this option to `false` will mean that hidden items in a directory will stop the plugin from skipping the single subdirectory. |
| `wraparound_file_navigation` | `true` or `false` | `false` | Wrap around from the bottom to the top or from the top to the bottom when using the `arrow` command to navigate. |
To configure this plugin, add the code below to your `~/.config/yazi/init.lua` file:
```lua
-- ~/.config/yazi/init.lua
-- Using the default configuration
require("augment-command"):setup({
prompt = false,
default_item_group_for_prompt = "hovered",
smart_enter = true,
smart_paste = false,
enter_archives = true,
extract_behaviour = "skip",
must_have_hovered_item = true,
skip_single_subdirectory_on_enter = true,
skip_single_subdirectory_on_leave = true,
ignore_hidden_items = false,
wraparound_file_navigation = false,
})
```
Note that you don't have to do this if you want to use the default configuration.
You also can leave out configuration options that you would like to be left as default,
for example:
```lua
-- ~/.config/yazi/init.lua
-- Custom configuration
require("augment-command"):setup({
prompt = true,
default_item_group_for_prompt = "none",
extract_behaviour = "overwrite",
ignore_hidden_items = true,
wraparound_file_navigation = true,
})
```
## What about the commands are augmented?
All commands that can operate on multiple files and directories,
like `open`, `rename` and `remove`,
as well as the new commands `editor` and `pager`,
now determine an item group to operate on.
By default, the command will operate on the hovered item,
unless the hovered item is also selected,
then it will operate on the selected items.
- When `must_have_hovered_item` is set to `true`,
having no hovered item means the plugin will cancel the operation.
- When `must_have_hovered_item` is set to `false` and
there are selected items, the selected items will be operated on.
- With `prompt` is set to `true`,
the plugin will always prompt you to
choose an item group when there are
both selected items and a hovered item.
## Augmented commands
### Open (`open`)
- When `smart_enter` is set to `true`,
calls the `enter` command when the hovered item is a directory.
- `--no-skip` flag, which only applies
when `smart_enter` is used as it is passed to the `enter` command.
More details about this flag can be found at the documentation
for the [enter command](#enter-enter).
- Automatically extracts and enters archive files,
with support for skipping directories
that contain only one subdirectory in the extracted archive.
This can be disabled by setting `enter_archives` to `false` in the configuration.
This feature requires
[unarchiver (unar)](https://theunarchiver.com/command-line)
to be installed as well as the
[ls](https://www.gnu.org/software/coreutils/manual/html_node/ls-invocation.html#ls-invocation) command.
### Enter (`enter`)
- When `smart_enter` is set to `true`,
calls the `open` command when the hovered item is a file.
- Automatically skips directories that
contain only one subdirectory when entering directories.
This can be turned off by setting
`skip_single_subdirectory_on_enter` to `false` in the configuration.
This feature requires the
[ls](https://www.gnu.org/software/coreutils/manual/html_node/ls-invocation.html#ls-invocation) command.
- `--no-skip` flag. It stops the plugin from skipping directories
that contain only one subdirectory when entering directories,
even when `skip_single_subdirectory_on_enter` is set to `true`.
This allows you to set a key to navigate into directories
without skipping the directories that contain only one subdirectory.
### Leave (`leave`)
- Automatically skips directories that
contain only one subdirectory when leaving directories.
This can be turned off by
setting `skip_single_subdirectory_on_leave` to `false`
in the configuration.
This feature requires the
[ls](https://www.gnu.org/software/coreutils/manual/html_node/ls-invocation.html#ls-invocation) command.
- `--no-skip` flag. It stops the plugin
from skipping directories that contain only one subdirectory,
even when `skip_single_subdirectory_on_leave` is set to `true`.
This allows you to set a key to navigate into directories
without skipping the directories that contain only one subdirectory.
### Rename (`rename`)
- Unfortunately, to use the augmented `rename` command,
you need to use the latest Git version of Yazi as
[this commit](https://github.com/sxyazi/yazi/commit/9961251248c74202d8310085102d5809c279757c)
adds the necessary `--hovered` flag.
- If you don't use the latest Git version of Yazi,
it just behaves like the provided `rename` command
and the prompts don't do anything.
### Remove (`remove`)
- Unfortunately, to use the augmented `remove` command,
you need to use the latest Git version of Yazi as
[this commit](https://github.com/sxyazi/yazi/commit/9961251248c74202d8310085102d5809c279757c)
adds the necessary `--hovered` flag.
- If you don't use the latest Git version of Yazi,
it just behaves like the provided `remove` command
and the prompts don't do anything.
### Paste (`paste`)
- When `smart_paste` is set to `true`,
the `paste` command will paste items
into a hovered directory without entering it.
If the hovered item is not a directory,
the command pastes in the current directory instead.
- `--smart` flag to enable pasting in a hovered directory
without entering the directory.
This flag will cause the `paste` command to paste items
into a hovered directory even when `smart_paste` is set to `false`.
This allows you to set a key to use smart paste
instead of using smart paste for every paste command.
### Arrow (`arrow`)
- When `wraparound_file_navigation` is set to `true`,
the arrow command will wrap around from the bottom to the top or
from the top to the bottom when navigating.
Otherwise, it'll behave like the default `arrow` command.
## New commands
### Parent-arrow (`parent-arrow`)
- This command behaves like the `arrow` command,
but in the parent directory.
It allows you to navigate the parent directory
without leaving the current directory.
- When `wraparound_file_navigation` is set to `true`,
this command will also wrap around from the bottom to the top or
from top to the bottom when navigating in the parent directory.
For this feature to work, you will need the
[ls](https://www.gnu.org/software/coreutils/manual/html_node/ls-invocation.html#ls-invocation) command.
You will also need to have your directories
sorted first for this feature to work,
i.e. in your `~/.config/yazi/yazi.toml` file:
```toml
# ~/.config/yazi/yazi.toml
[manager]
sort_dir_first = true
```
- You can also replicate this using this series of commands below,
but it doesn't work as well,
and doesn't support wraparound navigation:
```toml
# ~/.config/yazi/keymap.toml
# Use K to move up in the parent directory
[[manager.prepend_keymap]]
on = [ "K" ]
run = [ "leave", "arrow -1", "enter" ]
desc = "Move up in the parent directory"
# Use J to move down in the parent directory
[[manager.prepend_keymap]]
on = [ "J" ]
run = [ "leave", "arrow 1", "enter" ]
desc = "Move down in the parent directory"
```
### Editor (`editor`)
- This command opens the default editor set by the `$EDITOR` environment variable.
### Pager (`pager`)
- This command opens the default pager set by the `$PAGER` environment variable.
## Usage
Add the commands that you would like to use to your `keymap.toml` file,
located at `~/.config/yazi/keymap.toml`,
in this format:
```toml
# ~/.config/yazi/keymap.toml
[[manager.prepend_keymap]]
on = [ "key" ]
run = "plugin augment-command --args='command arguments --flags --options=42'"
desc = "Description"
```
For example, to use the augmented `enter` command:
```toml
# ~/.config/yazi/keymap.toml
[[manager.prepend_keymap]]
on = [ "l" ]
run = "plugin augment-command --args='enter'"
desc = "Enter a directory and skip directories with only a single subdirectory"
```
All the default arguments, flags and options provided by Yazi are also supported, for example:
```toml
# ~/.config/yazi/keymap.toml
[[manager.prepend_keymap]]
on = [ "k" ]
run = "plugin augment-command --args='arrow -1'"
desc = "Move cursor up"
[[manager.prepend_keymap]]
on = [ "r" ]
run = "plugin augment-command --args='rename --cursor=before_ext'"
desc = "Rename a file or directory"
[[manager.prepend_keymap]]
on = [ "D" ]
run = "plugin augment-command --args='remove --permanently'"
desc = "Permanently delete the files"
```
For the default descriptions of the commands,
you can refer to
[Yazi's `keymap.toml` file](https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/keymap.toml).
Essentially, all you need to do to use this plugin
is to wrap a Yazi command in single quotes,
like `'enter'`,
then add `plugin augment-command --args=`
in front of it, which results in
`plugin augment-command --args='enter'`.
### Full configuration example
For a full configuration example,
you can take a look at
[my `keymap.toml` file](https://github.com/hankertrix/Dotfiles/blob/master/.config/yazi/keymap.toml).
## Windows support?
Pull requests for Windows support are welcome!
## Licence
This plugin is licenced under the GNU GPL v3 licence.
You can view the full licence in the `LICENSE` file.

View File

@ -0,0 +1,993 @@
-- Plugin to make some Yazi commands smarter
-- Written in Lua 5.4
-- The enum for which group of items to operate on
local ItemGroup = {
Hovered = "hovered",
Selected = "selected",
None = "none",
Prompt = "prompt",
}
-- The enum for the archive extraction behaviour
local ExtractBehaviour = {
Overwrite = "overwrite",
Rename = "rename",
Skip = "skip",
}
-- The enum for the flags for the archive extraction behaviour
local ExtractBehaviourFlags = {
[ExtractBehaviour.Overwrite] = "-f",
[ExtractBehaviour.Rename] = "-r",
[ExtractBehaviour.Skip] = "-s",
}
-- The enum for the supported commands
local Commands = {
Open = "open",
Enter = "enter",
Leave = "leave",
Rename = "rename",
Remove = "remove",
Paste = "paste",
Arrow = "arrow",
ParentArrow = "parent-arrow",
Editor = "editor",
Pager = "pager",
}
-- The default configuration for the plugin
local DEFAULT_CONFIG = {
prompt = false,
default_item_group_for_prompt = ItemGroup.Hovered,
smart_enter = true,
smart_paste = false,
enter_archives = true,
extract_behaviour = ExtractBehaviour.Skip,
must_have_hovered_item = true,
skip_single_subdirectory_on_enter = true,
skip_single_subdirectory_on_leave = true,
ignore_hidden_items = false,
wraparound_file_navigation = false,
}
-- The default notification options for this plugin
local DEFAULT_NOTIFICATION_OPTIONS = {
title = "Augment Command Plugin",
timeout = 5.0
}
-- The default input options for this plugin
local DEFAULT_INPUT_OPTIONS = {
position = { "top-center", y = 2, w = 50 }
}
-- The table of input options for the prompt
local INPUT_OPTIONS_TABLE = {
[ItemGroup.Hovered] = "(H/s)",
[ItemGroup.Selected] = "(h/S)",
[ItemGroup.None] = "(h/s)",
}
-- The list of archive mime types
local ARCHIVE_MIME_TYPES = {
"application/zip",
"application/gzip",
"application/x-tar",
"application/x-bzip",
"application/x-bzip2",
"application/x-7z-compressed",
"application/x-rar",
"application/x-xz",
}
-- The pattern to get the double dash from the front of the argument
local double_dash_pattern = "^%-%-"
-- The pattern to get the parent directory of the current directory
local get_parent_directory_pattern = "(.*)/.*"
-- The pattern to get if a file path is a directory
local is_directory_pattern = "(.*)/$"
-- The pattern to get the filename of a file
local get_filename_pattern = "(.*)%.[^%.]+$"
-- Function to merge tables.
-- The tables given later in the argument list WILL OVERRIDE
-- the tables given earlier in the argument list.
local function merge_tables(...)
-- Initialise a new table
local new_table = {}
-- Iterates over the tables given
for _, table in ipairs({...}) do
-- Iterate over all of the keys and values
for key, value in pairs(table) do
-- Set the key in the new table to the value given
new_table[key] = value
end
end
-- Return the new table
return new_table
end
-- Function to check if a list contains a given value
local function list_contains(list, value)
-- Iterate over all of the items in the list
for _, item in ipairs(list) do
-- If the item is equal to the given value,
-- then return true
if item == value then return true end
end
-- Otherwise, return false if the item isn't in the list
return false
end
-- Function to split a string into a list
local function string_split(given_string, separator)
-- If the separator isn't given, set it to the whitespace character
if separator == nil then
separator = "%s"
end
-- Initialise the list of splitted strings
local splitted_strings = {}
-- Iterate over all of the strings found by pattern
for string in string.gmatch(given_string, "([^" .. separator .. "]+)") do
-- Add the string to the list of splitted strings
table.insert(splitted_strings, string)
end
-- Return the list of splitted strings
return splitted_strings
end
-- Function to parse the arguments given.
-- This function takes the arguments passed to the entry function
local function parse_args(args)
-- The table of options to pass to ya.manager_emit
local options = {}
-- Iterates over the arguments given
for index, 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:match(double_dash_pattern) then
-- Try to convert the argument to a number
local number_argument = tonumber(argument)
-- Add the argument to the list of options
table.insert(
options,
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
options[arg_name] = arg_value
end
-- The label to continue the loop
::continue::
end
-- Return the table of options
return options
end
-- Function to initialise the configuration
local initialise_config = ya.sync(function(state, opts)
-- Merge the default configuration with the given one
-- and set it to the state.
state.config = merge_tables(DEFAULT_CONFIG, opts)
-- Return the configuration object for async functions
return state.config
end)
-- Function to get the configuration from an async function
local get_config = ya.sync(function(state)
-- Returns the configuration object
return state.config
end)
-- Function to get the current working directory
local get_current_directory = ya.sync(function(_)
return tostring(cx.active.current.cwd)
end)
-- Function to get the parent working directory
local get_parent_directory = ya.sync(function(_)
-- Get the parent directory
local parent_directory = cx.active.parent
-- If the parent directory doesn't exist,
-- return nil
if not parent_directory then return nil end
-- Otherwise, return the path of the parent directory
return tostring(parent_directory.cwd)
end)
-- Function to get the hovered item path
local get_hovered_item_path = ya.sync(function(_)
-- Get the hovered item
local hovered_item = cx.active.current.hovered
-- If the hovered item exists
if hovered_item then
-- Return the path of the hovered item
return tostring(cx.active.current.hovered.url)
-- Otherwise, return nil
else return nil end
end)
-- Function to get if the hovered item is a directory
local hovered_item_is_dir = ya.sync(function(_)
-- Get the hovered item
local hovered_item = cx.active.current.hovered
-- Return if the hovered item exists and is a directory
return hovered_item and hovered_item.cha.is_dir
end)
-- Function to get if the hovered item is an archive
local hovered_item_is_archive = ya.sync(function(_)
-- Get the hovered item
local hovered_item = cx.active.current.hovered
-- Return if the hovered item exists and is an archive
return hovered_item and list_contains(
ARCHIVE_MIME_TYPES, hovered_item:mime()
)
end)
-- Function to choose which group of items to operate on.
-- It returns ItemGroup.Hovered for the hovered item,
-- ItemGroup.Selected for the selected items,
-- and ItemGroup.Prompt to tell the calling function
-- to prompt the user.
local get_item_group_from_state = ya.sync(function(state)
-- Get the hovered item
local hovered_item = cx.active.current.hovered
-- The boolean representing that there are no selected items
local no_selected_items = #cx.active.selected == 0
-- If there is no hovered item
if not hovered_item then
-- If there are no selected items, exit the function
if no_selected_items then return
-- Otherwise, if the configuration is set to have a hovered item,
-- exit the function
elseif state.config.must_have_hovered_item then return
-- Otherwise, return the enum for the selected items
else return ItemGroup.Selected end
-- Otherwise, there is a hovered item
-- and if there are no selected items,
-- return the enum for the hovered item.
elseif no_selected_items then return ItemGroup.Hovered
-- Otherwise if there are selected items and the user wants a prompt,
-- then tells the calling function to prompt them
elseif state.config.prompt then
return ItemGroup.Prompt
-- Otherwise, if the hovered item is selected,
-- then return the enum for the selected items
elseif hovered_item:is_selected() then return ItemGroup.Selected
-- Otherwise, return the enum for the hovered item
else return ItemGroup.Hovered end
end)
-- Function to prompt the user for their desired item group
local function prompt_for_desired_item_group()
-- Get the configuration
local config = get_config()
-- Get the default item group
local default_item_group = config.default_item_group_for_prompt
-- Get the input options
local input_options = INPUT_OPTIONS_TABLE[default_item_group]
-- If the default item group is None, then set it to nil
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
}))
-- Lowercase the user's input
user_input = user_input:lower()
-- If the user did not confirm the input, exit the function
if event ~= 1 then return
-- Otherwise, if the user's input starts with "h",
-- return the item group representing the hovered item
elseif user_input:find("^h") then return ItemGroup.Hovered
-- Otherwise, if the user's input starts with "s",
-- return the item group representing the selected items
elseif user_input:find("^s") then return ItemGroup.Selected
-- Otherwise, return the default item group
else return default_item_group end
end
-- Function to get the item group
local function get_item_group()
-- Get the item group from the state
local item_group = get_item_group_from_state()
-- If the item group isn't the prompt one,
-- then return the item group immediately
if item_group ~= ItemGroup.Prompt then return item_group
-- Otherwise, prompt the user for the desired item group
else return prompt_for_desired_item_group() end
end
-- The ls command to get the items in the directory
local function ls_command(directory, ignore_hidden_items)
return Command("ls")
:args({
directory,
ignore_hidden_items and "-1p" or "-1pA",
"--group-directories-first",
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:output()
end
-- Function to skip child directories with only one directory
local function skip_single_child_directories(args, config, initial_directory)
-- If the user doesn't want to skip single subdirectories on enter,
-- or one of the arguments passed is no skip,
-- then exit the function
if not config.skip_single_subdirectory_on_enter or args.no_skip then
return
end
-- Initialise the directory variable to the initial directory given
local directory = initial_directory
-- Start an infinite loop
while true do
-- Run the ls command to get the items in the directory
local output, _ = ls_command(directory, config.ignore_hidden_items)
-- If there is no output, then break out of the loop
if not output then break end
-- Get the list of items in the directory
local directory_items = string_split(output.stdout, "\n")
-- If the number of directory items is not 1,
-- then break out of the loop
if #directory_items ~= 1 then break end
-- Otherwise, get the item in the directory
local directory_item = table.unpack(directory_items)
-- Match the directory item against the pattern to
-- check if it is a directory
directory_item = directory_item:match(is_directory_pattern)
-- If the directory item isn't a directory, break the loop
if directory_item == nil then break end
-- Otherwise, set the directory to the inner directory
directory = directory .. "/" .. directory_item
end
-- Emit the change directory command to change to the directory variable
ya.manager_emit("cd", { directory })
end
-- Function to handle the open command
local function handle_open(args, config, command_table)
-- Call the function to get the item group
local item_group = get_item_group()
-- If no item group is returned, exit the function
if not item_group then return end
-- If the item group is the selected items,
-- then execute the command and exit the function
if item_group == ItemGroup.Selected then
-- Emit the command and exit the function
return ya.manager_emit("open", args)
end
-- Otherwise, the item group is the hovered item.
-- Get the function to handle the enter command.
local enter_command = command_table[Commands.Enter]
-- If the hovered item is a directory
if hovered_item_is_dir() then
-- If smart enter is wanted,
-- calls the function to enter the directory
-- and exit the function
if config.smart_enter then
return enter_command(args, config, command_table)
-- Otherwise, just exit the function
else return end
end
-- Otherwise, if the hovered item is not an archive,
-- or entering archives isn't wanted
if not hovered_item_is_archive() or not config.enter_archives then
-- Simply emit the open command and exit the function
return ya.manager_emit("open", args)
end
-- Otherwise, the hovered item is an archive
-- and entering archives is wanted,
-- so get the path of the hovered item
local archive_path = get_hovered_item_path()
-- If the archive path somehow doesn't exist, then exit the function
if not archive_path then return end
-- Run the command to extract the archive
local output, err = Command("unar")
:args({
"-d",
ExtractBehaviourFlags[config.extract_behaviour],
archive_path
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:output()
-- If the command isn't successful, notify the user
if not output then
return ya.notify(merge_tables(DEFAULT_NOTIFICATION_OPTIONS, {
content = "Failed to extract archive at: "
.. archive_path
.. "\nError code: "
.. tostring(err),
level = "error"
}))
end
-- Get the filename of the archive
local archive_filename = archive_path:match(get_filename_pattern)
-- Enter the archive directory
ya.manager_emit("cd", { archive_filename })
-- Calls the function to skip child directories
-- with only a single directory inside
skip_single_child_directories(args, config, archive_filename)
end
-- Function to handle the enter command
local function handle_enter(args, config, command_table)
-- Get the function for the open command
local open_command = command_table[Commands.Open]
-- If the hovered item is not a directory
if not hovered_item_is_dir() and config.smart_enter then
-- If smart enter is wanted,
-- call the function for the open command
-- and exit the function
if config.smart_enter then
return open_command(args, config, command_table)
-- Otherwise, just exit the function
else return end
end
-- Otherwise, always emit the enter command,
ya.manager_emit("enter", args)
-- Calls the function to skip child directories
-- with only a single directory inside
skip_single_child_directories(args, config, get_current_directory())
end
-- Function to handle the leave command
local function handle_leave(args, config)
-- Always emit the leave command
ya.manager_emit("leave", args)
-- If the user doesn't want to skip single subdirectories on leave,
-- or one of the arguments passed is no skip,
-- then exit the function
if not config.skip_single_subdirectory_on_leave or args.no_skip then
return
end
-- Otherwise, initialise the directory to the current directory
local directory = get_current_directory()
-- Otherwise, start an infinite loop
while true do
-- Run the ls command to get the items in the directory
local output, _ = ls_command(directory, config.ignore_hidden_items)
-- If there is no output, then break out of the loop
if not output then break end
-- Get the list of items in the directory
local directory_items = string_split(output.stdout, "\n")
-- If the number of directory items is not 1,
-- then break out of the loop
if #directory_items ~= 1 then break end
-- Otherwise, set the new directory
-- to the parent of the current directory
directory = directory:match(get_parent_directory_pattern)
end
-- Emit the change directory command to change to the directory variable
ya.manager_emit("cd", { directory })
end
-- Function to handle the a command
local function handle_command(command, args)
-- Call the function to get the item group
local item_group = get_item_group()
-- If no item group is returned, exit the function
if not item_group then return end
-- If the item group is the selected items
if item_group == ItemGroup.Selected then
-- Emit the command to operate on the selected items
ya.manager_emit(command, args)
-- If the item group is the hovered item
elseif item_group == ItemGroup.Hovered then
-- Emit the command with the hovered option
ya.manager_emit(command, merge_tables(args, { hovered = true }))
-- Otherwise, exit the function
else return end
end
-- Function to handle a shell command
local function handle_shell_command(command, args)
-- Call the function to get the item group
local item_group = get_item_group()
-- If no item group is returned, exit the function
if not item_group then return end
-- If the item group is the selected items
if item_group == ItemGroup.Selected then
-- Merge the arguments for the shell command with additional ones
args = merge_tables({
command .. " $@",
confirm = true,
block = true,
}, args)
-- Emit the command to operate the selected items
ya.manager_emit("shell", args)
-- If the item group is the hovered item
elseif item_group == ItemGroup.Hovered then
-- Merge the arguments for the shell command with additional ones
args = merge_tables({
command .. " $0",
confirm = true,
block = true,
}, args)
-- Emit the command to operate on the hovered item
ya.manager_emit("shell", args)
-- Otherwise, exit the function
else return end
end
-- Function to handle the paste command
local function handle_paste(args, config)
-- If the hovered item is a directory and smart paste is wanted
if hovered_item_is_dir() and (config.smart_paste or args.smart) then
-- Enter the directory
ya.manager_emit("enter", {})
-- Paste the items inside the directory
ya.manager_emit("paste", args)
-- Leave the directory
ya.manager_emit("leave", {})
-- Otherwise, just paste the items inside the current directory
else
ya.manager_emit("paste", args)
end
end
-- Function to do the wraparound for the arrow command
local wraparound_arrow = ya.sync(function(_, args)
-- Get the current tab
local current_tab = cx.active.current
-- Get the step from the arguments given
local step = table.remove(args, 1)
-- Get the number of files in the current tab
local number_of_files = #current_tab.files
-- If there are no files in the current tab, exit the function
if number_of_files == 0 then return end
-- Get the new cursor index,
-- which is the current cursor position plus the step given
-- to the arrow function, modulus the number of files in
-- the current tab
local new_cursor_index = (current_tab.cursor + step) % number_of_files
-- Emit the arrow function with the new cursor index minus
-- the current cursor index to determine how to move the cursor
ya.manager_emit("arrow", merge_tables(
args,
{ new_cursor_index - current_tab.cursor }
))
end)
-- Function to handle the arrow command
local function handle_arrow(args, config)
-- If wraparound file navigation isn't wanted,
-- then execute the arrow command
if not config.wraparound_file_navigation then
ya.manager_emit("arrow", args)
-- Otherwise, call the wraparound arrow function
else wraparound_arrow(args) end
end
-- Function to execute the parent arrow command
local execute_parent_arrow_command = ya.sync(
function(state, args, number_of_directories)
-- Gets the parent directory
local parent_directory = cx.active.parent
-- If the parent directory doesn't exist,
-- then exit the function
if not parent_directory then return end
-- Get the step from the arguments given
local step = table.remove(args, 1)
-- Initialise the new cursor index
-- to the current parent cursor index
local new_cursor_index = parent_directory.cursor
-- Otherwise, if wraparound file navigation is wanted
-- and the number of directories is given and isn't 0
if
state.config.wraparound_file_navigation
and number_of_directories
and number_of_directories ~= 0
then
-- Get the new cursor index by adding the step,
-- and modding the whole thing by the number of
-- directories given.
new_cursor_index = (parent_directory.cursor + step)
% number_of_directories
else
-- Otherwise, get the new cursor index normally.
new_cursor_index = parent_directory.cursor + step
end
-- Increment the cursor index by 1.
-- The cursor index needs to be increased by 1
-- as the cursor index is 0-based, while Lua
-- tables are 1-based.
new_cursor_index = new_cursor_index + 1
-- Get the target directory
local target_directory = parent_directory.files[new_cursor_index]
-- If the target directory exists and is a directory
if target_directory and target_directory.cha.is_dir then
-- Emit the command to change directory
-- to the target directory
ya.manager_emit("cd", { target_directory.url })
end
end
)
-- Function to handle the parent arrow command
local function handle_parent_arrow(args, config)
-- If wraparound file navigation isn't wanted,
-- then execute the parent arrow command and exit the function
if not config.wraparound_file_navigation then
return execute_parent_arrow_command(args)
end
-- Otherwise, get the path of the parent directory
local parent_directory_path = get_parent_directory()
-- If there is no parent directory, exit the function
if not parent_directory_path then return end
-- Call the ls command to get the number of directories
local output, _ = ls_command(
parent_directory_path,
config.ignore_hidden_items
)
-- If there is no output, exit the function
if not output then return end
-- Get the item in the parent directory
local directory_items = string_split(output.stdout, "\n")
-- Initialise the number of directories
local number_of_directories = 0
-- Iterate over the directory items
for _, item in ipairs(directory_items) do
-- If the item is a directory
if item:match(is_directory_pattern) then
-- Increment the number of directories by 1
number_of_directories = number_of_directories + 1
-- Otherwise, break out of the loop,
-- as the directories are grouped together
else break end
end
-- Call the function to execute the parent arrow command
execute_parent_arrow_command(args, number_of_directories)
end
-- Function to handle the pager command
local function handle_pager(args)
-- Call the function to get the item group
local item_group = get_item_group()
-- If no item group is returned, exit the function
if not item_group then return end
-- If the item group is the selected items,
-- then execute the command and exit the function
if item_group == ItemGroup.Selected then
-- Combine the arguments with additional ones
args = merge_tables({
"$PAGER $@",
confirm = true,
block = true
}, args)
-- Emit the command and exit the function
return ya.manager_emit("shell", args)
end
-- Otherwise, the item group is the hovered item,
-- and if the hovered item is a directory, exit the function
if hovered_item_is_dir() then return
-- Otherwise
else
-- Combine the arguments with additional ones
args = merge_tables({
"$PAGER $0",
confirm = true,
block = true
}, args)
-- Emit the command and exit the function
return ya.manager_emit("shell", args)
end
end
-- Function to run the commands given
local function run_command_func(command, args, config)
-- The command table
local command_table = {
[Commands.Open] = handle_open,
[Commands.Enter] = handle_enter,
[Commands.Leave] = handle_leave,
[Commands.Rename] = function(_)
handle_command("rename", args)
end,
[Commands.Remove] = function(_)
handle_command("remove", args)
end,
[Commands.Paste] = handle_paste,
[Commands.Arrow] = handle_arrow,
[Commands.ParentArrow] = handle_parent_arrow,
[Commands.Editor] = function(_)
handle_shell_command("$EDITOR", args)
end,
[Commands.Pager] = handle_pager,
}
-- Get the function for the command
local command_func = command_table[command]
-- 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"
})
)
end
-- Parse the arguments and set it to the args variable
args = parse_args(args)
-- Otherwise, call the function for the command
command_func(args, config, command_table)
end
-- The setup function to setup the plugin
local function setup(_, opts)
-- Initialise the configuration with the default configuration
initialise_config(opts)
end
-- The function to be called to use the plugin
local function entry(_, args)
-- Gets the command passed to the plugin
local command = args[1]
-- If the command isn't given, exit the function
if not command then return end
-- Gets the configuration object
local config = get_config()
-- If the configuration hasn't been initialised,
-- then initialise the configuration
if not config then
config = initialise_config()
end
-- Call the function to handle the commands
run_command_func(command, args, config)
end
-- Returns the table required for Yazi to run the plugin
return {
setup = setup,
entry = entry,
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 yazi-rs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,24 @@
# chmod.yazi
Execute `chmod` on the selected files to change their mode. This plugin is only available on Unix platforms since it relies on [`chmod(2)`](https://man7.org/linux/man-pages/man2/chmod.2.html).
https://github.com/yazi-rs/plugins/assets/17523360/7aa3abc2-d057-498c-8473-a6282c59c464
## Installation
```sh
ya pack -a yazi-rs/plugins#chmod
```
## Usage
Add this to your `~/.config/yazi/keymap.toml`:
```toml
[[manager.prepend_keymap]]
on = [ "c", "m" ]
run = "plugin chmod"
desc = "Chmod on selected files"
```
Make sure the <kbd>c</kbd> => <kbd>m</kbd> key is not used elsewhere.

View File

@ -0,0 +1,39 @@
local selected_or_hovered = ya.sync(function()
local tab, paths = cx.active, {}
for _, u in pairs(tab.selected) do
paths[#paths + 1] = tostring(u)
end
if #paths == 0 and tab.current.hovered then
paths[1] = tostring(tab.current.hovered.url)
end
return paths
end)
return {
entry = function()
ya.manager_emit("escape", { visual = true })
local urls = selected_or_hovered()
if #urls == 0 then
return ya.notify { title = "Chmod", content = "No file selected", level = "warn", timeout = 5 }
end
local value, event = ya.input {
title = "Chmod:",
position = { "top-center", y = 3, w = 40 },
}
if event ~= 1 then
return
end
local status, err = Command("chmod"):arg(value):args(urls):spawn():wait()
if not status or not status.success then
ya.notify {
title = "Chmod",
content = string.format("Chmod with selected files failed, exit code %s", status and status.code or err),
level = "error",
timeout = 5,
}
end
end,
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Sonico98
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,32 @@
# exifaudio.yazi
Preview audio metadata and cover on [Yazi](https://github.com/sxyazi/yazi).
![image](https://github.com/Sonico98/exifaudio.yazi/assets/61394886/53c1492c-9f05-4c80-a4e7-94fb36f35ca9)
## Installation
```sh
# Linux/macOS
git clone https://github.com/Sonico98/exifaudio.yazi.git ~/.config/yazi/plugins/exifaudio.yazi
# Windows
git clone https://github.com/Sonico98/exifaudio.yazi.git %AppData%\yazi\config\plugins\exifaudio.yazi
```
## Usage
Add the following to your `yazi.toml`:
```toml
[plugin]
prepend_previewers = [
{ mime = "audio/*", run = "exifaudio"}
]
```
Make sure you have [exiftool](https://exiftool.org/) installed and in your `PATH`.
## Thanks
Thanks to [sxyazi](https://github.com/sxyazi) for the PDF previewer code, on which this previewer is based on.

View File

@ -0,0 +1,139 @@
local M = {}
function M:peek()
local cache = ya.file_cache(self)
if not cache then
return
end
local child = Command("exiftool")
:args({
"-q", "-q", "-S", "-Title", "-SortName",
"-TitleSort", "-TitleSortOrder", "-Artist",
"-SortArtist", "-ArtistSort", "-PerformerSortOrder",
"-Album", "-SortAlbum", "-AlbumSort", "-AlbumSortOrder",
"-AlbumArtist", "-SortAlbumArtist", "-AlbumArtistSort",
"-AlbumArtistSortOrder", "-Genre", "-TrackNumber",
"-Year", "-Duration", "-SampleRate",
"-AudioSampleRate", "-AudioBitrate", "-AvgBitrate",
"-Channels", "-AudioChannels", tostring(self.file.url),
})
:stdout(Command.PIPED)
:stderr(Command.NULL)
:spawn()
local limit = self.area.h
local i, metadata = 0, {}
repeat
local next, event = child:read_line()
if event == 1 then
return self:fallback_to_builtin()
elseif event ~= 0 then
break
end
i = i + 1
if i > self.skip then
local m_title, m_tag = prettify(next)
local ti = ui.Span(m_title):bold()
local ta = ui.Span(m_tag)
table.insert(metadata, ui.Line{ti, ta})
table.insert(metadata, ui.Line{})
end
until i >= self.skip + limit
local p = ui.Paragraph(self.area, metadata):wrap(ui.Paragraph.WRAP)
ya.preview_widgets(self, { p })
local cover_width = self.area.w / 2 - 5
local cover_height = (self.area.h / 4) + 3
local bottom_right = ui.Rect {
x = self.area.right - cover_width,
y = self.area.bottom - cover_height,
w = cover_width,
h = cover_height,
}
if self:preload() == 1 then
ya.image_show(cache, bottom_right)
end
end
function prettify(metadata)
local substitutions = {
Sortname = "Sort Title:",
SortName = "Sort Title:",
TitleSort = "Sort Title:",
TitleSortOrder = "Sort Title:",
ArtistSort = "Sort Artist:",
SortArtist = "Sort Artist:",
Artist = "Artist:",
ARTIST = "Artist:",
PerformerSortOrder = "Sort Artist:",
SortAlbumArtist = "Sort Album Artist:",
AlbumArtistSortOrder = "Sort Album Artist:",
AlbumArtistSort = "Sort Album Artist:",
AlbumSortOrder = "Sort Album:",
AlbumSort = "Sort Album:",
SortAlbum = "Sort Album:",
Album = "Album:",
ALBUM = "Album:",
AlbumArtist = "Album Artist:",
Genre = "Genre:",
GENRE = "Genre:",
TrackNumber = "Track Number:",
Year = "Year:",
Duration = "Duration:",
AudioBitrate = "Bitrate:",
AvgBitrate = "Average Bitrate:",
AudioSampleRate = "Sample Rate:",
SampleRate = "Sample Rate:",
AudioChannels = "Channels:"
}
for k, v in pairs(substitutions) do
metadata = metadata:gsub(tostring(k)..":", v, 1)
end
-- Separate the tag title from the tag data
local t={}
for str in string.gmatch(metadata , "([^"..":".."]+)") do
table.insert(t, str)
end
-- Add back semicolon to title, rejoin tag data if it happened to contain a semicolon
return t[1]..":", table.concat(t, ":", 2)
end
function M:seek(units)
local h = cx.active.current.hovered
if h and h.url == self.file.url then
ya.manager_emit("peek", {
tostring(math.max(0, cx.active.preview.skip + units)),
only_if = tostring(self.file.url),
})
end
end
function M:preload()
local cache = ya.file_cache(self)
if not cache or fs.cha(cache) then
return 1
end
local output = Command("exiftool")
:args({ "-b", "-CoverArt", "-Picture", tostring(self.file.url) })
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:output()
if not output then
return 0
end
return fs.write(cache, output.stdout) and 1 or 2
end
return M

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 yazi-rs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,22 @@
# full-border.yazi
Add a full border to Yazi to make it look fancier.
![full-border](https://github.com/yazi-rs/plugins/assets/17523360/ef81b560-2465-4d36-abf2-5d21dcb7b987)
## Installation
```sh
ya pack -a yazi-rs/plugins#full-border
```
## Usage
Add this to your `init.lua` to enable the plugin:
```lua
require("full-border"):setup()
```
This plugin overrides the [`Manager.render`](https://github.com/sxyazi/yazi/blob/latest/yazi-plugin/preset/components/manager.lua) method,
you might need to check if any other plugins that also need to override it are enabled.

View File

@ -0,0 +1,38 @@
local function setup()
local old_build = Tab.build
Tab.build = function(self, ...)
local bar = function(c, x, y)
if x <= 0 or x == self._area.w - 1 then
return ui.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) },
ui.Bar.TOP
):symbol(c)
end
local c = self._chunks
self._chunks = {
c[1]:padding(ui.Padding.y(1)),
c[2]:padding(c[1].w > 0 and ui.Padding.y(1) or ui.Padding(1, 0, 1, 1)),
c[3]:padding(ui.Padding.y(1)),
}
local style = THEME.manager.border_style
self._base = ya.list_merge(self._base or {}, {
ui.Border(self._area, ui.Border.ALL):type(ui.Border.ROUNDED):style(style),
ui.Bar(self._chunks[1], ui.Bar.RIGHT):style(style),
ui.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),
bar("", c[2].right, c[2].y),
bar("", c[2].right, c[2].bottom - 1),
})
old_build(self, ...)
end
end
return { setup = setup }

View File

@ -0,0 +1,7 @@
Copyright © 2024 Reledia <reledia@prontonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,18 @@
# glow.yazi
Plugin for [Yazi](https://github.com/sxyazi/yazi) to preview markdown files with [glow](https://github.com/charmbracelet/glow). To install, clone the repo inside your `~/.config/yazi/plugins/`:
```bash
git clone https://github.com/Reledia/glow.yazi.git
```
then include it in your `yazi.toml` to use:
```toml
[plugin]
prepend_previewers = [
{ name = "*.md", run = "glow" },
]
```
Make sure you have [glow](https://github.com/charmbracelet/glow) installed, and can be found in `PATH`.

View File

@ -0,0 +1,66 @@
local M = {}
function M:peek()
local child = Command("glow")
:args({
"--style",
"dark",
"--width",
tostring(self.area.w),
tostring(self.file.url),
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:spawn()
if not child then
return self:fallback_to_builtin()
end
local limit = self.area.h
local i, lines = 0, ""
repeat
local next, event = child:read_line()
if event == 1 then
return self:fallback_to_builtin()
elseif event ~= 0 then
break
end
i = i + 1
if i > self.skip then
lines = lines .. next
end
until i >= self.skip + limit
child:start_kill()
if self.skip > 0 and i < self.skip + limit then
ya.manager_emit(
"peek",
{ tostring(math.max(0, i - limit)), only_if = tostring(self.file.url), upper_bound = "" }
)
else
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
ya.preview_widgets(self, { ui.Paragraph.parse(self.area, lines) })
end
end
function M:seek(units)
local h = cx.active.current.hovered
if h and h.url == self.file.url then
local step = math.floor(units * self.area.h / 10)
ya.manager_emit("peek", {
tostring(math.max(0, cx.active.preview.skip + step)),
only_if = tostring(self.file.url),
})
end
end
function M:fallback_to_builtin()
local _, bound = ya.preview_code(self)
if bound then
ya.manager_emit("peek", { tostring(bound), only_if = tostring(self.file.url), upper_bound = "" })
end
end
return M

View File

@ -0,0 +1,7 @@
Copyright © 2024 Reledia <reledia@prontonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,22 @@
# hexyl.yazi
Preview any file on [Yazi](https://github.com/sxyazi/yazi) using [hexyl](https://github.com/sharkdp/hexyl). To install, clone the repo inside your `~/.config/yazi/plugins/`:
```bash
git clone https://github.com/Reledia/hexyl.yazi.git
```
then include it in your `yazi.toml` to use:
```toml
[plugin]
append_previewers = [
{ name = "*", run = "hexyl" },
]
```
Make sure you have [hexyl](https://github.com/sharkdp/hexyl) installed, and can be found in `PATH`.
## Preview
![preview.png](https://raw.githubusercontent.com/Reledia/hexyl.yazi/main/image.png)

View File

@ -0,0 +1,67 @@
local M = {}
function M:peek()
local child
local l = self.file.cha.length
if l == 0 then
child = Command("hexyl")
:args({
tostring(self.file.url),
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:spawn()
else
child = Command("hexyl")
:args({
"--border",
"none",
"--terminal-width",
tostring(self.area.w),
tostring(self.file.url),
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:spawn()
end
local limit = self.area.h
local i, lines = 0, ""
repeat
local next, event = child:read_line()
if event == 1 then
ya.err(tostring(event))
elseif event ~= 0 then
break
end
i = i + 1
if i > self.skip then
lines = lines .. next
end
until i >= self.skip + limit
child:start_kill()
if self.skip > 0 and i < self.skip + limit then
ya.manager_emit(
"peek",
{ tostring(math.max(0, i - limit)), only_if = tostring(self.file.url), upper_bound = "" }
)
else
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
ya.preview_widgets(self, { ui.Paragraph.parse(self.area, lines) })
end
end
function M:seek(units)
local h = cx.active.current.hovered
if h and h.url == self.file.url then
local step = math.floor(units * self.area.h / 10)
ya.manager_emit("peek", {
tostring(math.max(0, cx.active.preview.skip + step)),
only_if = tostring(self.file.url),
})
end
end
return M

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 yazi-rs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,24 @@
# hide-preview.yazi
Switch the preview pane between hidden and shown.
https://github.com/yazi-rs/plugins/assets/17523360/c4f0b5c4-ff9f-4be8-ba73-4d8e7902e383
## Installation
```sh
ya pack -a yazi-rs/plugins#hide-preview
```
## Usage
Add this to your `~/.config/yazi/keymap.toml`:
```toml
[[manager.prepend_keymap]]
on = "T"
run = "plugin --sync hide-preview"
desc = "Hide or show preview"
```
Make sure the <kbd>T</kbd> key is not used elsewhere.

View File

@ -0,0 +1,21 @@
local function entry(st)
if st.old then
Tab.layout, st.old = st.old, nil
else
st.old = Tab.layout
Tab.layout = function(self)
local all = MANAGER.ratio.parent + MANAGER.ratio.current
self._chunks = ui.Layout()
:direction(ui.Layout.HORIZONTAL)
:constraints({
ui.Constraint.Ratio(MANAGER.ratio.parent, all),
ui.Constraint.Ratio(MANAGER.ratio.current, all),
ui.Constraint.Length(1),
})
:split(self._area)
end
end
ya.app_emit("resize", {})
end
return { entry = entry }

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 yazi-rs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,24 @@
# max-preview.yazi
Maximize or restore the preview pane.
https://github.com/yazi-rs/plugins/assets/17523360/8976308e-ebfe-4e9e-babe-153eb1f87d61
## Installation
```sh
ya pack -a yazi-rs/plugins#max-preview
```
## Usage
Add this to your `~/.config/yazi/keymap.toml`:
```toml
[[manager.prepend_keymap]]
on = "T"
run = "plugin --sync max-preview"
desc = "Maximize or restore preview"
```
Make sure the <kbd>T</kbd> key is not used elsewhere.

View File

@ -0,0 +1,20 @@
local function entry(st)
if st.old then
Tab.layout, st.old = st.old, nil
else
st.old = Tab.layout
Tab.layout = function(self)
self._chunks = ui.Layout()
:direction(ui.Layout.HORIZONTAL)
:constraints({
ui.Constraint.Percentage(0),
ui.Constraint.Percentage(0),
ui.Constraint.Percentage(100),
})
:split(self._area)
end
end
ya.app_emit("resize", {})
end
return { entry = entry }

View File

@ -0,0 +1,7 @@
Copyright © 2024 Reledia <reledia@prontonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,26 @@
# miller.yazi
[Miller](https://github.com/johnkerl/miller) now in [yazi](https://github.com/sxyazi/yazi). To install, clone the repo inside `~/.config/yazi/plugins/`:
```toml
[plugin]
prepend_previewers = [
{ mime = "text/csv", run = "miller"},
]
```
## Preview
![preview](https://github.com/Reledia/miller.yazi/blob/main/preview.png?raw=true)
## Color
To change colors of keys and values, edit the `init.lua` file after the `--key-color` and `--value-color` flags. To view a list of possible colors, use `mlr --list-color-names`. Make sure to have miller installed and inside your PATH.
## Other types of file
To adapt this plugin to the other format supported from miller (like json):
- copy the plugin folder
- change the name of the copied folder into miller_(fmt)
- change the `--icsv` flag inside `init.lua` to `--i(fmt)`
- add the correct mime/name rule into `prepend_previewers` and the exec as `miller_(fmt)`

View File

@ -0,0 +1,59 @@
local M = {}
function M:peek()
local child = Command("mlr")
:args({
"--icsv",
"--opprint",
"-C",
"--key-color",
"darkcyan",
"--value-color",
"grey70",
"cat",
tostring(self.file.url),
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:spawn()
local limit = self.area.h
local i, lines = 0, ""
repeat
local next, event = child:read_line()
if event == 1 then
ya.err(tostring(event))
elseif event ~= 0 then
break
end
i = i + 1
if i > self.skip then
lines = lines .. next
end
until i >= self.skip + limit
child:start_kill()
if self.skip > 0 and i < self.skip + limit then
ya.manager_emit(
"peek",
{ tostring(math.max(0, i - limit)), only_if = tostring(self.file.url), upper_bound = "" }
)
else
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
ya.preview_widgets(self, { ui.Paragraph.parse(self.area, lines) })
end
end
function M:seek(units)
local h = cx.active.current.hovered
if h and h.url == self.file.url then
local step = math.floor(units * self.area.h / 10)
ya.manager_emit("peek", {
tostring(math.max(0, cx.active.preview.skip + step)),
only_if = tostring(self.file.url),
})
end
end
return M

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Anirudh Gupta
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,72 @@
# nbpreview.yazi
View your Jupyter notebooks beautifully in the preview in Yazi.
## Requirements
- [Yazi](https://github.com/sxyazi/yazi) version >=0.2.5
- [nbpreview](https://github.com/paw-lu/nbpreview)
## Previews
<img width="1416" alt="image" src="https://github.com/AnirudhG07/nbpreview.yazi/assets/146579014/87535dc9-c45a-4eb7-a732-4384460b516d">
## Installation
```bash
## For linux and MacOS
git clone https://github.com/AnirudhG07/nbpreview.yazi.git ~/.config/yazi/plugins/nbpreview.yazi
## For Windows
git clone https://github.com/AnirudhG07/nbpreview.yazi.git %AppData%\yazi\config\plugins\nbpreview.yazi
```
## Usage
After installing the plugin, add this to your `yazi.toml` file inside the plugin's section previously present.
```toml
[plugin]
prepend_previewers = [
{ name = "*.ipynb", run = "nbpreview" },
]
```
## Configurations
You can configure your preview by editing the `init.lua` file present in the plugin directory.
<img width="724" alt="image" src="https://github.com/AnirudhG07/nbpreview.yazi/assets/146579014/99405d1f-3de8-4beb-a581-4a41affe8e57">
All the configurations provided using `nbpreview --help`.
By default we have give you some of the flags which you can change according to your needs in the `init.lua` file.
Please DONOT change the below options(unless you know what you are doing) -
- `--nerd-font` - Yazi uses nerd-font.
- \*`--decorated` - This enables the decorations you see in the preview.
- `--no-paging` - To avoid errors.
The `OPTIONAL CHANGES` flags are by default(recommended) given. You can add more or change as you wish.
## CUSTOMIZATION
You can Color customize your previews from the Color schemes and themes provided by `nbpreview`. These are -
```bash
# COLOR SCHEMES
--color-system, --cs [standard|256|truecolor|windows|none|auto]
The type of color system to use. [env var: NBPREVIEW_COLOR_SYSTEM]
# THEMES
-t, --theme [abap|algol|algol_nu|arduino|autumn|bw|borland|coffee|colorful|default|
dracula|emacs|friendly_grayscale|friendly|fruity|github-dark|gruvbox-dark|
gruvbox-light|igor|inkpot|lightbulb|lilypond|lovelace|manni|material|monokai|
murphy|native|nord-darker|nord|one-dark|paraiso-dark|paraiso-light|pastie|
perldoc|rainbow_dash|rrt|sas|solarized-dark|solarized-light|staroffice|stata-dark|
stata-light|tango|trac|vim|vs|xcode|zenburn|light|dark|ansi_light|ansi_dark]
```
You can change the default give color scheme and theme to any you like.
> [!Note]
>
> The loading of `ipynb` might appear slow. This is due to the lag created by the command itself and not because of the plugin or yazi

View File

@ -0,0 +1,77 @@
local M = {}
function M:peek()
width = tonumber(self.area.w)
local child = Command("nbpreview")
:args({
-- DO NOT CHANGE --
"--no-paging",
"--nerd-font",
"--decorated",
-- OPTIONAL CHANGES --
"--no-files",
"--unicode",
"--color",
"--images",
-- SPECIAL CUSTOMIZATIONS --
"--color-system=standard",
"--theme=ansi_dark",
tostring(self.file.url),
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:spawn()
if not child then
return self:fallback_to_builtin()
end
local limit = self.area.h
local i, lines = 0, ""
repeat
local next, event = child:read_line()
if event == 1 then
return self:fallback_to_builtin()
elseif event ~= 0 then
break
end
i = i + 1
if i > self.skip then
lines = lines .. next
end
until i >= self.skip + limit
child:start_kill()
if self.skip > 0 and i < self.skip + limit then
ya.manager_emit(
"peek",
{ tostring(math.max(0, i - limit)), only_if = tostring(self.file.url), upper_bound = "" }
)
else
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
ya.preview_widgets(self, { ui.Paragraph.parse(self.area, lines) })
end
end
function M:seek(units)
local h = cx.active.current.hovered
if h and h.url == self.file.url then
local step = math.floor(units * self.area.h / 10)
ya.manager_emit("peek", {
tostring(math.max(0, cx.active.preview.skip + step)),
only_if = tostring(self.file.url),
})
end
end
function M:fallback_to_builtin()
local _, bound = ya.preview_code(self)
if bound then
ya.manager_emit("peek", { tostring(bound), only_if = tostring(self.file.url), upper_bound = "" })
end
end
return M

View File

@ -0,0 +1,19 @@
Copyright (c) 2024 dedukun
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,167 @@
# relative-motions.yazi
A [Yazi](https://github.com/sxyazi/yazi) plugin based about vim motions.
https://github.com/dedukun/relative-motions.yazi/assets/25795432/04fb186a-5efe-442d-8d7b-2dccb6eee408
## Requirements
- [Yazi](https://github.com/sxyazi/yazi) v0.2.4+
## Installation
<details>
<summary>Yazi v0.2.5 and before (manual installation)</summary>
```sh
# Linux/macOS
git clone https://github.com/dedukun/relative-motions.yazi.git ~/.config/yazi/plugins/relative-motions.yazi
# Windows
git clone https://github.com/dedukun/relative-motions.yazi.git %AppData%\yazi\config\plugins\relative-motions.yazi
```
</details>
<details>
<summary>Latest commit in Yazi (package manager)</summary>
```sh
# Add the plugin
ya pack -a dedukun/relative-motions
# Install plugin
ya pack -i
# Update plugin
ya pack -u
```
</details>
## Configuration
If you want to use the numbers directly to start a motion add this to your `keymap.toml`:
<details>
```toml
[[manager.prepend_keymap]]
on = [ "1" ]
run = "plugin relative-motions --args=1"
desc = "Move in relative steps"
[[manager.prepend_keymap]]
on = [ "2" ]
run = "plugin relative-motions --args=2"
desc = "Move in relative steps"
[[manager.prepend_keymap]]
on = [ "3" ]
run = "plugin relative-motions --args=3"
desc = "Move in relative steps"
[[manager.prepend_keymap]]
on = [ "4" ]
run = "plugin relative-motions --args=4"
desc = "Move in relative steps"
[[manager.prepend_keymap]]
on = [ "5" ]
run = "plugin relative-motions --args=5"
desc = "Move in relative steps"
[[manager.prepend_keymap]]
on = [ "6" ]
run = "plugin relative-motions --args=6"
desc = "Move in relative steps"
[[manager.prepend_keymap]]
on = [ "7" ]
run = "plugin relative-motions --args=7"
desc = "Move in relative steps"
[[manager.prepend_keymap]]
on = [ "8" ]
run = "plugin relative-motions --args=8"
desc = "Move in relative steps"
[[manager.prepend_keymap]]
on = [ "9" ]
run = "plugin relative-motions --args=9"
desc = "Move in relative steps"
```
</details>
Alternatively you can use a key to trigger a new motion without any initial value, for that add the following in `keymap.toml`:
```toml
[[manager.prepend_keymap]]
on = [ "m" ]
run = "plugin relative-motions"
desc = "Trigger a new relative motion"
```
---
Additionally there are a couple of initial configurations that can be given to the plugin's `setup` function:
| Configuration | Values | Default | Description |
| -------------- | ----------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `show_numbers` | `relative`, `absolute`, `relative_absolute` or `none` | `none` | Shows relative or absolute numbers before the file icon |
| `show_motion` | `true` or `false` | `false` | Shows current motion in Status bar |
| `only_motions` | `true` or `false` | `false` | If true, only the motion movements will be enabled, i.e., the commands for delete, cut, yank and visual selection will be disabled |
If you want, for example, to enable relative numbers as well as to show the motion in the status bar,
add the following to Yazi's `init.lua`, i.e. `~/.config/yazi/init.lua`:
```lua
-- ~/.config/yazi/init.lua
require("relative-motions"):setup({ show_numbers="relative", show_motion = true })
```
> [!NOTE]
> The `show_numbers` and `show_motion` functionalities overwrite [`Current:render`](https://github.com/sxyazi/yazi/blob/e51e8ad789914b2ab4a9485da7aa7fbc7b3bb450/yazi-plugin/preset/components/current.lua#L5)
> and [`Status:render`](https://github.com/sxyazi/yazi/blob/e51e8ad789914b2ab4a9485da7aa7fbc7b3bb450/yazi-plugin/preset/components/status.lua#L111) respectively.
> If you have custom implementations for any of this functions
> you can add the provided `File:number` and `Status:motion` to your implementations, just check [here](https://github.com/dedukun/relative-motions.yazi/blob/main/init.lua#L39) how we are doing things.
## Usage
This plugin adds the some basic vim motions like `3k`, `12j`, `10gg`, etc.
The following table show all the available motions:
| Command | Description |
| -------------- | ------------------- |
| `j`/`<Down>` | Move `n` lines down |
| `k`/`<Up>` | Move `n` lines up |
| `gj`/`g<Down>` | Go `n` lines down |
| `gk`/`g<Up>` | Go `n` lines up |
| `gg` | Go to line |
Furthermore, the following operations were also added:
| Command | Description |
| ------- | ------------- |
| `v` | visual select |
| `y` | Yank |
| `x` | Cut |
| `d` | Delete motion |
This however must be followed by a direction, which can be `j`/`<Down>`, `k`/`<Up>` or repeating the command key,
which will operate from the cursor down, e.g. `2yy` will copy two files.
Finally, we also support some tab operations:
| Command | Description |
| ------- | ------------------------------------ |
| `t` | create `n` tabs |
| `H` | Move `n` tabs left |
| `L` | Move `n` tabs right |
| `gt` | Go to the `n` tab |
| `w` | Close tab `n` |
| `W` | Close `n` tabs right |
| `<` | Swap current tab with `n` tabs left |
| `>` | Swap current tab with `n` tabs right |
| `~` | Swap current tab with tab `n` |

View File

@ -0,0 +1,330 @@
-- stylua: ignore
local MOTIONS_AND_OP_KEYS = {
{ on = "0" }, { on = "1" }, { on = "2" }, { on = "3" }, { on = "4" },
{ on = "5" }, { on = "6" }, { on = "7" }, { on = "8" }, { on = "9" },
-- commands
{ on = "d" }, { on = "v" }, { on = "y" }, { on = "x" },
-- tab commands
{ on = "t" }, { on = "L" }, { on = "H" }, { on = "w" },
{ on = "W" }, { on = "<" }, { on = ">" }, { on = "~" },
-- movement
{ on = "g" }, { on = "j" }, { on = "k" }, { on = "<Down>" }, { on = "<Up>" }
}
-- stylua: ignore
local MOTION_KEYS = {
{ on = "0" }, { on = "1" }, { on = "2" }, { on = "3" }, { on = "4" },
{ on = "5" }, { on = "6" }, { on = "7" }, { on = "8" }, { on = "9" },
-- movement
{ on = "g" }, { on = "j" }, { on = "k" }
}
-- stylua: ignore
local DIRECTION_KEYS = {
{ on = "j" }, { on = "k" }, { on = "<Down>" }, { on = "<Up>" },
-- tab movement
{ on = "t" }
}
local SHOW_NUMBERS_ABSOLUTE = 0
local SHOW_NUMBERS_RELATIVE = 1
local SHOW_NUMBERS_RELATIVE_ABSOLUTE = 2
-----------------------------------------------
----------------- R E N D E R -----------------
-----------------------------------------------
local render_motion_setup = ya.sync(function()
ya.render()
Status.motion = function() return ui.Span("") end
Status.render = function(self, area)
self.area = area
local left = ui.Line { self:mode(), self:size(), self:name() }
local right = ui.Line { self:motion(), self:permissions(), self:percentage(), self:position() }
return {
ui.Paragraph(area, { left }),
ui.Paragraph(area, { right }):align(ui.Paragraph.RIGHT),
table.unpack(Progress:render(area, right:width())),
}
end
end)
local render_motion = ya.sync(function(_, motion_num, motion_cmd)
ya.render()
Status.motion = function(self)
if not motion_num then
return ui.Span("")
end
local style = self.style()
local motion_span
if not motion_cmd then
motion_span = ui.Span(string.format(" %3d ", motion_num)):style(style)
else
motion_span = ui.Span(string.format(" %3d%s ", motion_num, motion_cmd)):style(style)
end
return ui.Line {
ui.Span(THEME.status.separator_open):fg(style.bg),
motion_span,
ui.Span(THEME.status.separator_close):fg(style.bg),
ui.Span(" "),
}
end
end)
local render_numbers = ya.sync(function(_, mode)
ya.render()
File.number = function(_, index, file, hovered)
local idx
if mode == SHOW_NUMBERS_RELATIVE then
idx = math.abs(hovered - index)
elseif mode == SHOW_NUMBERS_ABSOLUTE then
idx = file.idx
else -- SHOW_NUMBERS_RELATIVE_ABSOLUTE
if hovered == index then
idx = file.idx
else
idx = math.abs(hovered - index)
end
end
-- emulate vim's hovered offset
if idx >= 100 then
return ui.Span(string.format("%4d ", idx))
elseif hovered == index then
return ui.Span(string.format("%3d ", idx))
else
return ui.Span(string.format(" %3d ", idx))
end
end
Current.render = function(self, area)
self.area = area
local files = Folder:by_kind(Folder.CURRENT).window
if #files == 0 then
return self:empty(area)
end
local hovered_index
for i, f in ipairs(files) do
if f:is_hovered() then
hovered_index = i
break
end
end
local items, markers = {}, {}
for i, f in ipairs(files) do
items[#items + 1] = ui.ListItem(ui.Line(ya.flat { File:number(i, f, hovered_index), File:full(f) }))
:style(File:style(f))
-- Yanked/marked/selected files
local marker = File:marker(f)
if marker ~= 0 then
markers[#markers + 1] = { i, marker }
end
end
return ya.flat {
ui.List(area, items),
Folder:linemode(area, files),
Folder:markers(area, markers),
}
end
end)
local function render_clear() render_motion() end
-----------------------------------------------
--------- C O M M A N D P A R S E R ---------
-----------------------------------------------
local get_keys = ya.sync(function(state) return state._only_motions and MOTION_KEYS or MOTIONS_AND_OP_KEYS end)
local function normal_direction(dir)
if dir == "<Down>" then
return "j"
elseif dir == "<Up>" then
return "k"
end
return dir
end
local function get_cmd(first_char, keys)
local last_key
local lines = first_char or ""
while true do
render_motion(tonumber(lines))
local key = ya.which { cands = keys, silent = true }
if not key then
return nil, nil, nil
end
last_key = keys[key].on
if not tonumber(last_key) then
last_key = normal_direction(last_key)
break
end
lines = lines .. last_key
end
render_motion(tonumber(lines), last_key)
-- command direction
local direction
if last_key == "g" or last_key == "v" or last_key == "d" or last_key == "y" or last_key == "x" then
DIRECTION_KEYS[#DIRECTION_KEYS + 1] = {
on = last_key,
}
local direction_key = ya.which { cands = DIRECTION_KEYS, silent = true }
if not direction_key then
return nil, nil, nil
end
direction = DIRECTION_KEYS[direction_key].on
direction = normal_direction(direction)
end
return tonumber(lines), last_key, direction
end
local function is_tab_command(command)
local tab_commands = { "t", "L", "H", "w", "W", "<", ">", "~" }
for _, cmd in ipairs(tab_commands) do
if command == cmd then
return true
end
end
return false
end
local get_active_tab = ya.sync(function(_) return cx.tabs.idx end)
-----------------------------------------------
---------- E N T R Y / S E T U P ----------
-----------------------------------------------
return {
entry = function(_, args)
local initial_value
-- this is checking if the argument is a valid number
if args then
initial_value = tostring(tonumber(args[1]))
if initial_value == "nil" then
return
end
end
local lines, cmd, direction = get_cmd(initial_value, get_keys())
if not lines or not cmd then
-- command was cancelled
render_clear()
return
end
if cmd == "g" then
if direction == "g" then
ya.manager_emit("arrow", { -99999999 })
ya.manager_emit("arrow", { lines - 1 })
render_clear()
return
elseif direction == "j" then
cmd = "j"
elseif direction == "k" then
cmd = "k"
elseif direction == "t" then
ya.manager_emit("tab_switch", { lines - 1 })
render_clear()
return
else
-- no valid direction
render_clear()
return
end
end
if cmd == "j" then
ya.manager_emit("arrow", { lines })
elseif cmd == "k" then
ya.manager_emit("arrow", { -lines })
elseif is_tab_command(cmd) then
if cmd == "t" then
for _ = 1, lines do
ya.manager_emit("tab_create", {})
end
elseif cmd == "H" then
ya.manager_emit("tab_switch", { -lines, relative = true })
elseif cmd == "L" then
ya.manager_emit("tab_switch", { lines, relative = true })
elseif cmd == "w" then
ya.manager_emit("tab_close", { lines - 1 })
elseif cmd == "W" then
local curr_tab = get_active_tab()
local del_tab = curr_tab + lines - 1
for _ = curr_tab, del_tab do
ya.manager_emit("tab_close", { curr_tab - 1 })
end
ya.manager_emit("tab_switch", { curr_tab - 1 })
elseif cmd == "<" then
ya.manager_emit("tab_swap", { -lines })
elseif cmd == ">" then
ya.manager_emit("tab_swap", { lines })
elseif cmd == "~" then
local jump = lines - get_active_tab()
ya.manager_emit("tab_swap", { jump })
end
else
ya.manager_emit("visual_mode", {})
-- invert direction when user specifies it
if direction == "k" then
ya.manager_emit("arrow", { -lines })
elseif direction == "j" then
ya.manager_emit("arrow", { lines })
else
ya.manager_emit("arrow", { lines - 1 })
end
ya.manager_emit("escape", {})
if cmd == "d" then
ya.manager_emit("remove", {})
elseif cmd == "y" then
ya.manager_emit("yank", {})
elseif cmd == "x" then
ya.manager_emit("yank", { cut = true })
end
end
render_clear()
end,
setup = function(state, args)
if not args then
return
end
-- initialize state variables
state._only_motions = args["only_motions"] or false
if args["show_motion"] then
render_motion_setup()
end
if args["show_numbers"] == "absolute" then
render_numbers(SHOW_NUMBERS_ABSOLUTE)
elseif args["show_numbers"] == "relative" then
render_numbers(SHOW_NUMBERS_RELATIVE)
elseif args["show_numbers"] == "relative_absolute" then
render_numbers(SHOW_NUMBERS_RELATIVE_ABSOLUTE)
end
end,
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Rolv Apneseth
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,89 @@
# starship.yazi
Starship prompt plugin for [Yazi](https://github.com/sxyazi/yazi)
<https://github.com/Rolv-Apneseth/starship.yazi/assets/69486699/f7314687-5cb1-4d66-8d9d-cca960ba6716>
## Requirements
- [Yazi](https://github.com/sxyazi/yazi) v0.2.4+
## Installation
### Linux / MacOS
```sh
git clone https://github.com/Rolv-Apneseth/starship.yazi.git ~/.config/yazi/plugins/starship.yazi
```
### Windows
```sh
git clone https://github.com/Rolv-Apneseth/starship.yazi.git %AppData%\yazi\config\plugins\starship.yazi
```
## Usage
Add this to `~/.config/yazi/init.lua`:
```lua
require("starship"):setup()
```
Make sure you have [starship](https://github.com/starship/starship) installed and in your `PATH`.
## Extra
If you use a `starship` theme with a background colour, it might look a bit to cramped on just the one line `Yazi` gives the header by default. You can add some space for the header by either using the [full border tip](https://yazi-rs.github.io/docs/tips/#full-border) from the `Yazi` docs, or add this slightly modified version (which won't add in the borders) to your `init.lua`:
<details>
<summary>Click to expand</summary>
```lua
function Manager:render(area)
local chunks = self:layout(area)
local bar = function(c, x, y)
x, y = math.max(0, x), math.max(0, y)
return ui.Bar(
ui.Rect({
x = x,
y = y,
w = ya.clamp(0, area.w - x, 1),
h = math.min(1, area.h),
}),
ui.Bar.TOP
):symbol(c)
end
return ya.flat({
ui.Bar(chunks[1], ui.Bar.RIGHT)
:symbol(THEME.manager.border_symbol)
:style(THEME.manager.border_style),
ui.Bar(chunks[3], ui.Bar.LEFT)
:symbol(THEME.manager.border_symbol)
:style(THEME.manager.border_style),
bar("┬", chunks[1].right - 1, chunks[1].y),
bar("┴", chunks[1].right - 1, chunks[1].bottom - 1),
bar("┬", chunks[2].right, chunks[2].y),
bar("┴", chunks[2].right, chunks[1].bottom - 1),
-- Parent
Parent:render(chunks[1]:padding(ui.Padding.xy(1))),
-- Current
Current:render(chunks[2]:padding(ui.Padding.y(1))),
-- Preview
Preview:render(chunks[3]:padding(ui.Padding.xy(1))),
})
end
```
</details>
> [!NOTE]
> This works by overriding your `Manager:render` function so make sure this is the only place you're doing that in your config
## Acknowledgements
- [sxyazi](https://github.com/sxyazi) for providing the code for this plugin and the demo video [in this comment](https://github.com/sxyazi/yazi/issues/767#issuecomment-1977082834)

View File

@ -0,0 +1,27 @@
local save = ya.sync(function(st, cwd, output)
if cx.active.current.cwd == Url(cwd) then
st.output = output
ya.render()
end
end)
return {
setup = function(st)
Header.cwd = function()
local cwd = cx.active.current.cwd
if st.cwd ~= cwd then
st.cwd = cwd
ya.manager_emit("plugin", { st._name, args = ya.quote(tostring(cwd)) })
end
return ui.Line.parse(st.output or "")
end
end,
entry = function(_, args)
local output = Command("starship"):arg("prompt"):cwd(args[1]):env("STARSHIP_SHELL", ""):output()
if output then
save(args[1], output.stdout:gsub("^%s+", ""))
end
end,
}

View File

@ -0,0 +1,235 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based on the Program.
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.

View File

@ -0,0 +1,28 @@
# torrent-preview.yazi
[Yazi](https://github.com/sxyazi/yazi) plugin to preview `application/x-bittorrent` files
![show case](https://github.com/kirasok/torrent-preview.yazi/assets/75790517/6f215e6d-bb19-46f4-b606-9241594028ff)
## Requirements
- [yazi](https://github.com/sxyazi/yazi)
- [transmission-cli](https://github.com/transmission/transmission)
## Installation
### Linux/MacOS
```sh
git clone https://github.com/kirasok/torrent-preview.yazi.git ~/.config/yazi/plugins/torrent-preview.yazi
```
## Usage
Add this to your `yazi.toml`:
```toml
[[plugin.prepend_previewers]]
mime = "application/x-bittorrent"
run = "torrent-preview"
```

View File

@ -0,0 +1,53 @@
local M = {}
function M:peek()
-- launch process
local process, code = Command("transmission-show")
:args({
tostring(self.file.url),
})
:stdout(Command.PIPED)
:spawn()
local limit = self.area.h
-- read and count lines from process
local i, lines = 0, ""
repeat
local next, event = process:read_line()
if event ~= 0 then
break
end
i = i + 1
-- only concatenate lines that are past 'skip' number of STDOUT
if i > self.skip then
lines = lines .. next
end
until i >= self.skip + limit -- until reader reaches max number of lines on screen plus skip
process:start_kill()
-- if paged below all output, run peek again with smaller skip
if self.skip > 0 and i < self.skip + limit then
ya.manager_emit(
"peek",
{ tostring(math.max(0, i - limit)), only_if = tostring(self.file.url), upper_bound = "" }
)
-- preview torrent
else
ya.preview_widgets(self, { ui.Paragraph.parse(self.area, lines):wrap(ui.Paragraph.WRAP) })
end
end
function M:seek(units)
local h = cx.active.current.hovered
if h and h.url == self.file.url then
local step = math.floor(units * self.area.h / 10)
ya.manager_emit("peek", {
math.max(0, cx.active.preview.skip + step),
only_if = self.file.url,
})
end
end
return M

View File

@ -0,0 +1,23 @@
MIT License
Copyright (c) 2024 imsi32
Copyright (c) 2023 - sxyazi
Copyright (c) 2023 yazi-rs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Some files were not shown because too many files have changed in this diff Show More