diff --git a/.dotter/global.toml b/.dotter/global.toml index f528a81f..cfd59986 100644 --- a/.dotter/global.toml +++ b/.dotter/global.toml @@ -51,9 +51,12 @@ depends = [ "shell" ] [local.files] "local/bin/" = "~/.local/bin/" "local/share/" = "~/.local/share/" +"local/share/applications/text.desktop" = {target = "~/.local/share/applications/text.desktop", type = "template"} +"local/share/applications/file.desktop" = {target = "~/.local/share/applications/file.desktop", type = "template"} [rofi.files] "config/rofi/" = "~/.config/rofi/" +"config/rofi/config.rasi" = {target = "~/.config/rofi/config.rasi", type = "template"} [misc] depends = [ "torrent", "zathura" ] @@ -85,12 +88,12 @@ depends = [ "torrent", "zathura" ] [awesome.files] "config/awesome/json.lua" = "~/.config/awesome/json.lua" "config/awesome/mytheme.lua" = "~/.config/awesome/mytheme.lua" -"config/awesome/rc.lua" = "~/.config/awesome/rc.lua" +"config/awesome/rc.lua" = {target = "~/.config/awesome/rc.lua", type = "template"} [awesome_laptop.files] "config/awesome/json.lua" = "~/.config/awesome/json.lua" "config/awesome/mytheme.lua" = "~/.config/awesome/mytheme.lua" -"config/awesome/rc-laptop.lua" = "~/.config/awesome/rc.lua" +"config/awesome/rc-laptop.lua" = {target = "~/.config/awesome/rc.lua", type = "template"} [dunst.files] "config/dunst/" = "~/.config/dunst/" @@ -100,6 +103,7 @@ depends = [ "misc", "local", "eww", "lock" ] [hyprland.files] "config/hypr/" = "~/.config/hypr/" +"config/hypr/hyprland.conf" = {target = "~/.config/hypr/hyprland.conf", type = "template"} [wofi.files] "config/wofi/" = "~/.config/wofi/" diff --git a/config/awesome/rc-laptop.lua b/config/awesome/rc-laptop.lua index dfd68f5c..4d91c926 100644 --- a/config/awesome/rc-laptop.lua +++ b/config/awesome/rc-laptop.lua @@ -31,7 +31,7 @@ local hotkeys_popup = require("awful.hotkeys_popup") -- when client with a matching name is opened: require("awful.hotkeys_popup.keys") --- {{{ Error handling +--- Error handling -- Check if awesome encountered an error during startup and fell back to -- another config (This code will only ever execute for the fallback config) if awesome.startup_errors then @@ -60,15 +60,14 @@ do in_error = false end) end --- }}} --- {{{ Variable definitions +--- Variable definitions -- Themes define colours, icons, font and wallpapers. -- beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") beautiful.init(gears.filesystem.get_configuration_dir() .. "mytheme.lua") -- This is used later as the default terminal and editor to run. -local terminal = "alacritty" +local terminal = "{{terminal}}" local editor = os.getenv("EDITOR") or "nvim" local editor_cmd = terminal .. " -e " .. editor @@ -99,9 +98,8 @@ awful.layout.layouts = { -- awful.layout.suit.corner.sw, -- awful.layout.suit.corner.se, } --- }}} --- {{{ Menu +-- Menu -- Create a launcher widget and a main menu local myawesomemenu = { { @@ -128,12 +126,11 @@ local mymainmenu = -- Menubar configuration menubar.utils.terminal = terminal -- Set the terminal for applications that require it --- }}} -- Keyboard map indicator and switcher -- local mykeyboardlayout = awful.widget.keyboardlayout() --- {{{ Wibar +-- Wibar -- Create a textclock widget local mytextclock = wibox.widget.textclock(" %d.%m.%Y, %H:%M:%S ", 1) @@ -327,9 +324,8 @@ awful.screen.connect_for_each_screen(function(s) }, }) end) --- }}} --- {{{ Mouse bindings +--- Mouse bindings root.buttons(gears.table.join( awful.button({}, 3, function() mymainmenu:toggle() @@ -337,9 +333,8 @@ root.buttons(gears.table.join( awful.button({}, 4, awful.tag.viewnext), awful.button({}, 5, awful.tag.viewprev) )) --- }}} --- {{{ Key bindings +--- Key bindings local globalkeys = gears.table.join( awful.key({ "Shift" }, "Pause", function() @@ -445,7 +440,7 @@ local globalkeys = gears.table.join( awful.spawn("floorp") end, { description = "open browser", group = "launcher" }), awful.key({ modkey }, "n", function() - awful.spawn("alacritty -e yazi") + awful.spawn(terminal .. " -e yazi") end, { description = "open yazi", group = "launcher" }), awful.key({ modkey }, "l", function() @@ -606,9 +601,8 @@ local clientbuttons = gears.table.join( -- Set keys root.keys(globalkeys) --- }}} --- {{{ Rules +--- Rules -- Rules to apply to new clients (through the "manage" signal). awful.rules.rules = { -- All clients will match this rule. @@ -694,7 +688,7 @@ awful.rules.rules = { { rule_any = { class = { "mpv" } }, properties = { fullscreen = true } }, } --- {{{ Signals +--- Signals -- Signal function to execute when a new client appears. client.connect_signal("manage", function(c) -- Set the windows at the slave, diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index 179f34a6..cbd65207 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -30,7 +30,7 @@ local hotkeys_popup = require("awful.hotkeys_popup") -- when client with a matching name is opened: require("awful.hotkeys_popup.keys") --- {{{ Error handling +--- Error handling -- Check if awesome encountered an error during startup and fell back to -- another config (This code will only ever execute for the fallback config) if awesome.startup_errors then @@ -59,15 +59,14 @@ do in_error = false end) end --- }}} --- {{{ Variable definitions +--- Variable definitions -- Themes define colours, icons, font and wallpapers. -- beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") beautiful.init(gears.filesystem.get_configuration_dir() .. "mytheme.lua") -- This is used later as the default terminal and editor to run. -local terminal = "alacritty" +local terminal = "{{terminal}}" local editor = os.getenv("EDITOR") or "nvim" local editor_cmd = terminal .. " -e " .. editor @@ -98,9 +97,8 @@ awful.layout.layouts = { -- awful.layout.suit.corner.sw, -- awful.layout.suit.corner.se, } --- }}} --- {{{ Menu +--- Menu -- Create a launcher widget and a main menu local myawesomemenu = { { @@ -127,12 +125,11 @@ local mymainmenu = -- Menubar configuration menubar.utils.terminal = terminal -- Set the terminal for applications that require it --- }}} -- Keyboard map indicator and switcher -- local mykeyboardlayout = awful.widget.keyboardlayout() --- {{{ Wibar +--- Wibar -- Create a textclock widget local mytextclock = wibox.widget.textclock(" %d.%m.%Y, %H:%M:%S ", 1) @@ -320,9 +317,8 @@ awful.screen.connect_for_each_screen(function(s) }, }) end) --- }}} --- {{{ Mouse bindings +--- Mouse bindings root.buttons(gears.table.join( awful.button({}, 3, function() mymainmenu:toggle() @@ -330,9 +326,8 @@ root.buttons(gears.table.join( awful.button({}, 4, awful.tag.viewnext), awful.button({}, 5, awful.tag.viewprev) )) --- }}} --- {{{ Key bindings +--- Key bindings local globalkeys = gears.table.join( awful.key({ "Shift" }, "Pause", function() @@ -438,7 +433,7 @@ local globalkeys = gears.table.join( awful.spawn("floorp") end, { description = "open browser", group = "launcher" }), awful.key({ modkey }, "n", function() - awful.spawn("alacritty -e yazi") + awful.spawn(terminal .. " -e yazi") end, { description = "open yazi", group = "launcher" }), awful.key({ modkey }, "l", function() @@ -595,9 +590,8 @@ local clientbuttons = gears.table.join( -- Set keys root.keys(globalkeys) --- }}} --- {{{ Rules +--- Rules -- Rules to apply to new clients (through the "manage" signal). awful.rules.rules = { -- All clients will match this rule. @@ -683,7 +677,7 @@ awful.rules.rules = { { rule_any = { class = { "mpv" } }, properties = { fullscreen = true } }, } --- {{{ Signals +--- Signals -- Signal function to execute when a new client appears. client.connect_signal("manage", function(c) -- Set the windows at the slave, diff --git a/config/ghostty/config b/config/ghostty/config index e3258598..2204e9db 100644 --- a/config/ghostty/config +++ b/config/ghostty/config @@ -1,991 +1,30 @@ -# The font families to use. -# -# You can generate the list of valid values using the CLI: -# -# ghostty +list-fonts -# -# This configuration can be repeated multiple times to specify preferred -# fallback fonts when the requested codepoint is not available in the primary -# font. This is particularly useful for multiple languages, symbolic fonts, -# etc. -# -# Notes on emoji specifically: On macOS, Ghostty by default will always use -# Apple Color Emoji and on Linux will always use Noto Emoji. You can -# override this behavior by specifying a font family here that contains -# emoji glyphs. -# -# The specific styles (bold, italic, bold italic) do not need to be -# explicitly set. If a style is not set, then the regular style (font-family) -# will be searched for stylistic variants. If a stylistic variant is not -# found, Ghostty will use the regular style. This prevents falling back to a -# different font family just to get a style such as bold. This also applies -# if you explicitly specify a font family for a style. For example, if you -# set `font-family-bold = FooBar` and "FooBar" cannot be found, Ghostty will -# use whatever font is set for `font-family` for the bold style. -# -# Finally, some styles may be synthesized if they are not supported. -# For example, if a font does not have an italic style and no alternative -# italic font is specified, Ghostty will synthesize an italic style by -# applying a slant to the regular style. If you want to disable these -# synthesized styles then you can use the `font-style` configurations -# as documented below. -# -# You can disable styles completely by using the `font-style` set of -# configurations. See the documentation for `font-style` for more information. -# -# If you want to overwrite a previous set value rather than append a fallback, -# specify the value as `""` (empty string) to reset the list and then set the -# new values. For example: -# -# font-family = "" -# font-family = "My Favorite Font" -# -# Setting any of these as CLI arguments will automatically clear the -# values set in configuration files so you don't need to specify -# `--font-family=""` before setting a new value. You only need to specify -# this within config files if you want to clear previously set values in -# configuration files or on the CLI if you want to clear values set on the -# CLI. -# -# Changing this configuration at runtime will only affect new terminals, i.e. -# new windows, tabs, etc. font-family = "JetBrainsMono NF" +font-family-bold = "JetBrainsMono NF Bold" +font-family-italic = "JetBrainsMono NF Italic" +font-family-bold-italic = "JetBrainsMono NF Bold Italic" -# font-family-bold = "JetBrainsMono NF Bold" -# font-family-italic = "JetBrainsMono NF Italic" -# font-family-bold-italic = "JetBrainsMono NF Bold Italic" -# The named font style to use for each of the requested terminal font styles. -# This looks up the style based on the font style string advertised by the -# font itself. For example, "Iosevka Heavy" has a style of "Heavy". -# -# You can also use these fields to completely disable a font style. If you set -# the value of the configuration below to literal `false` then that font style -# will be disabled. If the running program in the terminal requests a disabled -# font style, the regular font style will be used instead. -# -# These are only valid if its corresponding font-family is also specified. If -# no font-family is specified, then the font-style is ignored unless you're -# disabling the font style. -font-style = default - -font-style-bold = default -font-style-italic = default -font-style-bold-italic = default -# Control whether Ghostty should synthesize a style if the requested style is -# not available in the specified font-family. -# -# Ghostty can synthesize bold, italic, and bold italic styles if the font -# does not have a specific style. For bold, this is done by drawing an -# outline around the glyph of varying thickness. For italic, this is done by -# applying a slant to the glyph. For bold italic, both of these are applied. -# -# Synthetic styles are not perfect and will generally not look as good -# as a font that has the style natively. However, they are useful to -# provide styled text when the font does not have the style. -# -# Set this to "false" or "true" to disable or enable synthetic styles -# completely. You can disable specific styles using "no-bold", "no-italic", -# and "no-bold-italic". You can disable multiple styles by separating them -# with a comma. For example, "no-bold,no-italic". -# -# Available style keys are: `bold`, `italic`, `bold-italic`. -# -# If synthetic styles are disabled, then the regular style will be used -# instead if the requested style is not available. If the font has the -# requested style, then the font will be used as-is since the style is -# not synthetic. -# -# Warning: An easy mistake is to disable `bold` or `italic` but not -# `bold-italic`. Disabling only `bold` or `italic` will NOT disable either -# in the `bold-italic` style. If you want to disable `bold-italic`, you must -# explicitly disable it. You cannot partially disable `bold-italic`. -# -# By default, synthetic styles are enabled. -font-synthetic-style = bold,italic,bold-italic - -# Apply a font feature. To enable multiple font features you can repeat -# this multiple times or use a comma-separated list of feature settings. -# -# The syntax for feature settings is as follows, where `feat` is a feature: -# -# * Enable features with e.g. `feat`, `+feat`, `feat on`, `feat=1`. -# * Disabled features with e.g. `-feat`, `feat off`, `feat=0`. -# * Set a feature value with e.g. `feat=2`, `feat = 3`, `feat 4`. -# * Feature names may be wrapped in quotes, meaning this config should be -# syntactically compatible with the `font-feature-settings` CSS property. -# -# The syntax is fairly loose, but invalid settings will be silently ignored. -# -# The font feature will apply to all fonts rendered by Ghostty. A future -# enhancement will allow targeting specific faces. -# -# To disable programming ligatures, use `-calt` since this is the typical -# feature name for programming ligatures. To look into what font features -# your font has and what they do, use a font inspection tool such as -# [fontdrop.info](https://fontdrop.info). -# -# To generally disable most ligatures, use `-calt, -liga, -dlig`. font-feature = "-calt, -liga, -dlig" - -# Font size in points. This value can be a non-integer and the nearest integer -# pixel size will be selected. If you have a high dpi display where 1pt = 2px -# then you can get an odd numbered pixel size by specifying a half point. -# -# For example, 13.5pt @ 2px/pt = 27px -# -# Changing this configuration at runtime will only affect new terminals, -# i.e. new windows, tabs, etc. Note that you may still not see the change -# depending on your `window-inherit-font-size` setting. If that setting is -# true, only the first window will be affected by this change since all -# subsequent windows will inherit the font size of the previous window. -# -# On Linux with GTK, font size is scaled according to both display-wide and -# text-specific scaling factors, which are often managed by your desktop -# environment (e.g. the GNOME display scale and large text settings). font-size = {{font_size}} -# A repeatable configuration to set one or more font variations values for -# a variable font. A variable font is a single font, usually with a filename -# ending in `-VF.ttf` or `-VF.otf` that contains one or more configurable axes -# for things such as weight, slant, etc. Not all fonts support variations; -# only fonts that explicitly state they are variable fonts will work. -# -# The format of this is `id=value` where `id` is the axis identifier. An axis -# identifier is always a 4 character string, such as `wght`. To get the list -# of supported axes, look at your font documentation or use a font inspection -# tool. -# -# Invalid ids and values are usually ignored. For example, if a font only -# supports weights from 100 to 700, setting `wght=800` will do nothing (it -# will not be clamped to 700). You must consult your font's documentation to -# see what values are supported. -# -# Common axes are: `wght` (weight), `slnt` (slant), `ital` (italic), `opsz` -# (optical size), `wdth` (width), `GRAD` (gradient), etc. -font-variation = - -font-variation-bold = -font-variation-italic = -font-variation-bold-italic = -# Force one or a range of Unicode codepoints to map to a specific named font. -# This is useful if you want to support special symbols or if you want to use -# specific glyphs that render better for your specific font. -# -# The syntax is `codepoint=fontname` where `codepoint` is either a single -# codepoint or a range. Codepoints must be specified as full Unicode -# hex values, such as `U+ABCD`. Codepoints ranges are specified as -# `U+ABCD-U+DEFG`. You can specify multiple ranges for the same font separated -# by commas, such as `U+ABCD-U+DEFG,U+1234-U+5678=fontname`. The font name is -# the same value as you would use for `font-family`. -# -# This configuration can be repeated multiple times to specify multiple -# codepoint mappings. -# -# Changing this configuration at runtime will only affect new terminals, -# i.e. new windows, tabs, etc. -font-codepoint-map = - -# Draw fonts with a thicker stroke, if supported. -# This is currently only supported on macOS. -font-thicken = false - -# Strength of thickening when `font-thicken` is enabled. -# -# Valid values are integers between `0` and `255`. `0` does not correspond to -# *no* thickening, rather it corresponds to the lightest available thickening. -# -# Has no effect when `font-thicken` is set to `false`. -# -# This is currently only supported on macOS. -font-thicken-strength = 255 - -# What color space to use when performing alpha blending. -# -# This affects the appearance of text and of any images with transparency. -# Additionally, custom shaders will receive colors in the configured space. -# -# Valid values: -# -# * `native` - Perform alpha blending in the native color space for the OS. -# On macOS this corresponds to Display P3, and on Linux it's sRGB. -# -# * `linear` - Perform alpha blending in linear space. This will eliminate -# the darkening artifacts around the edges of text that are very visible -# when certain color combinations are used (e.g. red / green), but makes -# dark text look much thinner than normal and light text much thicker. -# This is also sometimes known as "gamma correction". -# (Currently only supported on macOS. Has no effect on Linux.) -# -# * `linear-corrected` - Same as `linear`, but with a correction step applied -# for text that makes it look nearly or completely identical to `native`, -# but without any of the darkening artifacts. -alpha-blending = native - -# All of the configurations behavior adjust various metrics determined by the -# font. The values can be integers (1, -1, etc.) or a percentage (20%, -15%, -# etc.). In each case, the values represent the amount to change the original -# value. -# -# For example, a value of `1` increases the value by 1; it does not set it to -# literally 1. A value of `20%` increases the value by 20%. And so on. -# -# There is little to no validation on these values so the wrong values (e.g. -# `-100%`) can cause the terminal to be unusable. Use with caution and reason. -# -# Some values are clamped to minimum or maximum values. This can make it -# appear that certain values are ignored. For example, many `*-thickness` -# adjustments cannot go below 1px. -# -# `adjust-cell-height` has some additional behaviors to describe: -# -# * The font will be centered vertically in the cell. -# -# * The cursor will remain the same size as the font, but may be -# adjusted separately with `adjust-cursor-height`. -# -# * Powerline glyphs will be adjusted along with the cell height so -# that things like status lines continue to look aligned. -adjust-cell-width = - -adjust-cell-height = -# Distance in pixels or percentage adjustment from the bottom of the cell to the text baseline. -# Increase to move baseline UP, decrease to move baseline DOWN. -# See the notes about adjustments in `adjust-cell-width`. -adjust-font-baseline = - -# Distance in pixels or percentage adjustment from the top of the cell to the top of the underline. -# Increase to move underline DOWN, decrease to move underline UP. -# See the notes about adjustments in `adjust-cell-width`. -adjust-underline-position = - -# Thickness in pixels of the underline. -# See the notes about adjustments in `adjust-cell-width`. -adjust-underline-thickness = - -# Distance in pixels or percentage adjustment from the top of the cell to the top of the strikethrough. -# Increase to move strikethrough DOWN, decrease to move underline UP. -# See the notes about adjustments in `adjust-cell-width`. -adjust-strikethrough-position = - -# Thickness in pixels or percentage adjustment of the strikethrough. -# See the notes about adjustments in `adjust-cell-width`. -adjust-strikethrough-thickness = - -# Distance in pixels or percentage adjustment from the top of the cell to the top of the overline. -# Increase to move overline DOWN, decrease to move underline UP. -# See the notes about adjustments in `adjust-cell-width`. -adjust-overline-position = - -# Thickness in pixels or percentage adjustment of the overline. -# See the notes about adjustments in `adjust-cell-width`. -adjust-overline-thickness = - -# Thickness in pixels or percentage adjustment of the bar cursor and outlined rect cursor. -# See the notes about adjustments in `adjust-cell-width`. -adjust-cursor-thickness = - -# Height in pixels or percentage adjustment of the cursor. Currently applies to all cursor types: -# bar, rect, and outlined rect. -# See the notes about adjustments in `adjust-cell-width`. -adjust-cursor-height = - -# Thickness in pixels or percentage adjustment of box drawing characters. -# See the notes about adjustments in `adjust-cell-width`. -adjust-box-thickness = - -# The method to use for calculating the cell width of a grapheme cluster. -# The default value is `unicode` which uses the Unicode standard to determine -# grapheme width. This results in correct grapheme width but may result in -# cursor-desync issues with some programs (such as shells) that may use a -# legacy method such as `wcswidth`. -# -# Valid values are: -# -# * `legacy` - Use a legacy method to determine grapheme width, such as -# wcswidth This maximizes compatibility with legacy programs but may result -# in incorrect grapheme width for certain graphemes such as skin-tone -# emoji, non-English characters, etc. -# -# This is called "legacy" and not something more specific because the -# behavior is undefined and we want to retain the ability to modify it. -# For example, we may or may not use libc `wcswidth` now or in the future. -# -# * `unicode` - Use the Unicode standard to determine grapheme width. -# -# If a running program explicitly enables terminal mode 2027, then `unicode` -# width will be forced regardless of this configuration. When mode 2027 is -# reset, this configuration will be used again. -# -# This configuration can be changed at runtime but will not affect existing -# terminals. Only new terminals will use the new configuration. -grapheme-width-method = unicode - -# FreeType load flags to enable. The format of this is a list of flags to -# enable separated by commas. If you prefix a flag with `no-` then it is -# disabled. If you omit a flag, its default value is used, so you must -# explicitly disable flags you don't want. You can also use `true` or `false` -# to turn all flags on or off. -# -# This configuration only applies to Ghostty builds that use FreeType. -# This is usually the case only for Linux builds. macOS uses CoreText -# and does not have an equivalent configuration. -# -# Available flags: -# -# * `hinting` - Enable or disable hinting, enabled by default. -# * `force-autohint` - Use the freetype auto-hinter rather than the -# font's native hinter. Enabled by default. -# * `monochrome` - Instructs renderer to use 1-bit monochrome -# rendering. This option doesn't impact the hinter. -# Enabled by default. -# * `autohint` - Use the freetype auto-hinter. Enabled by default. -# -# Example: `hinting`, `no-hinting`, `force-autohint`, `no-force-autohint` -freetype-load-flags = hinting,force-autohint,monochrome,autohint - -# A theme to use. This can be a built-in theme name, a custom theme -# name, or an absolute path to a custom theme file. Ghostty also supports -# specifying a different theme to use for light and dark mode. Each -# option is documented below. -# -# If the theme is an absolute pathname, Ghostty will attempt to load that -# file as a theme. If that file does not exist or is inaccessible, an error -# will be logged and no other directories will be searched. -# -# If the theme is not an absolute pathname, two different directories will be -# searched for a file name that matches the theme. This is case sensitive on -# systems with case-sensitive filesystems. It is an error for a theme name to -# include path separators unless it is an absolute pathname. -# -# The first directory is the `themes` subdirectory of your Ghostty -# configuration directory. This is `$XDG_CONFIG_DIR/ghostty/themes` or -# `~/.config/ghostty/themes`. -# -# The second directory is the `themes` subdirectory of the Ghostty resources -# directory. Ghostty ships with a multitude of themes that will be installed -# into this directory. On macOS, this list is in the -# `Ghostty.app/Contents/Resources/ghostty/themes` directory. On Linux, this -# list is in the `share/ghostty/themes` directory (wherever you installed the -# Ghostty "share" directory. -# -# To see a list of available themes, run `ghostty +list-themes`. -# -# A theme file is simply another Ghostty configuration file. They share -# the same syntax and same configuration options. A theme can set any valid -# configuration option so please do not use a theme file from an untrusted -# source. The built-in themes are audited to only set safe configuration -# options. -# -# Some options cannot be set within theme files. The reason these are not -# supported should be self-evident. A theme file cannot set `theme` or -# `config-file`. At the time of writing this, Ghostty will not show any -# warnings or errors if you set these options in a theme file but they will -# be silently ignored. -# -# Any additional colors specified via background, foreground, palette, etc. -# will override the colors specified in the theme. -# -# To specify a different theme for light and dark mode, use the following -# syntax: `light:theme-name,dark:theme-name`. For example: -# `light:rose-pine-dawn,dark:rose-pine`. Whitespace around all values are -# trimmed and order of light and dark does not matter. Both light and dark -# must be specified in this form. In this form, the theme used will be -# based on the current desktop environment theme. -# -# There are some known bugs with light/dark mode theming. These will -# be fixed in a future update: -# -# - macOS: titlebar tabs style is not updated when switching themes. -# theme = rose-pine -# Background color for the window. -# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. -# background = #282c34 - -# Foreground color for the window. -# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. -# foreground = #ffffff - -# The foreground and background color for selection. If this is not set, then -# the selection color is just the inverted window background and foreground -# (note: not to be confused with the cell bg/fg). -# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. -selection-foreground = - -selection-background = -# Swap the foreground and background colors of cells for selection. This -# option overrides the `selection-foreground` and `selection-background` -# options. -# -# If you select across cells with differing foregrounds and backgrounds, the -# selection color will vary across the selection. -selection-invert-fg-bg = false - -# The minimum contrast ratio between the foreground and background colors. -# The contrast ratio is a value between 1 and 21. A value of 1 allows for no -# contrast (e.g. black on black). This value is the contrast ratio as defined -# by the [WCAG 2.0 specification](https://www.w3.org/TR/WCAG20/). -# -# If you want to avoid invisible text (same color as background), a value of -# 1.1 is a good value. If you want to avoid text that is difficult to read, a -# value of 3 or higher is a good value. The higher the value, the more likely -# that text will become black or white. -# -# This value does not apply to Emoji or images. -minimum-contrast = 1 - -# Color palette for the 256 color form that many terminal applications use. -# The syntax of this configuration is `N=COLOR` where `N` is 0 to 255 (for -# the 256 colors in the terminal color table) and `COLOR` is a typical RGB -# color code such as `#AABBCC` or `AABBCC`, or a named X11 color. -# -# The palette index can be in decimal, binary, octal, or hexadecimal. -# Decimal is assumed unless a prefix is used: `0b` for binary, `0o` for octal, -# and `0x` for hexadecimal. -# -# For definitions on the color indices and what they canonically map to, -# [see this cheat sheet](https://www.ditig.com/256-colors-cheat-sheet). - -# The color of the cursor. If this is not set, a default will be chosen. -# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. -cursor-color = - -# Swap the foreground and background colors of the cell under the cursor. This -# option overrides the `cursor-color` and `cursor-text` options. -cursor-invert-fg-bg = false - -# The opacity level (opposite of transparency) of the cursor. A value of 1 -# is fully opaque and a value of 0 is fully transparent. A value less than 0 -# or greater than 1 will be clamped to the nearest valid value. Note that a -# sufficiently small value such as 0.3 may be effectively invisible and may -# make it difficult to find the cursor. -cursor-opacity = 1 - -# The style of the cursor. This sets the default style. A running program can -# still request an explicit cursor style using escape sequences (such as `CSI -# q`). Shell configurations will often request specific cursor styles. -# -# Note that shell integration will automatically set the cursor to a bar at -# a prompt, regardless of this configuration. You can disable that behavior -# by specifying `shell-integration-features = no-cursor` or disabling shell -# integration entirely. -# -# Valid values are: -# -# * `block` -# * `bar` -# * `underline` -# * `block_hollow` -# -cursor-style = bar - -# Sets the default blinking state of the cursor. This is just the default -# state; running programs may override the cursor style using `DECSCUSR` (`CSI -# q`). -# -# If this is not set, the cursor blinks by default. Note that this is not the -# same as a "true" value, as noted below. -# -# If this is not set at all (`null`), then Ghostty will respect DEC Mode 12 -# (AT&T cursor blink) as an alternate approach to turning blinking on/off. If -# this is set to any value other than null, DEC mode 12 will be ignored but -# `DECSCUSR` will still be respected. -# -# Valid values are: -# -# * ` ` (blank) -# * `true` -# * `false` -# -cursor-style-blink = - -# The color of the text under the cursor. If this is not set, a default will -# be chosen. -# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. -cursor-text = - -# Enables the ability to move the cursor at prompts by using `alt+click` on -# Linux and `option+click` on macOS. -# -# This feature requires shell integration (specifically prompt marking -# via `OSC 133`) and only works in primary screen mode. Alternate screen -# applications like vim usually have their own version of this feature but -# this configuration doesn't control that. -# -# It should be noted that this feature works by translating your desired -# position into a series of synthetic arrow key movements, so some weird -# behavior around edge cases are to be expected. This is unfortunately how -# this feature is implemented across terminals because there isn't any other -# way to implement it. -cursor-click-to-move = true - -# Hide the mouse immediately when typing. The mouse becomes visible again -# when the mouse is used (button, movement, etc.). Platform-specific behavior -# may dictate other scenarios where the mouse is shown. For example on macOS, -# the mouse is shown again when a new window, tab, or split is created. -mouse-hide-while-typing = false - -# Determines whether running programs can detect the shift key pressed with a -# mouse click. Typically, the shift key is used to extend mouse selection. -# -# The default value of `false` means that the shift key is not sent with -# the mouse protocol and will extend the selection. This value can be -# conditionally overridden by the running program with the `XTSHIFTESCAPE` -# sequence. -# -# The value `true` means that the shift key is sent with the mouse protocol -# but the running program can override this behavior with `XTSHIFTESCAPE`. -# -# The value `never` is the same as `false` but the running program cannot -# override this behavior with `XTSHIFTESCAPE`. The value `always` is the -# same as `true` but the running program cannot override this behavior with -# `XTSHIFTESCAPE`. -# -# If you always want shift to extend mouse selection even if the program -# requests otherwise, set this to `never`. -# -# Valid values are: -# -# * `true` -# * `false` -# * `always` -# * `never` -# -mouse-shift-capture = false - -# Multiplier for scrolling distance with the mouse wheel. Any value less -# than 0.01 or greater than 10,000 will be clamped to the nearest valid -# value. -# -# A value of "1" (default) scrolls the default amount. A value of "2" scrolls -# double the default amount. A value of "0.5" scrolls half the default amount. -# Et cetera. -mouse-scroll-multiplier = 1 - -# The opacity level (opposite of transparency) of the background. A value of -# 1 is fully opaque and a value of 0 is fully transparent. A value less than 0 -# or greater than 1 will be clamped to the nearest valid value. -# -# On macOS, background opacity is disabled when the terminal enters native -# fullscreen. This is because the background becomes gray and it can cause -# widgets to show through which isn't generally desirable. -# -# On macOS, changing this configuration requires restarting Ghostty completely. -background-opacity = 0.95 - -# Whether to blur the background when `background-opacity` is less than 1. -# -# Valid values are: -# -# * a nonnegative integer specifying the *blur intensity* -# * `false`, equivalent to a blur intensity of 0 -# * `true`, equivalent to the default blur intensity of 20, which is -# reasonable for a good looking blur. Higher blur intensities may -# cause strange rendering and performance issues. -# -# Supported on macOS and on some Linux desktop environments, including: -# -# * KDE Plasma (Wayland and X11) -# -# Warning: the exact blur intensity is _ignored_ under KDE Plasma, and setting -# this setting to either `true` or any positive blur intensity value would -# achieve the same effect. The reason is that KWin, the window compositor -# powering Plasma, only has one global blur setting and does not allow -# applications to specify individual blur settings. -# -# To configure KWin's global blur setting, open System Settings and go to -# "Apps & Windows" > "Window Management" > "Desktop Effects" and select the -# "Blur" plugin. If disabled, enable it by ticking the checkbox to the left. -# Then click on the "Configure" button and there will be two sliders that -# allow you to set background blur and noise intensities for all apps, -# including Ghostty. -# -# All other Linux desktop environments are as of now unsupported. Users may -# need to set environment-specific settings and/or install third-party plugins -# in order to support background blur, as there isn't a unified interface for -# doing so. -background-blur = true - -# The opacity level (opposite of transparency) of an unfocused split. -# Unfocused splits by default are slightly faded out to make it easier to see -# which split is focused. To disable this feature, set this value to 1. -# -# A value of 1 is fully opaque and a value of 0 is fully transparent. Because -# "0" is not useful (it makes the window look very weird), the minimum value -# is 0.15. This value still looks weird but you can at least see what's going -# on. A value outside of the range 0.15 to 1 will be clamped to the nearest -# valid value. -unfocused-split-opacity = 0.7 - -# The color to dim the unfocused split. Unfocused splits are dimmed by -# rendering a semi-transparent rectangle over the split. This sets the color of -# that rectangle and can be used to carefully control the dimming effect. -# -# This will default to the background color. -# -# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. -unfocused-split-fill = - -# The color of the split divider. If this is not set, a default will be chosen. -# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. -split-divider-color = - -# The command to run, usually a shell. If this is not an absolute path, it'll -# be looked up in the `PATH`. If this is not set, a default will be looked up -# from your system. The rules for the default lookup are: -# -# * `SHELL` environment variable -# -# * `passwd` entry (user information) -# -# This can contain additional arguments to run the command with. If additional -# arguments are provided, the command will be executed using `/bin/sh -c`. -# Ghostty does not do any shell command parsing. -# -# This command will be used for all new terminal surfaces, i.e. new windows, -# tabs, etc. If you want to run a command only for the first terminal surface -# created when Ghostty starts, use the `initial-command` configuration. -# -# Ghostty supports the common `-e` flag for executing a command with -# arguments. For example, `ghostty -e fish --with --custom --args`. -# This flag sets the `initial-command` configuration, see that for more -# information. -command = - -# This is the same as "command", but only applies to the first terminal -# surface created when Ghostty starts. Subsequent terminal surfaces will use -# the `command` configuration. -# -# After the first terminal surface is created (or closed), there is no -# way to run this initial command again automatically. As such, setting -# this at runtime works but will only affect the next terminal surface -# if it is the first one ever created. -# -# If you're using the `ghostty` CLI there is also a shortcut to set this -# with arguments directly: you can use the `-e` flag. For example: `ghostty -e -# fish --with --custom --args`. The `-e` flag automatically forces some -# other behaviors as well: -# -# * `gtk-single-instance=false` - This ensures that a new instance is -# launched and the CLI args are respected. -# -# * `quit-after-last-window-closed=true` - This ensures that the Ghostty -# process will exit when the command exits. Additionally, the -# `quit-after-last-window-closed-delay` is unset. -# -# * `shell-integration=detect` (if not `none`) - This prevents forcibly -# injecting any configured shell integration into the command's -# environment. With `-e` its highly unlikely that you're executing a -# shell and forced shell integration is likely to cause problems -# (e.g. by wrapping your command in a shell, setting env vars, etc.). -# This is a safety measure to prevent unexpected behavior. If you want -# shell integration with a `-e`-executed command, you must either -# name your binary appropriately or source the shell integration script -# manually. -# -initial-command = - -# If true, keep the terminal open after the command exits. Normally, the -# terminal window closes when the running command (such as a shell) exits. -# With this true, the terminal window will stay open until any keypress is -# received. -# -# This is primarily useful for scripts or debugging. -wait-after-command = false - -# The number of milliseconds of runtime below which we consider a process exit -# to be abnormal. This is used to show an error message when the process exits -# too quickly. -# -# On Linux, this must be paired with a non-zero exit code. On macOS, we allow -# any exit code because of the way shell processes are launched via the login -# command. -abnormal-command-exit-runtime = 250 - -# The size of the scrollback buffer in bytes. This also includes the active -# screen. No matter what this is set to, enough memory will always be -# allocated for the visible screen and anything leftover is the limit for -# the scrollback. -# -# When this limit is reached, the oldest lines are removed from the -# scrollback. -# -# Scrollback currently exists completely in memory. This means that the -# larger this value, the larger potential memory usage. Scrollback is -# allocated lazily up to this limit, so if you set this to a very large -# value, it will not immediately consume a lot of memory. -# -# This size is per terminal surface, not for the entire application. -# -# It is not currently possible to set an unlimited scrollback buffer. -# This is a future planned feature. -# -# This can be changed at runtime but will only affect new terminal surfaces. -scrollback-limit = 10000000 - -# Match a regular expression against the terminal text and associate clicking -# it with an action. This can be used to match URLs, file paths, etc. Actions -# can be opening using the system opener (e.g. `open` or `xdg-open`) or -# executing any arbitrary binding action. -# -# Links that are configured earlier take precedence over links that are -# configured later. -# -# A default link that matches a URL and opens it in the system opener always -# exists. This can be disabled using `link-url`. -# -# TODO: This can't currently be set! - -# Enable URL matching. URLs are matched on hover with control (Linux) or -# super (macOS) pressed and open using the default system application for -# the linked URL. -# -# The URL matcher is always lowest priority of any configured links (see -# `link`). If you want to customize URL matching, use `link` and disable this. -link-url = true - -# Whether to start the window in a maximized state. This setting applies -# to new windows and does not apply to tabs, splits, etc. However, this setting -# will apply to all new windows, not just the first one. -maximize = false - -# Start new windows in fullscreen. This setting applies to new windows and -# does not apply to tabs, splits, etc. However, this setting will apply to all -# new windows, not just the first one. -# -# On macOS, this setting does not work if window-decoration is set to -# "false", because native fullscreen on macOS requires window decorations -# to be set. -fullscreen = false - -# The title Ghostty will use for the window. This will force the title of the -# window to be this title at all times and Ghostty will ignore any set title -# escape sequences programs (such as Neovim) may send. -# -# If you want a blank title, set this to one or more spaces by quoting -# the value. For example, `title = " "`. This effectively hides the title. -# This is necessary because setting a blank value resets the title to the -# default value of the running program. -# -# This configuration can be reloaded at runtime. If it is set, the title -# will update for all windows. If it is unset, the next title change escape -# sequence will be honored but previous changes will not retroactively -# be set. This latter case may require you to restart programs such as Neovim -# to get the new title. title = "Ghostty" - -# The setting that will change the application class value. -# -# This controls the class field of the `WM_CLASS` X11 property (when running -# under X11), and the Wayland application ID (when running under Wayland). -# -# Note that changing this value between invocations will create new, separate -# instances, of Ghostty when running with `gtk-single-instance=true`. See that -# option for more details. -# -# The class name must follow the requirements defined [in the GTK -# documentation](https://docs.gtk.org/gio/type_func.Application.id_is_valid.html). -# -# The default is `com.mitchellh.ghostty`. -# -# This only affects GTK builds. class = "ghostty" -# This controls the instance name field of the `WM_CLASS` X11 property when -# running under X11. It has no effect otherwise. -# -# The default is `ghostty`. -# -# This only affects GTK builds. -x11-instance-name = +window-padding-x = 4 +window-padding-y = 4 -# The directory to change to after starting the command. -# -# This setting is secondary to the `window-inherit-working-directory` -# setting. If a previous Ghostty terminal exists in the same process, -# `window-inherit-working-directory` will take precedence. Otherwise, this -# setting will be used. Typically, this setting is used only for the first -# window. -# -# The default is `inherit` except in special scenarios listed next. On macOS, -# if Ghostty can detect it is launched from launchd (double-clicked) or -# `open`, then it defaults to `home`. On Linux with GTK, if Ghostty can detect -# it was launched from a desktop launcher, then it defaults to `home`. -# -# The value of this must be an absolute value or one of the special values -# below: -# -# * `home` - The home directory of the executing user. -# -# * `inherit` - The working directory of the launching process. -working-directory = +background-opacity = 0.95 +background-blur = true +resize-overlay = never +quick-terminal-animation-duration = 0 +gtk-titlebar = false +window-decoration = false +scrollback-limit = 10000000 +mouse-hide-while-typing = true +confirm-close-surface = false -# Key bindings. The format is `trigger=action`. Duplicate triggers will -# overwrite previously set values. The list of actions is available in -# the documentation or using the `ghostty +list-actions` command. -# -# Trigger: `+`-separated list of keys and modifiers. Example: `ctrl+a`, -# `ctrl+shift+b`, `up`. -# -# Valid keys are currently only listed in the -# [Ghostty source code](https://github.com/ghostty-org/ghostty/blob/d6e76858164d52cff460fedc61ddf2e560912d71/src/input/key.zig#L255). -# This is a documentation limitation and we will improve this in the future. -# A common gotcha is that numeric keys are written as words: e.g. `one`, -# `two`, `three`, etc. and not `1`, `2`, `3`. This will also be improved in -# the future. -# -# Valid modifiers are `shift`, `ctrl` (alias: `control`), `alt` (alias: `opt`, -# `option`), and `super` (alias: `cmd`, `command`). You may use the modifier -# or the alias. When debugging keybinds, the non-aliased modifier will always -# be used in output. -# -# Note: The fn or "globe" key on keyboards are not supported as a -# modifier. This is a limitation of the operating systems and GUI toolkits -# that Ghostty uses. -# -# Some additional notes for triggers: -# -# * modifiers cannot repeat, `ctrl+ctrl+a` is invalid. -# -# * modifiers and keys can be in any order, `shift+a+ctrl` is *weird*, -# but valid. -# -# * only a single key input is allowed, `ctrl+a+b` is invalid. -# -# * the key input can be prefixed with `physical:` to specify a -# physical key mapping rather than a logical one. A physical key -# mapping responds to the hardware keycode and not the keycode -# translated by any system keyboard layouts. Example: "ctrl+physical:a" -# -# You may also specify multiple triggers separated by `>` to require a -# sequence of triggers to activate the action. For example, -# `ctrl+a>n=new_window` will only trigger the `new_window` action if the -# user presses `ctrl+a` followed separately by `n`. In other software, this -# is sometimes called a leader key, a key chord, a key table, etc. There -# is no hardcoded limit on the number of parts in a sequence. -# -# Warning: If you define a sequence as a CLI argument to `ghostty`, -# you probably have to quote the keybind since `>` is a special character -# in most shells. Example: ghostty --keybind='ctrl+a>n=new_window' -# -# A trigger sequence has some special handling: -# -# * Ghostty will wait an indefinite amount of time for the next key in -# the sequence. There is no way to specify a timeout. The only way to -# force the output of a prefix key is to assign another keybind to -# specifically output that key (e.g. `ctrl+a>ctrl+a=text:foo`) or -# press an unbound key which will send both keys to the program. -# -# * If a prefix in a sequence is previously bound, the sequence will -# override the previous binding. For example, if `ctrl+a` is bound to -# `new_window` and `ctrl+a>n` is bound to `new_tab`, pressing `ctrl+a` -# will do nothing. -# -# * Adding to the above, if a previously bound sequence prefix is -# used in a new, non-sequence binding, the entire previously bound -# sequence will be unbound. For example, if you bind `ctrl+a>n` and -# `ctrl+a>t`, and then bind `ctrl+a` directly, both `ctrl+a>n` and -# `ctrl+a>t` will become unbound. -# -# * Trigger sequences are not allowed for `global:` or `all:`-prefixed -# triggers. This is a limitation we could remove in the future. -# -# Action is the action to take when the trigger is satisfied. It takes the -# format `action` or `action:param`. The latter form is only valid if the -# action requires a parameter. -# -# * `ignore` - Do nothing, ignore the key input. This can be used to -# black hole certain inputs to have no effect. -# -# * `unbind` - Remove the binding. This makes it so the previous action -# is removed, and the key will be sent through to the child command -# if it is printable. Unbind will remove any matching trigger, -# including `physical:`-prefixed triggers without specifying the -# prefix. -# -# * `csi:text` - Send a CSI sequence. e.g. `csi:A` sends "cursor up". -# -# * `esc:text` - Send an escape sequence. e.g. `esc:d` deletes to the -# end of the word to the right. -# -# * `text:text` - Send a string. Uses Zig string literal syntax. -# e.g. `text:\x15` sends Ctrl-U. -# -# * All other actions can be found in the documentation or by using the -# `ghostty +list-actions` command. -# -# Some notes for the action: -# -# * The parameter is taken as-is after the `:`. Double quotes or -# other mechanisms are included and NOT parsed. If you want to -# send a string value that includes spaces, wrap the entire -# trigger/action in double quotes. Example: `--keybind="up=csi:A B"` -# -# There are some additional special values that can be specified for -# keybind: -# -# * `keybind=clear` will clear all set keybindings. Warning: this -# removes ALL keybindings up to this point, including the default -# keybindings. -# -# The keybind trigger can be prefixed with some special values to change -# the behavior of the keybind. These are: -# -# * `all:` - Make the keybind apply to all terminal surfaces. By default, -# keybinds only apply to the focused terminal surface. If this is true, -# then the keybind will be sent to all terminal surfaces. This only -# applies to actions that are surface-specific. For actions that -# are already global (e.g. `quit`), this prefix has no effect. -# -# * `global:` - Make the keybind global. By default, keybinds only work -# within Ghostty and under the right conditions (application focused, -# sometimes terminal focused, etc.). If you want a keybind to work -# globally across your system (e.g. even when Ghostty is not focused), -# specify this prefix. This prefix implies `all:`. Note: this does not -# work in all environments; see the additional notes below for more -# information. -# -# * `unconsumed:` - Do not consume the input. By default, a keybind -# will consume the input, meaning that the associated encoding (if -# any) will not be sent to the running program in the terminal. If -# you wish to send the encoded value to the program, specify the -# `unconsumed:` prefix before the entire keybind. For example: -# `unconsumed:ctrl+a=reload_config`. `global:` and `all:`-prefixed -# keybinds will always consume the input regardless of this setting. -# Since they are not associated with a specific terminal surface, -# they're never encoded. -# -# * `performable:` - Only consume the input if the action is able to be -# performed. For example, the `copy_to_clipboard` action will only -# consume the input if there is a selection to copy. If there is no -# selection, Ghostty behaves as if the keybind was not set. This has -# no effect with `global:` or `all:`-prefixed keybinds. For key -# sequences, this will reset the sequence if the action is not -# performable (acting identically to not having a keybind set at -# all). -# -# Performable keybinds will not appear as menu shortcuts in the -# application menu. This is because the menu shortcuts force the -# action to be performed regardless of the state of the terminal. -# Performable keybinds will still work, they just won't appear as -# a shortcut label in the menu. -# -# Keybind triggers are not unique per prefix combination. For example, -# `ctrl+a` and `global:ctrl+a` are not two separate keybinds. The keybind -# set later will overwrite the keybind set earlier. In this case, the -# `global:` keybind will be used. -# -# Multiple prefixes can be specified. For example, -# `global:unconsumed:ctrl+a=reload_config` will make the keybind global -# and not consume the input to reload the config. -# -# Note: `global:` is only supported on macOS. On macOS, -# this feature requires accessibility permissions to be granted to Ghostty. -# When a `global:` keybind is specified and Ghostty is launched or reloaded, -# Ghostty will attempt to request these permissions. If the permissions are -# not granted, the keybind will not work. On macOS, you can find these -# permissions in System Preferences -> Privacy & Security -> Accessibility. +# Keybinds keybind = alt+f4=ignore keybind = alt+one=unbind keybind = alt+two=unbind @@ -1046,1208 +85,3 @@ keybind = super+ctrl+shift+left=ignore keybind = super+ctrl+shift+right=ignore keybind = super+ctrl+shift+up=ignore -# Horizontal window padding. This applies padding between the terminal cells -# and the left and right window borders. The value is in points, meaning that -# it will be scaled appropriately for screen DPI. -# -# If this value is set too large, the screen will render nothing, because the -# grid will be completely squished by the padding. It is up to you as the user -# to pick a reasonable value. If you pick an unreasonable value, a warning -# will appear in the logs. -# -# Changing this configuration at runtime will only affect new terminals, i.e. -# new windows, tabs, etc. -# -# To set a different left and right padding, specify two numerical values -# separated by a comma. For example, `window-padding-x = 2,4` will set the -# left padding to 2 and the right padding to 4. If you want to set both -# paddings to the same value, you can use a single value. For example, -# `window-padding-x = 2` will set both paddings to 2. -window-padding-x = 2 - -# Vertical window padding. This applies padding between the terminal cells and -# the top and bottom window borders. The value is in points, meaning that it -# will be scaled appropriately for screen DPI. -# -# If this value is set too large, the screen will render nothing, because the -# grid will be completely squished by the padding. It is up to you as the user -# to pick a reasonable value. If you pick an unreasonable value, a warning -# will appear in the logs. -# -# Changing this configuration at runtime will only affect new terminals, -# i.e. new windows, tabs, etc. -# -# To set a different top and bottom padding, specify two numerical values -# separated by a comma. For example, `window-padding-y = 2,4` will set the -# top padding to 2 and the bottom padding to 4. If you want to set both -# paddings to the same value, you can use a single value. For example, -# `window-padding-y = 2` will set both paddings to 2. -window-padding-y = 2 - -# The viewport dimensions are usually not perfectly divisible by the cell -# size. In this case, some extra padding on the end of a column and the bottom -# of the final row may exist. If this is `true`, then this extra padding -# is automatically balanced between all four edges to minimize imbalance on -# one side. If this is `false`, the top left grid cell will always hug the -# edge with zero padding other than what may be specified with the other -# `window-padding` options. -# -# If other `window-padding` fields are set and this is `true`, this will still -# apply. The other padding is applied first and may affect how many grid cells -# actually exist, and this is applied last in order to balance the padding -# given a certain viewport size and grid cell size. -window-padding-balance = false - -# The color of the padding area of the window. Valid values are: -# -# * `background` - The background color specified in `background`. -# * `extend` - Extend the background color of the nearest grid cell. -# * `extend-always` - Same as "extend" but always extends without applying -# any of the heuristics that disable extending noted below. -# -# The "extend" value will be disabled in certain scenarios. On primary -# screen applications (e.g. not something like Neovim), the color will not -# be extended vertically if any of the following are true: -# -# * The nearest row has any cells that have the default background color. -# The thinking is that in this case, the default background color looks -# fine as a padding color. -# * The nearest row is a prompt row (requires shell integration). The -# thinking here is that prompts often contain powerline glyphs that -# do not look good extended. -# * The nearest row contains a perfect fit powerline character. These -# don't look good extended. -# -window-padding-color = background - -# Synchronize rendering with the screen refresh rate. If true, this will -# minimize tearing and align redraws with the screen but may cause input -# latency. If false, this will maximize redraw frequency but may cause tearing, -# and under heavy load may use more CPU and power. -# -# This defaults to true because out-of-sync rendering on macOS can -# cause kernel panics (macOS 14.4+) and performance issues for external -# displays over some hardware such as DisplayLink. If you want to minimize -# input latency, set this to false with the known aforementioned risks. -# -# Changing this value at runtime will only affect new terminals. -# -# This setting is only supported currently on macOS. -window-vsync = true - -# If true, new windows and tabs will inherit the working directory of the -# previously focused window. If no window was previously focused, the default -# working directory will be used (the `working-directory` option). -window-inherit-working-directory = true - -# If true, new windows and tabs will inherit the font size of the previously -# focused window. If no window was previously focused, the default font size -# will be used. If this is false, the default font size specified in the -# configuration `font-size` will be used. -window-inherit-font-size = true - -# Configure a preference for window decorations. This setting specifies -# a _preference_; the actual OS, desktop environment, window manager, etc. -# may override this preference. Ghostty will do its best to respect this -# preference but it may not always be possible. -# -# Valid values: -# -# * `none` - All window decorations will be disabled. Titlebar, -# borders, etc. will not be shown. On macOS, this will also disable -# tabs (enforced by the system). -# -# * `auto` - Automatically decide to use either client-side or server-side -# decorations based on the detected preferences of the current OS and -# desktop environment. This option usually makes Ghostty look the most -# "native" for your desktop. -# -# * `client` - Prefer client-side decorations. -# -# * `server` - Prefer server-side decorations. This is only relevant -# on Linux with GTK. This currently only works on Linux with Wayland -# and the `org_kde_kwin_server_decoration` protocol available (e.g. -# KDE Plasma, but almost any non-GNOME desktop supports this protocol). -# -# If `server` is set but the environment doesn't support server-side -# decorations, client-side decorations will be used instead. -# -# The default value is `auto`. -# -# For the sake of backwards compatibility and convenience, this setting also -# accepts boolean true and false values. If set to `true`, this is equivalent -# to `auto`. If set to `false`, this is equivalent to `none`. -# This is convenient for users who live primarily on systems that don't -# differentiate between client and server-side decorations (e.g. macOS and -# Windows). -# -# The "toggle_window_decorations" keybind action can be used to create -# a keybinding to toggle this setting at runtime. This will always toggle -# back to "auto" if the current value is "none" (this is an issue -# that will be fixed in the future). -# -# Changing this configuration in your configuration and reloading will -# only affect new windows. Existing windows will not be affected. -# -# macOS: To hide the titlebar without removing the native window borders -# or rounded corners, use `macos-titlebar-style = hidden` instead. -window-decoration = auto - -# The font that will be used for the application's window and tab titles. -# -# If this setting is left unset, the system default font will be used. -# -# Note: any font available on the system may be used, this font is not -# required to be a fixed-width font. -window-title-font-family = - -# The text that will be displayed in the subtitle of the window. Valid values: -# -# * `false` - Disable the subtitle. -# * `working-directory` - Set the subtitle to the working directory of the -# surface. -# -# This feature is only supported on GTK with Adwaita enabled. -window-subtitle = false - -# The theme to use for the windows. Valid values: -# -# * `auto` - Determine the theme based on the configured terminal -# background color. This has no effect if the "theme" configuration -# has separate light and dark themes. In that case, the behavior -# of "auto" is equivalent to "system". -# * `system` - Use the system theme. -# * `light` - Use the light theme regardless of system theme. -# * `dark` - Use the dark theme regardless of system theme. -# * `ghostty` - Use the background and foreground colors specified in the -# Ghostty configuration. This is only supported on Linux builds with -# Adwaita and `gtk-adwaita` enabled. -# -# On macOS, if `macos-titlebar-style` is "tabs", the window theme will be -# automatically set based on the luminosity of the terminal background color. -# This only applies to terminal windows. This setting will still apply to -# non-terminal windows within Ghostty. -# -# This is currently only supported on macOS and Linux. -window-theme = auto - -# The color space to use when interpreting terminal colors. "Terminal colors" -# refers to colors specified in your configuration and colors produced by -# direct-color SGR sequences. -# -# Valid values: -# -# * `srgb` - Interpret colors in the sRGB color space. This is the default. -# * `display-p3` - Interpret colors in the Display P3 color space. -# -# This setting is currently only supported on macOS. -window-colorspace = srgb - -# The initial window size. This size is in terminal grid cells by default. -# Both values must be set to take effect. If only one value is set, it is -# ignored. -# -# We don't currently support specifying a size in pixels but a future change -# can enable that. If this isn't specified, the app runtime will determine -# some default size. -# -# Note that the window manager may put limits on the size or override the -# size. For example, a tiling window manager may force the window to be a -# certain size to fit within the grid. There is nothing Ghostty will do about -# this, but it will make an effort. -# -# Sizes larger than the screen size will be clamped to the screen size. -# This can be used to create a maximized-by-default window size. -# -# This will not affect new tabs, splits, or other nested terminal elements. -# This only affects the initial window size of any new window. Changing this -# value will not affect the size of the window after it has been created. This -# is only used for the initial size. -# -# BUG: On Linux with GTK, the calculated window size will not properly take -# into account window decorations. As a result, the grid dimensions will not -# exactly match this configuration. If window decorations are disabled (see -# `window-decoration`), then this will work as expected. -# -# Windows smaller than 10 wide by 4 high are not allowed. -window-height = 0 - -window-width = 0 -# The starting window position. This position is in pixels and is relative -# to the top-left corner of the primary monitor. Both values must be set to take -# effect. If only one value is set, it is ignored. -# -# Note that the window manager may put limits on the position or override -# the position. For example, a tiling window manager may force the window -# to be a certain position to fit within the grid. There is nothing Ghostty -# will do about this, but it will make an effort. -# -# Also note that negative values are also up to the operating system and -# window manager. Some window managers may not allow windows to be placed -# off-screen. -# -# Invalid positions are runtime-specific, but generally the positions are -# clamped to the nearest valid position. -# -# On macOS, the window position is relative to the top-left corner of -# the visible screen area. This means that if the menu bar is visible, the -# window will be placed below the menu bar. -# -# Note: this is only supported on macOS and Linux GLFW builds. The GTK -# runtime does not support setting the window position (this is a limitation -# of GTK 4.0). -window-position-x = - -window-position-y = -# Whether to enable saving and restoring window state. Window state includes -# their position, size, tabs, splits, etc. Some window state requires shell -# integration, such as preserving working directories. See `shell-integration` -# for more information. -# -# There are three valid values for this configuration: -# -# * `default` will use the default system behavior. On macOS, this -# will only save state if the application is forcibly terminated -# or if it is configured systemwide via Settings.app. -# -# * `never` will never save window state. -# -# * `always` will always save window state whenever Ghostty is exited. -# -# If you change this value to `never` while Ghostty is not running, the next -# Ghostty launch will NOT restore the window state. -# -# If you change this value to `default` while Ghostty is not running and the -# previous exit saved state, the next Ghostty launch will still restore the -# window state. This is because Ghostty cannot know if the previous exit was -# due to a forced save or not (macOS doesn't provide this information). -# -# If you change this value so that window state is saved while Ghostty is not -# running, the previous window state will not be restored because Ghostty only -# saves state on exit if this is enabled. -# -# The default value is `default`. -# -# This is currently only supported on macOS. This has no effect on Linux. -window-save-state = default - -# Resize the window in discrete increments of the focused surface's cell size. -# If this is disabled, surfaces are resized in pixel increments. Currently -# only supported on macOS. -window-step-resize = false - -# The position where new tabs are created. Valid values: -# -# * `current` - Insert the new tab after the currently focused tab, -# or at the end if there are no focused tabs. -# -# * `end` - Insert the new tab at the end of the tab list. -window-new-tab-position = current - -# Background color for the window titlebar. This only takes effect if -# window-theme is set to ghostty. Currently only supported in the GTK app -# runtime. -# -# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. -window-titlebar-background = - -# Foreground color for the window titlebar. This only takes effect if -# window-theme is set to ghostty. Currently only supported in the GTK app -# runtime. -# -# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. -window-titlebar-foreground = - -# This controls when resize overlays are shown. Resize overlays are a -# transient popup that shows the size of the terminal while the surfaces are -# being resized. The possible options are: -# -# * `always` - Always show resize overlays. -# * `never` - Never show resize overlays. -# * `after-first` - The resize overlay will not appear when the surface -# is first created, but will show up if the surface is -# subsequently resized. -# -# The default is `after-first`. -resize-overlay = after-first - -# If resize overlays are enabled, this controls the position of the overlay. -# The possible options are: -# -# * `center` -# * `top-left` -# * `top-center` -# * `top-right` -# * `bottom-left` -# * `bottom-center` -# * `bottom-right` -# -# The default is `center`. -resize-overlay-position = center - -# If resize overlays are enabled, this controls how long the overlay is -# visible on the screen before it is hidden. The default is ¾ of a second or -# 750 ms. -# -# The duration is specified as a series of numbers followed by time units. -# Whitespace is allowed between numbers and units. Each number and unit will -# be added together to form the total duration. -# -# The allowed time units are as follows: -# -# * `y` - 365 SI days, or 8760 hours, or 31536000 seconds. No adjustments -# are made for leap years or leap seconds. -# * `d` - one SI day, or 86400 seconds. -# * `h` - one hour, or 3600 seconds. -# * `m` - one minute, or 60 seconds. -# * `s` - one second. -# * `ms` - one millisecond, or 0.001 second. -# * `us` or `µs` - one microsecond, or 0.000001 second. -# * `ns` - one nanosecond, or 0.000000001 second. -# -# Examples: -# * `1h30m` -# * `45s` -# -# Units can be repeated and will be added together. This means that -# `1h1h` is equivalent to `2h`. This is confusing and should be avoided. -# A future update may disallow this. -# -# The maximum value is `584y 49w 23h 34m 33s 709ms 551µs 615ns`. Any -# value larger than this will be clamped to the maximum value. -resize-overlay-duration = 750ms - -# If true, when there are multiple split panes, the mouse selects the pane -# that is focused. This only applies to the currently focused window; e.g. -# mousing over a split in an unfocused window will not focus that split -# and bring the window to front. -# -# Default is false. -focus-follows-mouse = false - -# Whether to allow programs running in the terminal to read/write to the -# system clipboard (OSC 52, for googling). The default is to allow clipboard -# reading after prompting the user and allow writing unconditionally. -# -# Valid values are: -# -# * `ask` -# * `allow` -# * `deny` -# -clipboard-read = ask - -clipboard-write = allow -# Trims trailing whitespace on data that is copied to the clipboard. This does -# not affect data sent to the clipboard via `clipboard-write`. -clipboard-trim-trailing-spaces = true - -# Require confirmation before pasting text that appears unsafe. This helps -# prevent a "copy/paste attack" where a user may accidentally execute unsafe -# commands by pasting text with newlines. -clipboard-paste-protection = true - -# If true, bracketed pastes will be considered safe. By default, bracketed -# pastes are considered safe. "Bracketed" pastes are pastes while the running -# program has bracketed paste mode enabled (a setting set by the running -# program, not the terminal emulator). -clipboard-paste-bracketed-safe = true - -# Enables or disabled title reporting (CSI 21 t). This escape sequence -# allows the running program to query the terminal title. This is a common -# security issue and is disabled by default. -# -# Warning: This can expose sensitive information at best and enable -# arbitrary code execution at worst (with a maliciously crafted title -# and a minor amount of user interaction). -title-report = false - -# The total amount of bytes that can be used for image data (e.g. the Kitty -# image protocol) per terminal screen. The maximum value is 4,294,967,295 -# (4GiB). The default is 320MB. If this is set to zero, then all image -# protocols will be disabled. -# -# This value is separate for primary and alternate screens so the effective -# limit per surface is double. -image-storage-limit = 320000000 - -# Whether to automatically copy selected text to the clipboard. `true` -# will prefer to copy to the selection clipboard, otherwise it will copy to -# the system clipboard. -# -# The value `clipboard` will always copy text to the selection clipboard -# as well as the system clipboard. -# -# Middle-click paste will always use the selection clipboard. Middle-click -# paste is always enabled even if this is `false`. -# -# The default value is true on Linux and macOS. -copy-on-select = true - -# The time in milliseconds between clicks to consider a click a repeat -# (double, triple, etc.) or an entirely new single click. A value of zero will -# use a platform-specific default. The default on macOS is determined by the -# OS settings. On every other platform it is 500ms. -click-repeat-interval = 0 - -# Additional configuration files to read. This configuration can be repeated -# to read multiple configuration files. Configuration files themselves can -# load more configuration files. Paths are relative to the file containing the -# `config-file` directive. For command-line arguments, paths are relative to -# the current working directory. -# -# Prepend a ? character to the file path to suppress errors if the file does -# not exist. If you want to include a file that begins with a literal ? -# character, surround the file path in double quotes ("). -# -# Cycles are not allowed. If a cycle is detected, an error will be logged and -# the configuration file will be ignored. -# -# Configuration files are loaded after the configuration they're defined -# within in the order they're defined. **THIS IS A VERY SUBTLE BUT IMPORTANT -# POINT.** To put it another way: configuration files do not take effect -# until after the entire configuration is loaded. For example, in the -# configuration below: -# -# ``` -# config-file = "foo" -# a = 1 -# ``` -# -# If "foo" contains `a = 2`, the final value of `a` will be 2, because -# `foo` is loaded after the configuration file that configures the -# nested `config-file` value. -config-file = - -# When this is true, the default configuration file paths will be loaded. -# The default configuration file paths are currently only the XDG -# config path ($XDG_CONFIG_HOME/ghostty/config). -# -# If this is false, the default configuration paths will not be loaded. -# This is targeted directly at using Ghostty from the CLI in a way -# that minimizes external effects. -# -# This is a CLI-only configuration. Setting this in a configuration file -# will have no effect. It is not an error, but it will not do anything. -# This configuration can only be set via CLI arguments. -config-default-files = true - -# Confirms that a surface should be closed before closing it. -# -# This defaults to `true`. If set to `false`, surfaces will close without -# any confirmation. This can also be set to `always`, which will always -# confirm closing a surface, even if shell integration says a process isn't -# running. -confirm-close-surface = false - -# Whether or not to quit after the last surface is closed. -# -# This defaults to `false` on macOS since that is standard behavior for -# a macOS application. On Linux, this defaults to `true` since that is -# generally expected behavior. -# -# On Linux, if this is `true`, Ghostty can delay quitting fully until a -# configurable amount of time has passed after the last window is closed. -# See the documentation of `quit-after-last-window-closed-delay`. -quit-after-last-window-closed = true - -# Controls how long Ghostty will stay running after the last open surface has -# been closed. This only has an effect if `quit-after-last-window-closed` is -# also set to `true`. -# -# The minimum value for this configuration is `1s`. Any values lower than -# this will be clamped to `1s`. -# -# The duration is specified as a series of numbers followed by time units. -# Whitespace is allowed between numbers and units. Each number and unit will -# be added together to form the total duration. -# -# The allowed time units are as follows: -# -# * `y` - 365 SI days, or 8760 hours, or 31536000 seconds. No adjustments -# are made for leap years or leap seconds. -# * `d` - one SI day, or 86400 seconds. -# * `h` - one hour, or 3600 seconds. -# * `m` - one minute, or 60 seconds. -# * `s` - one second. -# * `ms` - one millisecond, or 0.001 second. -# * `us` or `µs` - one microsecond, or 0.000001 second. -# * `ns` - one nanosecond, or 0.000000001 second. -# -# Examples: -# * `1h30m` -# * `45s` -# -# Units can be repeated and will be added together. This means that -# `1h1h` is equivalent to `2h`. This is confusing and should be avoided. -# A future update may disallow this. -# -# The maximum value is `584y 49w 23h 34m 33s 709ms 551µs 615ns`. Any -# value larger than this will be clamped to the maximum value. -# -# By default `quit-after-last-window-closed-delay` is unset and -# Ghostty will quit immediately after the last window is closed if -# `quit-after-last-window-closed` is `true`. -# -# Only implemented on Linux. -quit-after-last-window-closed-delay = - -# This controls whether an initial window is created when Ghostty -# is run. Note that if `quit-after-last-window-closed` is `true` and -# `quit-after-last-window-closed-delay` is set, setting `initial-window` to -# `false` will mean that Ghostty will quit after the configured delay if no -# window is ever created. Only implemented on Linux and macOS. -initial-window = true - -# The position of the "quick" terminal window. To learn more about the -# quick terminal, see the documentation for the `toggle_quick_terminal` -# binding action. -# -# Valid values are: -# -# * `top` - Terminal appears at the top of the screen. -# * `bottom` - Terminal appears at the bottom of the screen. -# * `left` - Terminal appears at the left of the screen. -# * `right` - Terminal appears at the right of the screen. -# * `center` - Terminal appears at the center of the screen. -# -# Changing this configuration requires restarting Ghostty completely. -# -# Note: There is no default keybind for toggling the quick terminal. -# To enable this feature, bind the `toggle_quick_terminal` action to a key. -quick-terminal-position = top - -# The screen where the quick terminal should show up. -# -# Valid values are: -# -# * `main` - The screen that the operating system recommends as the main -# screen. On macOS, this is the screen that is currently receiving -# keyboard input. This screen is defined by the operating system and -# not chosen by Ghostty. -# -# * `mouse` - The screen that the mouse is currently hovered over. -# -# * `macos-menu-bar` - The screen that contains the macOS menu bar as -# set in the display settings on macOS. This is a bit confusing because -# every screen on macOS has a menu bar, but this is the screen that -# contains the primary menu bar. -# -# The default value is `main` because this is the recommended screen -# by the operating system. -quick-terminal-screen = main - -# Duration (in seconds) of the quick terminal enter and exit animation. -# Set it to 0 to disable animation completely. This can be changed at -# runtime. -quick-terminal-animation-duration = 0.2 - -# Automatically hide the quick terminal when focus shifts to another window. -# Set it to false for the quick terminal to remain open even when it loses focus. -quick-terminal-autohide = true - -# This configuration option determines the behavior of the quick terminal -# when switching between macOS spaces. macOS spaces are virtual desktops -# that can be manually created or are automatically created when an -# application is in full-screen mode. -# -# Valid values are: -# -# * `move` - When switching to another space, the quick terminal will -# also moved to the current space. -# -# * `remain` - The quick terminal will stay only in the space where it -# was originally opened and will not follow when switching to another -# space. -# -# The default value is `move`. -quick-terminal-space-behavior = move - -# Whether to enable shell integration auto-injection or not. Shell integration -# greatly enhances the terminal experience by enabling a number of features: -# -# * Working directory reporting so new tabs, splits inherit the -# previous terminal's working directory. -# -# * Prompt marking that enables the "jump_to_prompt" keybinding. -# -# * If you're sitting at a prompt, closing a terminal will not ask -# for confirmation. -# -# * Resizing the window with a complex prompt usually paints much -# better. -# -# Allowable values are: -# -# * `none` - Do not do any automatic injection. You can still manually -# configure your shell to enable the integration. -# -# * `detect` - Detect the shell based on the filename. -# -# * `bash`, `elvish`, `fish`, `zsh` - Use this specific shell injection scheme. -# -# The default value is `detect`. -shell-integration = detect - -# Shell integration features to enable. These require our shell integration -# to be loaded, either automatically via shell-integration or manually. -# -# The format of this is a list of features to enable separated by commas. If -# you prefix a feature with `no-` then it is disabled. If you omit a feature, -# its default value is used, so you must explicitly disable features you don't -# want. You can also use `true` or `false` to turn all features on or off. -# -# Available features: -# -# * `cursor` - Set the cursor to a blinking bar at the prompt. -# -# * `sudo` - Set sudo wrapper to preserve terminfo. -# -# * `title` - Set the window title via shell integration. -# -# Example: `cursor`, `no-cursor`, `sudo`, `no-sudo`, `title`, `no-title` -shell-integration-features = cursor,no-sudo,title - -# Sets the reporting format for OSC sequences that request color information. -# Ghostty currently supports OSC 10 (foreground), OSC 11 (background), and -# OSC 4 (256 color palette) queries, and by default the reported values -# are scaled-up RGB values, where each component are 16 bits. This is how -# most terminals report these values. However, some legacy applications may -# require 8-bit, unscaled, components. We also support turning off reporting -# altogether. The components are lowercase hex values. -# -# Allowable values are: -# -# * `none` - OSC 4/10/11 queries receive no reply -# -# * `8-bit` - Color components are return unscaled, e.g. `rr/gg/bb` -# -# * `16-bit` - Color components are returned scaled, e.g. `rrrr/gggg/bbbb` -# -# The default value is `16-bit`. -osc-color-report-format = 16-bit - -# If true, allows the "KAM" mode (ANSI mode 2) to be used within -# the terminal. KAM disables keyboard input at the request of the -# application. This is not a common feature and is not recommended -# to be enabled. This will not be documented further because -# if you know you need KAM, you know. If you don't know if you -# need KAM, you don't need it. -vt-kam-allowed = false - -# Custom shaders to run after the default shaders. This is a file path -# to a GLSL-syntax shader for all platforms. -# -# Warning: Invalid shaders can cause Ghostty to become unusable such as by -# causing the window to be completely black. If this happens, you can -# unset this configuration to disable the shader. -# -# On Linux, this requires OpenGL 4.2. Ghostty typically only requires -# OpenGL 3.3, but custom shaders push that requirement up to 4.2. -# -# The shader API is identical to the Shadertoy API: you specify a `mainImage` -# function and the available uniforms match Shadertoy. The iChannel0 uniform -# is a texture containing the rendered terminal screen. -# -# If the shader fails to compile, the shader will be ignored. Any errors -# related to shader compilation will not show up as configuration errors -# and only show up in the log, since shader compilation happens after -# configuration loading on the dedicated render thread. For interactive -# development, use [shadertoy.com](https://shadertoy.com). -# -# This can be repeated multiple times to load multiple shaders. The shaders -# will be run in the order they are specified. -# -# Changing this value at runtime and reloading the configuration will only -# affect new windows, tabs, and splits. -custom-shader = - -# If `true` (default), the focused terminal surface will run an animation -# loop when custom shaders are used. This uses slightly more CPU (generally -# less than 10%) but allows the shader to animate. This only runs if there -# are custom shaders and the terminal is focused. -# -# If this is set to `false`, the terminal and custom shader will only render -# when the terminal is updated. This is more efficient but the shader will -# not animate. -# -# This can also be set to `always`, which will always run the animation -# loop regardless of whether the terminal is focused or not. The animation -# loop will still only run when custom shaders are used. Note that this -# will use more CPU per terminal surface and can become quite expensive -# depending on the shader and your terminal usage. -# -# This value can be changed at runtime and will affect all currently -# open terminals. -custom-shader-animation = true - -# Control the in-app notifications that Ghostty shows. -# -# On Linux (GTK) with Adwaita, in-app notifications show up as toasts. Toasts -# appear overlaid on top of the terminal window. They are used to show -# information that is not critical but may be important. -# -# Possible notifications are: -# -# - `clipboard-copy` (default: true) - Show a notification when text is copied -# to the clipboard. -# -# To specify a notification to enable, specify the name of the notification. -# To specify a notification to disable, prefix the name with `no-`. For -# example, to disable `clipboard-copy`, set this configuration to -# `no-clipboard-copy`. To enable it, set this configuration to `clipboard-copy`. -# -# Multiple notifications can be enabled or disabled by separating them -# with a comma. -# -# A value of "false" will disable all notifications. A value of "true" will -# enable all notifications. -# -# This configuration only applies to GTK with Adwaita enabled. -app-notifications = clipboard-copy - -# If anything other than false, fullscreen mode on macOS will not use the -# native fullscreen, but make the window fullscreen without animations and -# using a new space. It's faster than the native fullscreen mode since it -# doesn't use animations. -# -# Important: tabs DO NOT WORK in this mode. Non-native fullscreen removes -# the titlebar and macOS native tabs require the titlebar. If you use tabs, -# you should not use this mode. -# -# If you fullscreen a window with tabs, the currently focused tab will -# become fullscreen while the others will remain in a separate window in -# the background. You can switch to that window using normal window-switching -# keybindings such as command+tilde. When you exit fullscreen, the window -# will return to the tabbed state it was in before. -# -# Allowable values are: -# -# * `visible-menu` - Use non-native macOS fullscreen, keep the menu bar visible -# * `true` - Use non-native macOS fullscreen, hide the menu bar -# * `false` - Use native macOS fullscreen -# -# Changing this option at runtime works, but will only apply to the next -# time the window is made fullscreen. If a window is already fullscreen, -# it will retain the previous setting until fullscreen is exited. -macos-non-native-fullscreen = false - -# The style of the macOS titlebar. Available values are: "native", -# "transparent", "tabs", and "hidden". -# -# The "native" style uses the native macOS titlebar with zero customization. -# The titlebar will match your window theme (see `window-theme`). -# -# The "transparent" style is the same as "native" but the titlebar will -# be transparent and allow your window background color to come through. -# This makes a more seamless window appearance but looks a little less -# typical for a macOS application and may not work well with all themes. -# -# The "transparent" style will also update in real-time to dynamic -# changes to the window background color, e.g. via OSC 11. To make this -# more aesthetically pleasing, this only happens if the terminal is -# a window, tab, or split that borders the top of the window. This -# avoids a disjointed appearance where the titlebar color changes -# but all the topmost terminals don't match. -# -# The "tabs" style is a completely custom titlebar that integrates the -# tab bar into the titlebar. This titlebar always matches the background -# color of the terminal. There are some limitations to this style: -# On macOS 13 and below, saved window state will not restore tabs correctly. -# macOS 14 does not have this issue and any other macOS version has not -# been tested. -# -# The "hidden" style hides the titlebar. Unlike `window-decoration = false`, -# however, it does not remove the frame from the window or cause it to have -# squared corners. Changing to or from this option at run-time may affect -# existing windows in buggy ways. -# -# When "hidden", the top titlebar area can no longer be used for dragging -# the window. To drag the window, you can use option+click on the resizable -# areas of the frame to drag the window. This is a standard macOS behavior -# and not something Ghostty enables. -# -# The default value is "transparent". This is an opinionated choice -# but its one I think is the most aesthetically pleasing and works in -# most cases. -# -# Changing this option at runtime only applies to new windows. -macos-titlebar-style = transparent - -# Whether the proxy icon in the macOS titlebar is visible. The proxy icon -# is the icon that represents the folder of the current working directory. -# You can see this very clearly in the macOS built-in Terminal.app -# titlebar. -# -# The proxy icon is only visible with the native macOS titlebar style. -# -# Valid values are: -# -# * `visible` - Show the proxy icon. -# * `hidden` - Hide the proxy icon. -# -# The default value is `visible`. -# -# This setting can be changed at runtime and will affect all currently -# open windows but only after their working directory changes again. -# Therefore, to make this work after changing the setting, you must -# usually `cd` to a different directory, open a different file in an -# editor, etc. -macos-titlebar-proxy-icon = visible - -# macOS doesn't have a distinct "alt" key and instead has the "option" -# key which behaves slightly differently. On macOS by default, the -# option key plus a character will sometimes produces a Unicode character. -# For example, on US standard layouts option-b produces "∫". This may be -# undesirable if you want to use "option" as an "alt" key for keybindings -# in terminal programs or shells. -# -# This configuration lets you change the behavior so that option is treated -# as alt. -# -# The default behavior (unset) will depend on your active keyboard -# layout. If your keyboard layout is one of the keyboard layouts listed -# below, then the default value is "true". Otherwise, the default -# value is "false". Keyboard layouts with a default value of "true" are: -# -# - U.S. Standard -# - U.S. International -# -# Note that if an *Option*-sequence doesn't produce a printable character, it -# will be treated as *Alt* regardless of this setting. (e.g. `alt+ctrl+a`). -# -# Explicit values that can be set: -# -# If `true`, the *Option* key will be treated as *Alt*. This makes terminal -# sequences expecting *Alt* to work properly, but will break Unicode input -# sequences on macOS if you use them via the *Alt* key. -# -# You may set this to `false` to restore the macOS *Alt* key unicode -# sequences but this will break terminal sequences expecting *Alt* to work. -# -# The values `left` or `right` enable this for the left or right *Option* -# key, respectively. -# -# This does not work with GLFW builds. -macos-option-as-alt = - -# Whether to enable the macOS window shadow. The default value is true. -# With some window managers and window transparency settings, you may -# find false more visually appealing. -macos-window-shadow = true - -# If true, Ghostty on macOS will automatically enable the "Secure Input" -# feature when it detects that a password prompt is being displayed. -# -# "Secure Input" is a macOS security feature that prevents applications from -# reading keyboard events. This can always be enabled manually using the -# `Ghostty > Secure Keyboard Entry` menu item. -# -# Note that automatic password prompt detection is based on heuristics -# and may not always work as expected. Specifically, it does not work -# over SSH connections, but there may be other cases where it also -# doesn't work. -# -# A reason to disable this feature is if you find that it is interfering -# with legitimate accessibility software (or software that uses the -# accessibility APIs), since secure input prevents any application from -# reading keyboard events. -macos-auto-secure-input = true - -# If true, Ghostty will show a graphical indication when secure input is -# enabled. This indication is generally recommended to know when secure input -# is enabled. -# -# Normally, secure input is only active when a password prompt is displayed -# or it is manually (and typically temporarily) enabled. However, if you -# always have secure input enabled, the indication can be distracting and -# you may want to disable it. -macos-secure-input-indication = true - -# Customize the macOS app icon. -# -# This only affects the icon that appears in the dock, application -# switcher, etc. This does not affect the icon in Finder because -# that is controlled by a hardcoded value in the signed application -# bundle and can't be changed at runtime. For more details on what -# exactly is affected, see the `NSApplication.icon` Apple documentation; -# that is the API that is being used to set the icon. -# -# Valid values: -# -# * `official` - Use the official Ghostty icon. -# * `custom-style` - Use the official Ghostty icon but with custom -# styles applied to various layers. The custom styles must be -# specified using the additional `macos-icon`-prefixed configurations. -# The `macos-icon-ghost-color` and `macos-icon-screen-color` -# configurations are required for this style. -# -# WARNING: The `custom-style` option is _experimental_. We may change -# the format of the custom styles in the future. We're still finalizing -# the exact layers and customization options that will be available. -# -# Other caveats: -# -# * The icon in the update dialog will always be the official icon. -# This is because the update dialog is managed through a -# separate framework and cannot be customized without significant -# effort. -# -macos-icon = official - -# The material to use for the frame of the macOS app icon. -# -# Valid values: -# -# * `aluminum` - A brushed aluminum frame. This is the default. -# * `beige` - A classic 90's computer beige frame. -# * `plastic` - A glossy, dark plastic frame. -# * `chrome` - A shiny chrome frame. -# -# This only has an effect when `macos-icon` is set to `custom-style`. -macos-icon-frame = aluminum - -# The color of the ghost in the macOS app icon. -# -# Note: This configuration is required when `macos-icon` is set to -# `custom-style`. -# -# This only has an effect when `macos-icon` is set to `custom-style`. -# -# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. -macos-icon-ghost-color = - -# The color of the screen in the macOS app icon. -# -# The screen is a gradient so you can specify multiple colors that -# make up the gradient. Comma-separated colors may be specified as -# as either hex (`#RRGGBB` or `RRGGBB`) or as named X11 colors. -# -# Note: This configuration is required when `macos-icon` is set to -# `custom-style`. -# -# This only has an effect when `macos-icon` is set to `custom-style`. -macos-icon-screen-color = - -# Put every surface (tab, split, window) into a dedicated Linux cgroup. -# -# This makes it so that resource management can be done on a per-surface -# granularity. For example, if a shell program is using too much memory, -# only that shell will be killed by the oom monitor instead of the entire -# Ghostty process. Similarly, if a shell program is using too much CPU, -# only that surface will be CPU-throttled. -# -# This will cause startup times to be slower (a hundred milliseconds or so), -# so the default value is "single-instance." In single-instance mode, only -# one instance of Ghostty is running (see gtk-single-instance) so the startup -# time is a one-time cost. Additionally, single instance Ghostty is much -# more likely to have many windows, tabs, etc. so cgroup isolation is a -# big benefit. -# -# This feature requires systemd. If systemd is unavailable, cgroup -# initialization will fail. By default, this will not prevent Ghostty -# from working (see linux-cgroup-hard-fail). -# -# Valid values are: -# -# * `never` - Never use cgroups. -# * `always` - Always use cgroups. -# * `single-instance` - Enable cgroups only for Ghostty instances launched -# as single-instance applications (see gtk-single-instance). -# -linux-cgroup = single-instance - -# Memory limit for any individual terminal process (tab, split, window, -# etc.) in bytes. If this is unset then no memory limit will be set. -# -# Note that this sets the "memory.high" configuration for the memory -# controller, which is a soft limit. You should configure something like -# systemd-oom to handle killing processes that have too much memory -# pressure. -linux-cgroup-memory-limit = - -# Number of processes limit for any individual terminal process (tab, split, -# window, etc.). If this is unset then no limit will be set. -# -# Note that this sets the "pids.max" configuration for the process number -# controller, which is a hard limit. -linux-cgroup-processes-limit = - -# If this is false, then any cgroup initialization (for linux-cgroup) -# will be allowed to fail and the failure is ignored. This is useful if -# you view cgroup isolation as a "nice to have" and not a critical resource -# management feature, because Ghostty startup will not fail if cgroup APIs -# fail. -# -# If this is true, then any cgroup initialization failure will cause -# Ghostty to exit or new surfaces to not be created. -# -# Note: This currently only affects cgroup initialization. Subprocesses -# must always be able to move themselves into an isolated cgroup. -linux-cgroup-hard-fail = false - -# Enable or disable GTK's OpenGL debugging logs. The default is `true` for -# debug builds, `false` for all others. -gtk-opengl-debug = false - -# After GTK 4.14.0, we need to force the GSK renderer to OpenGL as the default -# GSK renderer is broken on some systems. If you would like to override -# that bekavior, set `gtk-gsk-renderer=default` and either use your system's -# default GSK renderer, or set the GSK_RENDERER environment variable to your -# renderer of choice before launching Ghostty. This setting has no effect when -# using versions of GTK earlier than 4.14.0. -gtk-gsk-renderer = opengl - -# If `true`, the Ghostty GTK application will run in single-instance mode: -# each new `ghostty` process launched will result in a new window if there is -# already a running process. -# -# If `false`, each new ghostty process will launch a separate application. -# -# The default value is `desktop` which will default to `true` if Ghostty -# detects that it was launched from the `.desktop` file such as an app -# launcher (like Gnome Shell) or by D-Bus activation. If Ghostty is launched -# from the command line, it will default to `false`. -# -# Note that debug builds of Ghostty have a separate single-instance ID -# so you can test single instance without conflicting with release builds. -gtk-single-instance = desktop - -# When enabled, the full GTK titlebar is displayed instead of your window -# manager's simple titlebar. The behavior of this option will vary with your -# window manager. -# -# This option does nothing when `window-decoration` is false or when running -# under macOS. -# -# Changing this value at runtime and reloading the configuration will only -# affect new windows. -gtk-titlebar = false - -# Determines the side of the screen that the GTK tab bar will stick to. -# Top, bottom, left, right, and hidden are supported. The default is top. -# -# If this option has value `left` or `right` when using Adwaita, it falls -# back to `top`. `hidden`, meaning that tabs don't exist, is not supported -# without using Adwaita, falling back to `top`. -# -# When `hidden` is set and Adwaita is enabled, a tab button displaying the -# number of tabs will appear in the title bar. It has the ability to open a -# tab overview for displaying tabs. Alternatively, you can use the -# `toggle_tab_overview` action in a keybind if your window doesn't have a -# title bar, or you can switch tabs with keybinds. -gtk-tabs-location = top - -# If this is `true`, the titlebar will be hidden when the window is maximized, -# and shown when the titlebar is unmaximized. GTK only. -gtk-titlebar-hide-when-maximized = false - -# Determines the appearance of the top and bottom bars when using the -# Adwaita tab bar. This requires `gtk-adwaita` to be enabled (it is -# by default). -# -# Valid values are: -# -# * `flat` - Top and bottom bars are flat with the terminal window. -# * `raised` - Top and bottom bars cast a shadow on the terminal area. -# * `raised-border` - Similar to `raised` but the shadow is replaced with a -# more subtle border. -# -# Changing this value at runtime will only affect new windows. -adw-toolbar-style = raised - -# If `true` (default), then the Ghostty GTK tabs will be "wide." Wide tabs -# are the new typical Gnome style where tabs fill their available space. -# If you set this to `false` then tabs will only take up space they need, -# which is the old style. -gtk-wide-tabs = true - -# If `true` (default), Ghostty will enable Adwaita theme support. This -# will make `window-theme` work properly and will also allow Ghostty to -# properly respond to system theme changes, light/dark mode changing, etc. -# This requires a GTK4 desktop with a GTK4 theme. -# -# If you are running GTK3 or have a GTK3 theme, you may have to set this -# to false to get your theme picked up properly. Having this set to true -# with GTK3 should not cause any problems, but it may not work exactly as -# expected. -# -# This configuration only has an effect if Ghostty was built with -# Adwaita support. -gtk-adwaita = true - -# Custom CSS files to be loaded. -# -# This configuration can be repeated multiple times to load multiple files. -# Prepend a ? character to the file path to suppress errors if the file does -# not exist. If you want to include a file that begins with a literal ? -# character, surround the file path in double quotes ("). -# The file size limit for a single stylesheet is 5MiB. -gtk-custom-css = - -# If `true` (default), applications running in the terminal can show desktop -# notifications using certain escape sequences such as OSC 9 or OSC 777. -desktop-notifications = true - -# If `true`, the bold text will use the bright color palette. -bold-is-bright = true - -# This will be used to set the `TERM` environment variable. -# HACK: We set this with an `xterm` prefix because vim uses that to enable key -# protocols (specifically this will enable `modifyOtherKeys`), among other -# features. An option exists in vim to modify this: `:set -# keyprotocol=ghostty:kitty`, however a bug in the implementation prevents it -# from working properly. https://github.com/vim/vim/pull/13211 fixes this. -term = xterm-ghostty - -# String to send when we receive `ENQ` (`0x05`) from the command that we are -# running. Defaults to an empty string if not set. -enquiry-response = - -# Control the auto-update functionality of Ghostty. This is only supported -# on macOS currently, since Linux builds are distributed via package -# managers that are not centrally controlled by Ghostty. -# -# Checking or downloading an update does not send any information to -# the project beyond standard network information mandated by the -# underlying protocols. To put it another way: Ghostty doesn't explicitly -# add any tracking to the update process. The update process works by -# downloading information about the latest version and comparing it -# client-side to the current version. -# -# Valid values are: -# -# * `off` - Disable auto-updates. -# * `check` - Check for updates and notify the user if an update is -# available, but do not automatically download or install the update. -# * `download` - Check for updates, automatically download the update, -# notify the user, but do not automatically install the update. -# -# If unset, we defer to Sparkle's default behavior, which respects the -# preference stored in the standard user defaults (`defaults(1)`). -# -# Changing this value at runtime works after a small delay. -auto-update = - -# The release channel to use for auto-updates. -# -# The default value of this matches the release channel of the currently -# running Ghostty version. If you download a pre-release version of Ghostty -# then this will be set to `tip` and you will receive pre-release updates. -# If you download a stable version of Ghostty then this will be set to -# `stable` and you will receive stable updates. -# -# Valid values are: -# -# * `stable` - Stable, tagged releases such as "1.0.0". -# * `tip` - Pre-release versions generated from each commit to the -# main branch. This is the version that was in use during private -# beta testing by thousands of people. It is generally stable but -# will likely have more bugs than the stable channel. -# -# Changing this configuration requires a full restart of -# Ghostty to take effect. -# -# This only works on macOS since only macOS has an auto-update feature. -auto-update-channel = - diff --git a/config/ghostty/default b/config/ghostty/default new file mode 100644 index 00000000..90cfbc9e --- /dev/null +++ b/config/ghostty/default @@ -0,0 +1,2510 @@ +# The font families to use. +# +# You can generate the list of valid values using the CLI: +# +# ghostty +list-fonts +# +# This configuration can be repeated multiple times to specify preferred +# fallback fonts when the requested codepoint is not available in the primary +# font. This is particularly useful for multiple languages, symbolic fonts, +# etc. +# +# Notes on emoji specifically: On macOS, Ghostty by default will always use +# Apple Color Emoji and on Linux will always use Noto Emoji. You can +# override this behavior by specifying a font family here that contains +# emoji glyphs. +# +# The specific styles (bold, italic, bold italic) do not need to be +# explicitly set. If a style is not set, then the regular style (font-family) +# will be searched for stylistic variants. If a stylistic variant is not +# found, Ghostty will use the regular style. This prevents falling back to a +# different font family just to get a style such as bold. This also applies +# if you explicitly specify a font family for a style. For example, if you +# set `font-family-bold = FooBar` and "FooBar" cannot be found, Ghostty will +# use whatever font is set for `font-family` for the bold style. +# +# Finally, some styles may be synthesized if they are not supported. +# For example, if a font does not have an italic style and no alternative +# italic font is specified, Ghostty will synthesize an italic style by +# applying a slant to the regular style. If you want to disable these +# synthesized styles then you can use the `font-style` configurations +# as documented below. +# +# You can disable styles completely by using the `font-style` set of +# configurations. See the documentation for `font-style` for more information. +# +# If you want to overwrite a previous set value rather than append a fallback, +# specify the value as `""` (empty string) to reset the list and then set the +# new values. For example: +# +# font-family = "" +# font-family = "My Favorite Font" +# +# Setting any of these as CLI arguments will automatically clear the +# values set in configuration files so you don't need to specify +# `--font-family=""` before setting a new value. You only need to specify +# this within config files if you want to clear previously set values in +# configuration files or on the CLI if you want to clear values set on the +# CLI. +# +# Changing this configuration at runtime will only affect new terminals, i.e. +# new windows, tabs, etc. +font-family = + +font-family-bold = +font-family-italic = +font-family-bold-italic = +# The named font style to use for each of the requested terminal font styles. +# This looks up the style based on the font style string advertised by the +# font itself. For example, "Iosevka Heavy" has a style of "Heavy". +# +# You can also use these fields to completely disable a font style. If you set +# the value of the configuration below to literal `false` then that font style +# will be disabled. If the running program in the terminal requests a disabled +# font style, the regular font style will be used instead. +# +# These are only valid if its corresponding font-family is also specified. If +# no font-family is specified, then the font-style is ignored unless you're +# disabling the font style. +font-style = default + +font-style-bold = default +font-style-italic = default +font-style-bold-italic = default +# Control whether Ghostty should synthesize a style if the requested style is +# not available in the specified font-family. +# +# Ghostty can synthesize bold, italic, and bold italic styles if the font +# does not have a specific style. For bold, this is done by drawing an +# outline around the glyph of varying thickness. For italic, this is done by +# applying a slant to the glyph. For bold italic, both of these are applied. +# +# Synthetic styles are not perfect and will generally not look as good +# as a font that has the style natively. However, they are useful to +# provide styled text when the font does not have the style. +# +# Set this to "false" or "true" to disable or enable synthetic styles +# completely. You can disable specific styles using "no-bold", "no-italic", +# and "no-bold-italic". You can disable multiple styles by separating them +# with a comma. For example, "no-bold,no-italic". +# +# Available style keys are: `bold`, `italic`, `bold-italic`. +# +# If synthetic styles are disabled, then the regular style will be used +# instead if the requested style is not available. If the font has the +# requested style, then the font will be used as-is since the style is +# not synthetic. +# +# Warning: An easy mistake is to disable `bold` or `italic` but not +# `bold-italic`. Disabling only `bold` or `italic` will NOT disable either +# in the `bold-italic` style. If you want to disable `bold-italic`, you must +# explicitly disable it. You cannot partially disable `bold-italic`. +# +# By default, synthetic styles are enabled. +font-synthetic-style = bold,italic,bold-italic + +# Apply a font feature. To enable multiple font features you can repeat +# this multiple times or use a comma-separated list of feature settings. +# +# The syntax for feature settings is as follows, where `feat` is a feature: +# +# * Enable features with e.g. `feat`, `+feat`, `feat on`, `feat=1`. +# * Disabled features with e.g. `-feat`, `feat off`, `feat=0`. +# * Set a feature value with e.g. `feat=2`, `feat = 3`, `feat 4`. +# * Feature names may be wrapped in quotes, meaning this config should be +# syntactically compatible with the `font-feature-settings` CSS property. +# +# The syntax is fairly loose, but invalid settings will be silently ignored. +# +# The font feature will apply to all fonts rendered by Ghostty. A future +# enhancement will allow targeting specific faces. +# +# To disable programming ligatures, use `-calt` since this is the typical +# feature name for programming ligatures. To look into what font features +# your font has and what they do, use a font inspection tool such as +# [fontdrop.info](https://fontdrop.info). +# +# To generally disable most ligatures, use `-calt, -liga, -dlig`. +font-feature = + +# Font size in points. This value can be a non-integer and the nearest integer +# pixel size will be selected. If you have a high dpi display where 1pt = 2px +# then you can get an odd numbered pixel size by specifying a half point. +# +# For example, 13.5pt @ 2px/pt = 27px +# +# Changing this configuration at runtime will only affect new terminals, +# i.e. new windows, tabs, etc. Note that you may still not see the change +# depending on your `window-inherit-font-size` setting. If that setting is +# true, only the first window will be affected by this change since all +# subsequent windows will inherit the font size of the previous window. +# +# On Linux with GTK, font size is scaled according to both display-wide and +# text-specific scaling factors, which are often managed by your desktop +# environment (e.g. the GNOME display scale and large text settings). +font-size = 12 + +# A repeatable configuration to set one or more font variations values for +# a variable font. A variable font is a single font, usually with a filename +# ending in `-VF.ttf` or `-VF.otf` that contains one or more configurable axes +# for things such as weight, slant, etc. Not all fonts support variations; +# only fonts that explicitly state they are variable fonts will work. +# +# The format of this is `id=value` where `id` is the axis identifier. An axis +# identifier is always a 4 character string, such as `wght`. To get the list +# of supported axes, look at your font documentation or use a font inspection +# tool. +# +# Invalid ids and values are usually ignored. For example, if a font only +# supports weights from 100 to 700, setting `wght=800` will do nothing (it +# will not be clamped to 700). You must consult your font's documentation to +# see what values are supported. +# +# Common axes are: `wght` (weight), `slnt` (slant), `ital` (italic), `opsz` +# (optical size), `wdth` (width), `GRAD` (gradient), etc. +font-variation = + +font-variation-bold = +font-variation-italic = +font-variation-bold-italic = +# Force one or a range of Unicode codepoints to map to a specific named font. +# This is useful if you want to support special symbols or if you want to use +# specific glyphs that render better for your specific font. +# +# The syntax is `codepoint=fontname` where `codepoint` is either a single +# codepoint or a range. Codepoints must be specified as full Unicode +# hex values, such as `U+ABCD`. Codepoints ranges are specified as +# `U+ABCD-U+DEFG`. You can specify multiple ranges for the same font separated +# by commas, such as `U+ABCD-U+DEFG,U+1234-U+5678=fontname`. The font name is +# the same value as you would use for `font-family`. +# +# This configuration can be repeated multiple times to specify multiple +# codepoint mappings. +# +# Changing this configuration at runtime will only affect new terminals, +# i.e. new windows, tabs, etc. +font-codepoint-map = + +# Draw fonts with a thicker stroke, if supported. +# This is currently only supported on macOS. +font-thicken = false + +# Strength of thickening when `font-thicken` is enabled. +# +# Valid values are integers between `0` and `255`. `0` does not correspond to +# *no* thickening, rather it corresponds to the lightest available thickening. +# +# Has no effect when `font-thicken` is set to `false`. +# +# This is currently only supported on macOS. +font-thicken-strength = 255 + +# What color space to use when performing alpha blending. +# +# This affects the appearance of text and of any images with transparency. +# Additionally, custom shaders will receive colors in the configured space. +# +# Valid values: +# +# * `native` - Perform alpha blending in the native color space for the OS. +# On macOS this corresponds to Display P3, and on Linux it's sRGB. +# +# * `linear` - Perform alpha blending in linear space. This will eliminate +# the darkening artifacts around the edges of text that are very visible +# when certain color combinations are used (e.g. red / green), but makes +# dark text look much thinner than normal and light text much thicker. +# This is also sometimes known as "gamma correction". +# (Currently only supported on macOS. Has no effect on Linux.) +# +# * `linear-corrected` - Same as `linear`, but with a correction step applied +# for text that makes it look nearly or completely identical to `native`, +# but without any of the darkening artifacts. +alpha-blending = native + +# All of the configurations behavior adjust various metrics determined by the +# font. The values can be integers (1, -1, etc.) or a percentage (20%, -15%, +# etc.). In each case, the values represent the amount to change the original +# value. +# +# For example, a value of `1` increases the value by 1; it does not set it to +# literally 1. A value of `20%` increases the value by 20%. And so on. +# +# There is little to no validation on these values so the wrong values (e.g. +# `-100%`) can cause the terminal to be unusable. Use with caution and reason. +# +# Some values are clamped to minimum or maximum values. This can make it +# appear that certain values are ignored. For example, many `*-thickness` +# adjustments cannot go below 1px. +# +# `adjust-cell-height` has some additional behaviors to describe: +# +# * The font will be centered vertically in the cell. +# +# * The cursor will remain the same size as the font, but may be +# adjusted separately with `adjust-cursor-height`. +# +# * Powerline glyphs will be adjusted along with the cell height so +# that things like status lines continue to look aligned. +adjust-cell-width = + +adjust-cell-height = +# Distance in pixels or percentage adjustment from the bottom of the cell to the text baseline. +# Increase to move baseline UP, decrease to move baseline DOWN. +# See the notes about adjustments in `adjust-cell-width`. +adjust-font-baseline = + +# Distance in pixels or percentage adjustment from the top of the cell to the top of the underline. +# Increase to move underline DOWN, decrease to move underline UP. +# See the notes about adjustments in `adjust-cell-width`. +adjust-underline-position = + +# Thickness in pixels of the underline. +# See the notes about adjustments in `adjust-cell-width`. +adjust-underline-thickness = + +# Distance in pixels or percentage adjustment from the top of the cell to the top of the strikethrough. +# Increase to move strikethrough DOWN, decrease to move strikethrough UP. +# See the notes about adjustments in `adjust-cell-width`. +adjust-strikethrough-position = + +# Thickness in pixels or percentage adjustment of the strikethrough. +# See the notes about adjustments in `adjust-cell-width`. +adjust-strikethrough-thickness = + +# Distance in pixels or percentage adjustment from the top of the cell to the top of the overline. +# Increase to move overline DOWN, decrease to move overline UP. +# See the notes about adjustments in `adjust-cell-width`. +adjust-overline-position = + +# Thickness in pixels or percentage adjustment of the overline. +# See the notes about adjustments in `adjust-cell-width`. +adjust-overline-thickness = + +# Thickness in pixels or percentage adjustment of the bar cursor and outlined rect cursor. +# See the notes about adjustments in `adjust-cell-width`. +adjust-cursor-thickness = + +# Height in pixels or percentage adjustment of the cursor. Currently applies to all cursor types: +# bar, rect, and outlined rect. +# See the notes about adjustments in `adjust-cell-width`. +adjust-cursor-height = + +# Thickness in pixels or percentage adjustment of box drawing characters. +# See the notes about adjustments in `adjust-cell-width`. +adjust-box-thickness = + +# The method to use for calculating the cell width of a grapheme cluster. +# The default value is `unicode` which uses the Unicode standard to determine +# grapheme width. This results in correct grapheme width but may result in +# cursor-desync issues with some programs (such as shells) that may use a +# legacy method such as `wcswidth`. +# +# Valid values are: +# +# * `legacy` - Use a legacy method to determine grapheme width, such as +# wcswidth This maximizes compatibility with legacy programs but may result +# in incorrect grapheme width for certain graphemes such as skin-tone +# emoji, non-English characters, etc. +# +# This is called "legacy" and not something more specific because the +# behavior is undefined and we want to retain the ability to modify it. +# For example, we may or may not use libc `wcswidth` now or in the future. +# +# * `unicode` - Use the Unicode standard to determine grapheme width. +# +# If a running program explicitly enables terminal mode 2027, then `unicode` +# width will be forced regardless of this configuration. When mode 2027 is +# reset, this configuration will be used again. +# +# This configuration can be changed at runtime but will not affect existing +# terminals. Only new terminals will use the new configuration. +grapheme-width-method = unicode + +# FreeType load flags to enable. The format of this is a list of flags to +# enable separated by commas. If you prefix a flag with `no-` then it is +# disabled. If you omit a flag, its default value is used, so you must +# explicitly disable flags you don't want. You can also use `true` or `false` +# to turn all flags on or off. +# +# This configuration only applies to Ghostty builds that use FreeType. +# This is usually the case only for Linux builds. macOS uses CoreText +# and does not have an equivalent configuration. +# +# Available flags: +# +# * `hinting` - Enable or disable hinting, enabled by default. +# * `force-autohint` - Use the freetype auto-hinter rather than the +# font's native hinter. Enabled by default. +# * `monochrome` - Instructs renderer to use 1-bit monochrome +# rendering. This option doesn't impact the hinter. +# Enabled by default. +# * `autohint` - Use the freetype auto-hinter. Enabled by default. +# +# Example: `hinting`, `no-hinting`, `force-autohint`, `no-force-autohint` +freetype-load-flags = hinting,force-autohint,monochrome,autohint + +# A theme to use. This can be a built-in theme name, a custom theme +# name, or an absolute path to a custom theme file. Ghostty also supports +# specifying a different theme to use for light and dark mode. Each +# option is documented below. +# +# If the theme is an absolute pathname, Ghostty will attempt to load that +# file as a theme. If that file does not exist or is inaccessible, an error +# will be logged and no other directories will be searched. +# +# If the theme is not an absolute pathname, two different directories will be +# searched for a file name that matches the theme. This is case sensitive on +# systems with case-sensitive filesystems. It is an error for a theme name to +# include path separators unless it is an absolute pathname. +# +# The first directory is the `themes` subdirectory of your Ghostty +# configuration directory. This is `$XDG_CONFIG_DIR/ghostty/themes` or +# `~/.config/ghostty/themes`. +# +# The second directory is the `themes` subdirectory of the Ghostty resources +# directory. Ghostty ships with a multitude of themes that will be installed +# into this directory. On macOS, this list is in the +# `Ghostty.app/Contents/Resources/ghostty/themes` directory. On Linux, this +# list is in the `share/ghostty/themes` directory (wherever you installed the +# Ghostty "share" directory. +# +# To see a list of available themes, run `ghostty +list-themes`. +# +# A theme file is simply another Ghostty configuration file. They share +# the same syntax and same configuration options. A theme can set any valid +# configuration option so please do not use a theme file from an untrusted +# source. The built-in themes are audited to only set safe configuration +# options. +# +# Some options cannot be set within theme files. The reason these are not +# supported should be self-evident. A theme file cannot set `theme` or +# `config-file`. At the time of writing this, Ghostty will not show any +# warnings or errors if you set these options in a theme file but they will +# be silently ignored. +# +# Any additional colors specified via background, foreground, palette, etc. +# will override the colors specified in the theme. +# +# To specify a different theme for light and dark mode, use the following +# syntax: `light:theme-name,dark:theme-name`. For example: +# `light:rose-pine-dawn,dark:rose-pine`. Whitespace around all values are +# trimmed and order of light and dark does not matter. Both light and dark +# must be specified in this form. In this form, the theme used will be +# based on the current desktop environment theme. +# +# There are some known bugs with light/dark mode theming. These will +# be fixed in a future update: +# +# - macOS: titlebar tabs style is not updated when switching themes. +# +theme = + +# Background color for the window. +# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. +background = #282c34 + +# Foreground color for the window. +# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. +foreground = #ffffff + +# The foreground and background color for selection. If this is not set, then +# the selection color is just the inverted window background and foreground +# (note: not to be confused with the cell bg/fg). +# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. +selection-foreground = + +selection-background = +# Swap the foreground and background colors of cells for selection. This +# option overrides the `selection-foreground` and `selection-background` +# options. +# +# If you select across cells with differing foregrounds and backgrounds, the +# selection color will vary across the selection. +selection-invert-fg-bg = false + +# The minimum contrast ratio between the foreground and background colors. +# The contrast ratio is a value between 1 and 21. A value of 1 allows for no +# contrast (e.g. black on black). This value is the contrast ratio as defined +# by the [WCAG 2.0 specification](https://www.w3.org/TR/WCAG20/). +# +# If you want to avoid invisible text (same color as background), a value of +# 1.1 is a good value. If you want to avoid text that is difficult to read, a +# value of 3 or higher is a good value. The higher the value, the more likely +# that text will become black or white. +# +# This value does not apply to Emoji or images. +minimum-contrast = 1 + +# Color palette for the 256 color form that many terminal applications use. +# The syntax of this configuration is `N=COLOR` where `N` is 0 to 255 (for +# the 256 colors in the terminal color table) and `COLOR` is a typical RGB +# color code such as `#AABBCC` or `AABBCC`, or a named X11 color. +# +# The palette index can be in decimal, binary, octal, or hexadecimal. +# Decimal is assumed unless a prefix is used: `0b` for binary, `0o` for octal, +# and `0x` for hexadecimal. +# +# For definitions on the color indices and what they canonically map to, +# [see this cheat sheet](https://www.ditig.com/256-colors-cheat-sheet). +palette = 0=#1d1f21 +palette = 1=#cc6666 +palette = 2=#b5bd68 +palette = 3=#f0c674 +palette = 4=#81a2be +palette = 5=#b294bb +palette = 6=#8abeb7 +palette = 7=#c5c8c6 +palette = 8=#666666 +palette = 9=#d54e53 +palette = 10=#b9ca4a +palette = 11=#e7c547 +palette = 12=#7aa6da +palette = 13=#c397d8 +palette = 14=#70c0b1 +palette = 15=#eaeaea +palette = 16=#000000 +palette = 17=#00005f +palette = 18=#000087 +palette = 19=#0000af +palette = 20=#0000d7 +palette = 21=#0000ff +palette = 22=#005f00 +palette = 23=#005f5f +palette = 24=#005f87 +palette = 25=#005faf +palette = 26=#005fd7 +palette = 27=#005fff +palette = 28=#008700 +palette = 29=#00875f +palette = 30=#008787 +palette = 31=#0087af +palette = 32=#0087d7 +palette = 33=#0087ff +palette = 34=#00af00 +palette = 35=#00af5f +palette = 36=#00af87 +palette = 37=#00afaf +palette = 38=#00afd7 +palette = 39=#00afff +palette = 40=#00d700 +palette = 41=#00d75f +palette = 42=#00d787 +palette = 43=#00d7af +palette = 44=#00d7d7 +palette = 45=#00d7ff +palette = 46=#00ff00 +palette = 47=#00ff5f +palette = 48=#00ff87 +palette = 49=#00ffaf +palette = 50=#00ffd7 +palette = 51=#00ffff +palette = 52=#5f0000 +palette = 53=#5f005f +palette = 54=#5f0087 +palette = 55=#5f00af +palette = 56=#5f00d7 +palette = 57=#5f00ff +palette = 58=#5f5f00 +palette = 59=#5f5f5f +palette = 60=#5f5f87 +palette = 61=#5f5faf +palette = 62=#5f5fd7 +palette = 63=#5f5fff +palette = 64=#5f8700 +palette = 65=#5f875f +palette = 66=#5f8787 +palette = 67=#5f87af +palette = 68=#5f87d7 +palette = 69=#5f87ff +palette = 70=#5faf00 +palette = 71=#5faf5f +palette = 72=#5faf87 +palette = 73=#5fafaf +palette = 74=#5fafd7 +palette = 75=#5fafff +palette = 76=#5fd700 +palette = 77=#5fd75f +palette = 78=#5fd787 +palette = 79=#5fd7af +palette = 80=#5fd7d7 +palette = 81=#5fd7ff +palette = 82=#5fff00 +palette = 83=#5fff5f +palette = 84=#5fff87 +palette = 85=#5fffaf +palette = 86=#5fffd7 +palette = 87=#5fffff +palette = 88=#870000 +palette = 89=#87005f +palette = 90=#870087 +palette = 91=#8700af +palette = 92=#8700d7 +palette = 93=#8700ff +palette = 94=#875f00 +palette = 95=#875f5f +palette = 96=#875f87 +palette = 97=#875faf +palette = 98=#875fd7 +palette = 99=#875fff +palette = 100=#878700 +palette = 101=#87875f +palette = 102=#878787 +palette = 103=#8787af +palette = 104=#8787d7 +palette = 105=#8787ff +palette = 106=#87af00 +palette = 107=#87af5f +palette = 108=#87af87 +palette = 109=#87afaf +palette = 110=#87afd7 +palette = 111=#87afff +palette = 112=#87d700 +palette = 113=#87d75f +palette = 114=#87d787 +palette = 115=#87d7af +palette = 116=#87d7d7 +palette = 117=#87d7ff +palette = 118=#87ff00 +palette = 119=#87ff5f +palette = 120=#87ff87 +palette = 121=#87ffaf +palette = 122=#87ffd7 +palette = 123=#87ffff +palette = 124=#af0000 +palette = 125=#af005f +palette = 126=#af0087 +palette = 127=#af00af +palette = 128=#af00d7 +palette = 129=#af00ff +palette = 130=#af5f00 +palette = 131=#af5f5f +palette = 132=#af5f87 +palette = 133=#af5faf +palette = 134=#af5fd7 +palette = 135=#af5fff +palette = 136=#af8700 +palette = 137=#af875f +palette = 138=#af8787 +palette = 139=#af87af +palette = 140=#af87d7 +palette = 141=#af87ff +palette = 142=#afaf00 +palette = 143=#afaf5f +palette = 144=#afaf87 +palette = 145=#afafaf +palette = 146=#afafd7 +palette = 147=#afafff +palette = 148=#afd700 +palette = 149=#afd75f +palette = 150=#afd787 +palette = 151=#afd7af +palette = 152=#afd7d7 +palette = 153=#afd7ff +palette = 154=#afff00 +palette = 155=#afff5f +palette = 156=#afff87 +palette = 157=#afffaf +palette = 158=#afffd7 +palette = 159=#afffff +palette = 160=#d70000 +palette = 161=#d7005f +palette = 162=#d70087 +palette = 163=#d700af +palette = 164=#d700d7 +palette = 165=#d700ff +palette = 166=#d75f00 +palette = 167=#d75f5f +palette = 168=#d75f87 +palette = 169=#d75faf +palette = 170=#d75fd7 +palette = 171=#d75fff +palette = 172=#d78700 +palette = 173=#d7875f +palette = 174=#d78787 +palette = 175=#d787af +palette = 176=#d787d7 +palette = 177=#d787ff +palette = 178=#d7af00 +palette = 179=#d7af5f +palette = 180=#d7af87 +palette = 181=#d7afaf +palette = 182=#d7afd7 +palette = 183=#d7afff +palette = 184=#d7d700 +palette = 185=#d7d75f +palette = 186=#d7d787 +palette = 187=#d7d7af +palette = 188=#d7d7d7 +palette = 189=#d7d7ff +palette = 190=#d7ff00 +palette = 191=#d7ff5f +palette = 192=#d7ff87 +palette = 193=#d7ffaf +palette = 194=#d7ffd7 +palette = 195=#d7ffff +palette = 196=#ff0000 +palette = 197=#ff005f +palette = 198=#ff0087 +palette = 199=#ff00af +palette = 200=#ff00d7 +palette = 201=#ff00ff +palette = 202=#ff5f00 +palette = 203=#ff5f5f +palette = 204=#ff5f87 +palette = 205=#ff5faf +palette = 206=#ff5fd7 +palette = 207=#ff5fff +palette = 208=#ff8700 +palette = 209=#ff875f +palette = 210=#ff8787 +palette = 211=#ff87af +palette = 212=#ff87d7 +palette = 213=#ff87ff +palette = 214=#ffaf00 +palette = 215=#ffaf5f +palette = 216=#ffaf87 +palette = 217=#ffafaf +palette = 218=#ffafd7 +palette = 219=#ffafff +palette = 220=#ffd700 +palette = 221=#ffd75f +palette = 222=#ffd787 +palette = 223=#ffd7af +palette = 224=#ffd7d7 +palette = 225=#ffd7ff +palette = 226=#ffff00 +palette = 227=#ffff5f +palette = 228=#ffff87 +palette = 229=#ffffaf +palette = 230=#ffffd7 +palette = 231=#ffffff +palette = 232=#080808 +palette = 233=#121212 +palette = 234=#1c1c1c +palette = 235=#262626 +palette = 236=#303030 +palette = 237=#3a3a3a +palette = 238=#444444 +palette = 239=#4e4e4e +palette = 240=#585858 +palette = 241=#626262 +palette = 242=#6c6c6c +palette = 243=#767676 +palette = 244=#808080 +palette = 245=#8a8a8a +palette = 246=#949494 +palette = 247=#9e9e9e +palette = 248=#a8a8a8 +palette = 249=#b2b2b2 +palette = 250=#bcbcbc +palette = 251=#c6c6c6 +palette = 252=#d0d0d0 +palette = 253=#dadada +palette = 254=#e4e4e4 +palette = 255=#eeeeee + +# The color of the cursor. If this is not set, a default will be chosen. +# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. +cursor-color = + +# Swap the foreground and background colors of the cell under the cursor. This +# option overrides the `cursor-color` and `cursor-text` options. +cursor-invert-fg-bg = false + +# The opacity level (opposite of transparency) of the cursor. A value of 1 +# is fully opaque and a value of 0 is fully transparent. A value less than 0 +# or greater than 1 will be clamped to the nearest valid value. Note that a +# sufficiently small value such as 0.3 may be effectively invisible and may +# make it difficult to find the cursor. +cursor-opacity = 1 + +# The style of the cursor. This sets the default style. A running program can +# still request an explicit cursor style using escape sequences (such as `CSI +# q`). Shell configurations will often request specific cursor styles. +# +# Note that shell integration will automatically set the cursor to a bar at +# a prompt, regardless of this configuration. You can disable that behavior +# by specifying `shell-integration-features = no-cursor` or disabling shell +# integration entirely. +# +# Valid values are: +# +# * `block` +# * `bar` +# * `underline` +# * `block_hollow` +# +cursor-style = block + +# Sets the default blinking state of the cursor. This is just the default +# state; running programs may override the cursor style using `DECSCUSR` (`CSI +# q`). +# +# If this is not set, the cursor blinks by default. Note that this is not the +# same as a "true" value, as noted below. +# +# If this is not set at all (`null`), then Ghostty will respect DEC Mode 12 +# (AT&T cursor blink) as an alternate approach to turning blinking on/off. If +# this is set to any value other than null, DEC mode 12 will be ignored but +# `DECSCUSR` will still be respected. +# +# Valid values are: +# +# * ` ` (blank) +# * `true` +# * `false` +# +cursor-style-blink = + +# The color of the text under the cursor. If this is not set, a default will +# be chosen. +# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. +cursor-text = + +# Enables the ability to move the cursor at prompts by using `alt+click` on +# Linux and `option+click` on macOS. +# +# This feature requires shell integration (specifically prompt marking +# via `OSC 133`) and only works in primary screen mode. Alternate screen +# applications like vim usually have their own version of this feature but +# this configuration doesn't control that. +# +# It should be noted that this feature works by translating your desired +# position into a series of synthetic arrow key movements, so some weird +# behavior around edge cases are to be expected. This is unfortunately how +# this feature is implemented across terminals because there isn't any other +# way to implement it. +cursor-click-to-move = true + +# Hide the mouse immediately when typing. The mouse becomes visible again +# when the mouse is used (button, movement, etc.). Platform-specific behavior +# may dictate other scenarios where the mouse is shown. For example on macOS, +# the mouse is shown again when a new window, tab, or split is created. +mouse-hide-while-typing = false + +# Determines whether running programs can detect the shift key pressed with a +# mouse click. Typically, the shift key is used to extend mouse selection. +# +# The default value of `false` means that the shift key is not sent with +# the mouse protocol and will extend the selection. This value can be +# conditionally overridden by the running program with the `XTSHIFTESCAPE` +# sequence. +# +# The value `true` means that the shift key is sent with the mouse protocol +# but the running program can override this behavior with `XTSHIFTESCAPE`. +# +# The value `never` is the same as `false` but the running program cannot +# override this behavior with `XTSHIFTESCAPE`. The value `always` is the +# same as `true` but the running program cannot override this behavior with +# `XTSHIFTESCAPE`. +# +# If you always want shift to extend mouse selection even if the program +# requests otherwise, set this to `never`. +# +# Valid values are: +# +# * `true` +# * `false` +# * `always` +# * `never` +# +mouse-shift-capture = false + +# Multiplier for scrolling distance with the mouse wheel. Any value less +# than 0.01 or greater than 10,000 will be clamped to the nearest valid +# value. +# +# A value of "1" (default) scrolls the default amount. A value of "2" scrolls +# double the default amount. A value of "0.5" scrolls half the default amount. +# Et cetera. +mouse-scroll-multiplier = 1 + +# The opacity level (opposite of transparency) of the background. A value of +# 1 is fully opaque and a value of 0 is fully transparent. A value less than 0 +# or greater than 1 will be clamped to the nearest valid value. +# +# On macOS, background opacity is disabled when the terminal enters native +# fullscreen. This is because the background becomes gray and it can cause +# widgets to show through which isn't generally desirable. +# +# On macOS, changing this configuration requires restarting Ghostty completely. +background-opacity = 1 + +# Whether to blur the background when `background-opacity` is less than 1. +# +# Valid values are: +# +# * a nonnegative integer specifying the *blur intensity* +# * `false`, equivalent to a blur intensity of 0 +# * `true`, equivalent to the default blur intensity of 20, which is +# reasonable for a good looking blur. Higher blur intensities may +# cause strange rendering and performance issues. +# +# Supported on macOS and on some Linux desktop environments, including: +# +# * KDE Plasma (Wayland and X11) +# +# Warning: the exact blur intensity is _ignored_ under KDE Plasma, and setting +# this setting to either `true` or any positive blur intensity value would +# achieve the same effect. The reason is that KWin, the window compositor +# powering Plasma, only has one global blur setting and does not allow +# applications to specify individual blur settings. +# +# To configure KWin's global blur setting, open System Settings and go to +# "Apps & Windows" > "Window Management" > "Desktop Effects" and select the +# "Blur" plugin. If disabled, enable it by ticking the checkbox to the left. +# Then click on the "Configure" button and there will be two sliders that +# allow you to set background blur and noise intensities for all apps, +# including Ghostty. +# +# All other Linux desktop environments are as of now unsupported. Users may +# need to set environment-specific settings and/or install third-party plugins +# in order to support background blur, as there isn't a unified interface for +# doing so. +background-blur = false + +# The opacity level (opposite of transparency) of an unfocused split. +# Unfocused splits by default are slightly faded out to make it easier to see +# which split is focused. To disable this feature, set this value to 1. +# +# A value of 1 is fully opaque and a value of 0 is fully transparent. Because +# "0" is not useful (it makes the window look very weird), the minimum value +# is 0.15. This value still looks weird but you can at least see what's going +# on. A value outside of the range 0.15 to 1 will be clamped to the nearest +# valid value. +unfocused-split-opacity = 0.7 + +# The color to dim the unfocused split. Unfocused splits are dimmed by +# rendering a semi-transparent rectangle over the split. This sets the color of +# that rectangle and can be used to carefully control the dimming effect. +# +# This will default to the background color. +# +# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. +unfocused-split-fill = + +# The color of the split divider. If this is not set, a default will be chosen. +# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. +split-divider-color = + +# The command to run, usually a shell. If this is not an absolute path, it'll +# be looked up in the `PATH`. If this is not set, a default will be looked up +# from your system. The rules for the default lookup are: +# +# * `SHELL` environment variable +# +# * `passwd` entry (user information) +# +# This can contain additional arguments to run the command with. If additional +# arguments are provided, the command will be executed using `/bin/sh -c`. +# Ghostty does not do any shell command parsing. +# +# This command will be used for all new terminal surfaces, i.e. new windows, +# tabs, etc. If you want to run a command only for the first terminal surface +# created when Ghostty starts, use the `initial-command` configuration. +# +# Ghostty supports the common `-e` flag for executing a command with +# arguments. For example, `ghostty -e fish --with --custom --args`. +# This flag sets the `initial-command` configuration, see that for more +# information. +command = + +# This is the same as "command", but only applies to the first terminal +# surface created when Ghostty starts. Subsequent terminal surfaces will use +# the `command` configuration. +# +# After the first terminal surface is created (or closed), there is no +# way to run this initial command again automatically. As such, setting +# this at runtime works but will only affect the next terminal surface +# if it is the first one ever created. +# +# If you're using the `ghostty` CLI there is also a shortcut to set this +# with arguments directly: you can use the `-e` flag. For example: `ghostty -e +# fish --with --custom --args`. The `-e` flag automatically forces some +# other behaviors as well: +# +# * `gtk-single-instance=false` - This ensures that a new instance is +# launched and the CLI args are respected. +# +# * `quit-after-last-window-closed=true` - This ensures that the Ghostty +# process will exit when the command exits. Additionally, the +# `quit-after-last-window-closed-delay` is unset. +# +# * `shell-integration=detect` (if not `none`) - This prevents forcibly +# injecting any configured shell integration into the command's +# environment. With `-e` its highly unlikely that you're executing a +# shell and forced shell integration is likely to cause problems +# (e.g. by wrapping your command in a shell, setting env vars, etc.). +# This is a safety measure to prevent unexpected behavior. If you want +# shell integration with a `-e`-executed command, you must either +# name your binary appropriately or source the shell integration script +# manually. +# +initial-command = + +# If true, keep the terminal open after the command exits. Normally, the +# terminal window closes when the running command (such as a shell) exits. +# With this true, the terminal window will stay open until any keypress is +# received. +# +# This is primarily useful for scripts or debugging. +wait-after-command = false + +# The number of milliseconds of runtime below which we consider a process exit +# to be abnormal. This is used to show an error message when the process exits +# too quickly. +# +# On Linux, this must be paired with a non-zero exit code. On macOS, we allow +# any exit code because of the way shell processes are launched via the login +# command. +abnormal-command-exit-runtime = 250 + +# The size of the scrollback buffer in bytes. This also includes the active +# screen. No matter what this is set to, enough memory will always be +# allocated for the visible screen and anything leftover is the limit for +# the scrollback. +# +# When this limit is reached, the oldest lines are removed from the +# scrollback. +# +# Scrollback currently exists completely in memory. This means that the +# larger this value, the larger potential memory usage. Scrollback is +# allocated lazily up to this limit, so if you set this to a very large +# value, it will not immediately consume a lot of memory. +# +# This size is per terminal surface, not for the entire application. +# +# It is not currently possible to set an unlimited scrollback buffer. +# This is a future planned feature. +# +# This can be changed at runtime but will only affect new terminal surfaces. +scrollback-limit = 10000000 + +# Match a regular expression against the terminal text and associate clicking +# it with an action. This can be used to match URLs, file paths, etc. Actions +# can be opening using the system opener (e.g. `open` or `xdg-open`) or +# executing any arbitrary binding action. +# +# Links that are configured earlier take precedence over links that are +# configured later. +# +# A default link that matches a URL and opens it in the system opener always +# exists. This can be disabled using `link-url`. +# +# TODO: This can't currently be set! + +# Enable URL matching. URLs are matched on hover with control (Linux) or +# super (macOS) pressed and open using the default system application for +# the linked URL. +# +# The URL matcher is always lowest priority of any configured links (see +# `link`). If you want to customize URL matching, use `link` and disable this. +link-url = true + +# Whether to start the window in a maximized state. This setting applies +# to new windows and does not apply to tabs, splits, etc. However, this setting +# will apply to all new windows, not just the first one. +maximize = false + +# Start new windows in fullscreen. This setting applies to new windows and +# does not apply to tabs, splits, etc. However, this setting will apply to all +# new windows, not just the first one. +# +# On macOS, this setting does not work if window-decoration is set to +# "false", because native fullscreen on macOS requires window decorations +# to be set. +fullscreen = false + +# The title Ghostty will use for the window. This will force the title of the +# window to be this title at all times and Ghostty will ignore any set title +# escape sequences programs (such as Neovim) may send. +# +# If you want a blank title, set this to one or more spaces by quoting +# the value. For example, `title = " "`. This effectively hides the title. +# This is necessary because setting a blank value resets the title to the +# default value of the running program. +# +# This configuration can be reloaded at runtime. If it is set, the title +# will update for all windows. If it is unset, the next title change escape +# sequence will be honored but previous changes will not retroactively +# be set. This latter case may require you to restart programs such as Neovim +# to get the new title. +title = + +# The setting that will change the application class value. +# +# This controls the class field of the `WM_CLASS` X11 property (when running +# under X11), and the Wayland application ID (when running under Wayland). +# +# Note that changing this value between invocations will create new, separate +# instances, of Ghostty when running with `gtk-single-instance=true`. See that +# option for more details. +# +# The class name must follow the requirements defined [in the GTK +# documentation](https://docs.gtk.org/gio/type_func.Application.id_is_valid.html). +# +# The default is `com.mitchellh.ghostty`. +# +# This only affects GTK builds. +class = + +# This controls the instance name field of the `WM_CLASS` X11 property when +# running under X11. It has no effect otherwise. +# +# The default is `ghostty`. +# +# This only affects GTK builds. +x11-instance-name = + +# The directory to change to after starting the command. +# +# This setting is secondary to the `window-inherit-working-directory` +# setting. If a previous Ghostty terminal exists in the same process, +# `window-inherit-working-directory` will take precedence. Otherwise, this +# setting will be used. Typically, this setting is used only for the first +# window. +# +# The default is `inherit` except in special scenarios listed next. On macOS, +# if Ghostty can detect it is launched from launchd (double-clicked) or +# `open`, then it defaults to `home`. On Linux with GTK, if Ghostty can detect +# it was launched from a desktop launcher, then it defaults to `home`. +# +# The value of this must be an absolute value or one of the special values +# below: +# +# * `home` - The home directory of the executing user. +# +# * `inherit` - The working directory of the launching process. +working-directory = + +# Key bindings. The format is `trigger=action`. Duplicate triggers will +# overwrite previously set values. The list of actions is available in +# the documentation or using the `ghostty +list-actions` command. +# +# Trigger: `+`-separated list of keys and modifiers. Example: `ctrl+a`, +# `ctrl+shift+b`, `up`. +# +# Valid keys are currently only listed in the +# [Ghostty source code](https://github.com/ghostty-org/ghostty/blob/d6e76858164d52cff460fedc61ddf2e560912d71/src/input/key.zig#L255). +# This is a documentation limitation and we will improve this in the future. +# A common gotcha is that numeric keys are written as words: e.g. `one`, +# `two`, `three`, etc. and not `1`, `2`, `3`. This will also be improved in +# the future. +# +# Valid modifiers are `shift`, `ctrl` (alias: `control`), `alt` (alias: `opt`, +# `option`), and `super` (alias: `cmd`, `command`). You may use the modifier +# or the alias. When debugging keybinds, the non-aliased modifier will always +# be used in output. +# +# Note: The fn or "globe" key on keyboards are not supported as a +# modifier. This is a limitation of the operating systems and GUI toolkits +# that Ghostty uses. +# +# Some additional notes for triggers: +# +# * modifiers cannot repeat, `ctrl+ctrl+a` is invalid. +# +# * modifiers and keys can be in any order, `shift+a+ctrl` is *weird*, +# but valid. +# +# * only a single key input is allowed, `ctrl+a+b` is invalid. +# +# * the key input can be prefixed with `physical:` to specify a +# physical key mapping rather than a logical one. A physical key +# mapping responds to the hardware keycode and not the keycode +# translated by any system keyboard layouts. Example: "ctrl+physical:a" +# +# You may also specify multiple triggers separated by `>` to require a +# sequence of triggers to activate the action. For example, +# `ctrl+a>n=new_window` will only trigger the `new_window` action if the +# user presses `ctrl+a` followed separately by `n`. In other software, this +# is sometimes called a leader key, a key chord, a key table, etc. There +# is no hardcoded limit on the number of parts in a sequence. +# +# Warning: If you define a sequence as a CLI argument to `ghostty`, +# you probably have to quote the keybind since `>` is a special character +# in most shells. Example: ghostty --keybind='ctrl+a>n=new_window' +# +# A trigger sequence has some special handling: +# +# * Ghostty will wait an indefinite amount of time for the next key in +# the sequence. There is no way to specify a timeout. The only way to +# force the output of a prefix key is to assign another keybind to +# specifically output that key (e.g. `ctrl+a>ctrl+a=text:foo`) or +# press an unbound key which will send both keys to the program. +# +# * If a prefix in a sequence is previously bound, the sequence will +# override the previous binding. For example, if `ctrl+a` is bound to +# `new_window` and `ctrl+a>n` is bound to `new_tab`, pressing `ctrl+a` +# will do nothing. +# +# * Adding to the above, if a previously bound sequence prefix is +# used in a new, non-sequence binding, the entire previously bound +# sequence will be unbound. For example, if you bind `ctrl+a>n` and +# `ctrl+a>t`, and then bind `ctrl+a` directly, both `ctrl+a>n` and +# `ctrl+a>t` will become unbound. +# +# * Trigger sequences are not allowed for `global:` or `all:`-prefixed +# triggers. This is a limitation we could remove in the future. +# +# Action is the action to take when the trigger is satisfied. It takes the +# format `action` or `action:param`. The latter form is only valid if the +# action requires a parameter. +# +# * `ignore` - Do nothing, ignore the key input. This can be used to +# black hole certain inputs to have no effect. +# +# * `unbind` - Remove the binding. This makes it so the previous action +# is removed, and the key will be sent through to the child command +# if it is printable. Unbind will remove any matching trigger, +# including `physical:`-prefixed triggers without specifying the +# prefix. +# +# * `csi:text` - Send a CSI sequence. e.g. `csi:A` sends "cursor up". +# +# * `esc:text` - Send an escape sequence. e.g. `esc:d` deletes to the +# end of the word to the right. +# +# * `text:text` - Send a string. Uses Zig string literal syntax. +# e.g. `text:\x15` sends Ctrl-U. +# +# * All other actions can be found in the documentation or by using the +# `ghostty +list-actions` command. +# +# Some notes for the action: +# +# * The parameter is taken as-is after the `:`. Double quotes or +# other mechanisms are included and NOT parsed. If you want to +# send a string value that includes spaces, wrap the entire +# trigger/action in double quotes. Example: `--keybind="up=csi:A B"` +# +# There are some additional special values that can be specified for +# keybind: +# +# * `keybind=clear` will clear all set keybindings. Warning: this +# removes ALL keybindings up to this point, including the default +# keybindings. +# +# The keybind trigger can be prefixed with some special values to change +# the behavior of the keybind. These are: +# +# * `all:` - Make the keybind apply to all terminal surfaces. By default, +# keybinds only apply to the focused terminal surface. If this is true, +# then the keybind will be sent to all terminal surfaces. This only +# applies to actions that are surface-specific. For actions that +# are already global (e.g. `quit`), this prefix has no effect. +# +# * `global:` - Make the keybind global. By default, keybinds only work +# within Ghostty and under the right conditions (application focused, +# sometimes terminal focused, etc.). If you want a keybind to work +# globally across your system (e.g. even when Ghostty is not focused), +# specify this prefix. This prefix implies `all:`. Note: this does not +# work in all environments; see the additional notes below for more +# information. +# +# * `unconsumed:` - Do not consume the input. By default, a keybind +# will consume the input, meaning that the associated encoding (if +# any) will not be sent to the running program in the terminal. If +# you wish to send the encoded value to the program, specify the +# `unconsumed:` prefix before the entire keybind. For example: +# `unconsumed:ctrl+a=reload_config`. `global:` and `all:`-prefixed +# keybinds will always consume the input regardless of this setting. +# Since they are not associated with a specific terminal surface, +# they're never encoded. +# +# * `performable:` - Only consume the input if the action is able to be +# performed. For example, the `copy_to_clipboard` action will only +# consume the input if there is a selection to copy. If there is no +# selection, Ghostty behaves as if the keybind was not set. This has +# no effect with `global:` or `all:`-prefixed keybinds. For key +# sequences, this will reset the sequence if the action is not +# performable (acting identically to not having a keybind set at +# all). +# +# Performable keybinds will not appear as menu shortcuts in the +# application menu. This is because the menu shortcuts force the +# action to be performed regardless of the state of the terminal. +# Performable keybinds will still work, they just won't appear as +# a shortcut label in the menu. +# +# Keybind triggers are not unique per prefix combination. For example, +# `ctrl+a` and `global:ctrl+a` are not two separate keybinds. The keybind +# set later will overwrite the keybind set earlier. In this case, the +# `global:` keybind will be used. +# +# Multiple prefixes can be specified. For example, +# `global:unconsumed:ctrl+a=reload_config` will make the keybind global +# and not consume the input to reload the config. +# +# Note: `global:` is only supported on macOS. On macOS, +# this feature requires accessibility permissions to be granted to Ghostty. +# When a `global:` keybind is specified and Ghostty is launched or reloaded, +# Ghostty will attempt to request these permissions. If the permissions are +# not granted, the keybind will not work. On macOS, you can find these +# permissions in System Preferences -> Privacy & Security -> Accessibility. +keybind = ctrl+comma=open_config +keybind = shift+insert=paste_from_selection +keybind = ctrl+page_down=next_tab +keybind = ctrl+shift+v=paste_from_clipboard +keybind = ctrl+alt+up=goto_split:up +keybind = ctrl+shift+a=select_all +keybind = super+ctrl+shift+plus=equalize_splits +keybind = shift+up=adjust_selection:up +keybind = alt+five=goto_tab:5 +keybind = super+ctrl+right_bracket=goto_split:next +keybind = ctrl+equal=increase_font_size:1 +keybind = ctrl+shift+o=new_split:right +keybind = ctrl+shift+c=copy_to_clipboard +keybind = ctrl+shift+q=quit +keybind = ctrl+shift+n=new_window +keybind = ctrl+shift+page_down=jump_to_prompt:1 +keybind = ctrl+shift+comma=reload_config +keybind = ctrl+minus=decrease_font_size:1 +keybind = shift+left=adjust_selection:left +keybind = super+ctrl+shift+up=resize_split:up,10 +keybind = alt+eight=goto_tab:8 +keybind = shift+page_up=scroll_page_up +keybind = ctrl+alt+shift+j=write_screen_file:open +keybind = ctrl+shift+left=previous_tab +keybind = ctrl+shift+w=close_tab +keybind = shift+end=scroll_to_bottom +keybind = ctrl+zero=reset_font_size +keybind = alt+three=goto_tab:3 +keybind = ctrl+shift+j=write_screen_file:paste +keybind = ctrl+enter=toggle_fullscreen +keybind = ctrl+page_up=previous_tab +keybind = shift+right=adjust_selection:right +keybind = ctrl+tab=next_tab +keybind = ctrl+alt+left=goto_split:left +keybind = shift+page_down=scroll_page_down +keybind = ctrl+shift+right=next_tab +keybind = ctrl+shift+page_up=jump_to_prompt:-1 +keybind = alt+nine=last_tab +keybind = ctrl+shift+t=new_tab +keybind = shift+down=adjust_selection:down +keybind = super+ctrl+shift+left=resize_split:left,10 +keybind = ctrl+shift+tab=previous_tab +keybind = alt+two=goto_tab:2 +keybind = ctrl+alt+down=goto_split:down +keybind = super+ctrl+shift+down=resize_split:down,10 +keybind = super+ctrl+shift+right=resize_split:right,10 +keybind = ctrl+plus=increase_font_size:1 +keybind = alt+four=goto_tab:4 +keybind = ctrl+insert=copy_to_clipboard +keybind = ctrl+shift+e=new_split:down +keybind = ctrl+alt+right=goto_split:right +keybind = alt+f4=close_window +keybind = alt+one=goto_tab:1 +keybind = ctrl+shift+enter=toggle_split_zoom +keybind = shift+home=scroll_to_top +keybind = super+ctrl+left_bracket=goto_split:previous +keybind = ctrl+shift+i=inspector:toggle +keybind = alt+six=goto_tab:6 +keybind = alt+seven=goto_tab:7 + +# Horizontal window padding. This applies padding between the terminal cells +# and the left and right window borders. The value is in points, meaning that +# it will be scaled appropriately for screen DPI. +# +# If this value is set too large, the screen will render nothing, because the +# grid will be completely squished by the padding. It is up to you as the user +# to pick a reasonable value. If you pick an unreasonable value, a warning +# will appear in the logs. +# +# Changing this configuration at runtime will only affect new terminals, i.e. +# new windows, tabs, etc. +# +# To set a different left and right padding, specify two numerical values +# separated by a comma. For example, `window-padding-x = 2,4` will set the +# left padding to 2 and the right padding to 4. If you want to set both +# paddings to the same value, you can use a single value. For example, +# `window-padding-x = 2` will set both paddings to 2. +window-padding-x = 2 + +# Vertical window padding. This applies padding between the terminal cells and +# the top and bottom window borders. The value is in points, meaning that it +# will be scaled appropriately for screen DPI. +# +# If this value is set too large, the screen will render nothing, because the +# grid will be completely squished by the padding. It is up to you as the user +# to pick a reasonable value. If you pick an unreasonable value, a warning +# will appear in the logs. +# +# Changing this configuration at runtime will only affect new terminals, +# i.e. new windows, tabs, etc. +# +# To set a different top and bottom padding, specify two numerical values +# separated by a comma. For example, `window-padding-y = 2,4` will set the +# top padding to 2 and the bottom padding to 4. If you want to set both +# paddings to the same value, you can use a single value. For example, +# `window-padding-y = 2` will set both paddings to 2. +window-padding-y = 2 + +# The viewport dimensions are usually not perfectly divisible by the cell +# size. In this case, some extra padding on the end of a column and the bottom +# of the final row may exist. If this is `true`, then this extra padding +# is automatically balanced between all four edges to minimize imbalance on +# one side. If this is `false`, the top left grid cell will always hug the +# edge with zero padding other than what may be specified with the other +# `window-padding` options. +# +# If other `window-padding` fields are set and this is `true`, this will still +# apply. The other padding is applied first and may affect how many grid cells +# actually exist, and this is applied last in order to balance the padding +# given a certain viewport size and grid cell size. +window-padding-balance = false + +# The color of the padding area of the window. Valid values are: +# +# * `background` - The background color specified in `background`. +# * `extend` - Extend the background color of the nearest grid cell. +# * `extend-always` - Same as "extend" but always extends without applying +# any of the heuristics that disable extending noted below. +# +# The "extend" value will be disabled in certain scenarios. On primary +# screen applications (e.g. not something like Neovim), the color will not +# be extended vertically if any of the following are true: +# +# * The nearest row has any cells that have the default background color. +# The thinking is that in this case, the default background color looks +# fine as a padding color. +# * The nearest row is a prompt row (requires shell integration). The +# thinking here is that prompts often contain powerline glyphs that +# do not look good extended. +# * The nearest row contains a perfect fit powerline character. These +# don't look good extended. +# +window-padding-color = background + +# Synchronize rendering with the screen refresh rate. If true, this will +# minimize tearing and align redraws with the screen but may cause input +# latency. If false, this will maximize redraw frequency but may cause tearing, +# and under heavy load may use more CPU and power. +# +# This defaults to true because out-of-sync rendering on macOS can +# cause kernel panics (macOS 14.4+) and performance issues for external +# displays over some hardware such as DisplayLink. If you want to minimize +# input latency, set this to false with the known aforementioned risks. +# +# Changing this value at runtime will only affect new terminals. +# +# This setting is only supported currently on macOS. +window-vsync = true + +# If true, new windows and tabs will inherit the working directory of the +# previously focused window. If no window was previously focused, the default +# working directory will be used (the `working-directory` option). +window-inherit-working-directory = true + +# If true, new windows and tabs will inherit the font size of the previously +# focused window. If no window was previously focused, the default font size +# will be used. If this is false, the default font size specified in the +# configuration `font-size` will be used. +window-inherit-font-size = true + +# Configure a preference for window decorations. This setting specifies +# a _preference_; the actual OS, desktop environment, window manager, etc. +# may override this preference. Ghostty will do its best to respect this +# preference but it may not always be possible. +# +# Valid values: +# +# * `none` - All window decorations will be disabled. Titlebar, +# borders, etc. will not be shown. On macOS, this will also disable +# tabs (enforced by the system). +# +# * `auto` - Automatically decide to use either client-side or server-side +# decorations based on the detected preferences of the current OS and +# desktop environment. This option usually makes Ghostty look the most +# "native" for your desktop. +# +# * `client` - Prefer client-side decorations. +# +# * `server` - Prefer server-side decorations. This is only relevant +# on Linux with GTK, either on X11, or Wayland on a compositor that +# supports the `org_kde_kwin_server_decoration` protocol (e.g. KDE Plasma, +# but almost any non-GNOME desktop supports this protocol). +# +# If `server` is set but the environment doesn't support server-side +# decorations, client-side decorations will be used instead. +# +# The default value is `auto`. +# +# For the sake of backwards compatibility and convenience, this setting also +# accepts boolean true and false values. If set to `true`, this is equivalent +# to `auto`. If set to `false`, this is equivalent to `none`. +# This is convenient for users who live primarily on systems that don't +# differentiate between client and server-side decorations (e.g. macOS and +# Windows). +# +# The "toggle_window_decorations" keybind action can be used to create +# a keybinding to toggle this setting at runtime. This will always toggle +# back to "auto" if the current value is "none" (this is an issue +# that will be fixed in the future). +# +# Changing this configuration in your configuration and reloading will +# only affect new windows. Existing windows will not be affected. +# +# macOS: To hide the titlebar without removing the native window borders +# or rounded corners, use `macos-titlebar-style = hidden` instead. +window-decoration = auto + +# The font that will be used for the application's window and tab titles. +# +# If this setting is left unset, the system default font will be used. +# +# Note: any font available on the system may be used, this font is not +# required to be a fixed-width font. +window-title-font-family = + +# The text that will be displayed in the subtitle of the window. Valid values: +# +# * `false` - Disable the subtitle. +# * `working-directory` - Set the subtitle to the working directory of the +# surface. +# +# This feature is only supported on GTK with Adwaita enabled. +window-subtitle = false + +# The theme to use for the windows. Valid values: +# +# * `auto` - Determine the theme based on the configured terminal +# background color. This has no effect if the "theme" configuration +# has separate light and dark themes. In that case, the behavior +# of "auto" is equivalent to "system". +# * `system` - Use the system theme. +# * `light` - Use the light theme regardless of system theme. +# * `dark` - Use the dark theme regardless of system theme. +# * `ghostty` - Use the background and foreground colors specified in the +# Ghostty configuration. This is only supported on Linux builds with +# Adwaita and `gtk-adwaita` enabled. +# +# On macOS, if `macos-titlebar-style` is "tabs", the window theme will be +# automatically set based on the luminosity of the terminal background color. +# This only applies to terminal windows. This setting will still apply to +# non-terminal windows within Ghostty. +# +# This is currently only supported on macOS and Linux. +window-theme = auto + +# The color space to use when interpreting terminal colors. "Terminal colors" +# refers to colors specified in your configuration and colors produced by +# direct-color SGR sequences. +# +# Valid values: +# +# * `srgb` - Interpret colors in the sRGB color space. This is the default. +# * `display-p3` - Interpret colors in the Display P3 color space. +# +# This setting is currently only supported on macOS. +window-colorspace = srgb + +# The initial window size. This size is in terminal grid cells by default. +# Both values must be set to take effect. If only one value is set, it is +# ignored. +# +# We don't currently support specifying a size in pixels but a future change +# can enable that. If this isn't specified, the app runtime will determine +# some default size. +# +# Note that the window manager may put limits on the size or override the +# size. For example, a tiling window manager may force the window to be a +# certain size to fit within the grid. There is nothing Ghostty will do about +# this, but it will make an effort. +# +# Sizes larger than the screen size will be clamped to the screen size. +# This can be used to create a maximized-by-default window size. +# +# This will not affect new tabs, splits, or other nested terminal elements. +# This only affects the initial window size of any new window. Changing this +# value will not affect the size of the window after it has been created. This +# is only used for the initial size. +# +# BUG: On Linux with GTK, the calculated window size will not properly take +# into account window decorations. As a result, the grid dimensions will not +# exactly match this configuration. If window decorations are disabled (see +# `window-decoration`), then this will work as expected. +# +# Windows smaller than 10 wide by 4 high are not allowed. +window-height = 0 + +window-width = 0 +# The starting window position. This position is in pixels and is relative +# to the top-left corner of the primary monitor. Both values must be set to take +# effect. If only one value is set, it is ignored. +# +# Note that the window manager may put limits on the position or override +# the position. For example, a tiling window manager may force the window +# to be a certain position to fit within the grid. There is nothing Ghostty +# will do about this, but it will make an effort. +# +# Also note that negative values are also up to the operating system and +# window manager. Some window managers may not allow windows to be placed +# off-screen. +# +# Invalid positions are runtime-specific, but generally the positions are +# clamped to the nearest valid position. +# +# On macOS, the window position is relative to the top-left corner of +# the visible screen area. This means that if the menu bar is visible, the +# window will be placed below the menu bar. +# +# Note: this is only supported on macOS and Linux GLFW builds. The GTK +# runtime does not support setting the window position (this is a limitation +# of GTK 4.0). +window-position-x = + +window-position-y = +# Whether to enable saving and restoring window state. Window state includes +# their position, size, tabs, splits, etc. Some window state requires shell +# integration, such as preserving working directories. See `shell-integration` +# for more information. +# +# There are three valid values for this configuration: +# +# * `default` will use the default system behavior. On macOS, this +# will only save state if the application is forcibly terminated +# or if it is configured systemwide via Settings.app. +# +# * `never` will never save window state. +# +# * `always` will always save window state whenever Ghostty is exited. +# +# If you change this value to `never` while Ghostty is not running, the next +# Ghostty launch will NOT restore the window state. +# +# If you change this value to `default` while Ghostty is not running and the +# previous exit saved state, the next Ghostty launch will still restore the +# window state. This is because Ghostty cannot know if the previous exit was +# due to a forced save or not (macOS doesn't provide this information). +# +# If you change this value so that window state is saved while Ghostty is not +# running, the previous window state will not be restored because Ghostty only +# saves state on exit if this is enabled. +# +# The default value is `default`. +# +# This is currently only supported on macOS. This has no effect on Linux. +window-save-state = default + +# Resize the window in discrete increments of the focused surface's cell size. +# If this is disabled, surfaces are resized in pixel increments. Currently +# only supported on macOS. +window-step-resize = false + +# The position where new tabs are created. Valid values: +# +# * `current` - Insert the new tab after the currently focused tab, +# or at the end if there are no focused tabs. +# +# * `end` - Insert the new tab at the end of the tab list. +window-new-tab-position = current + +# Background color for the window titlebar. This only takes effect if +# window-theme is set to ghostty. Currently only supported in the GTK app +# runtime. +# +# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. +window-titlebar-background = + +# Foreground color for the window titlebar. This only takes effect if +# window-theme is set to ghostty. Currently only supported in the GTK app +# runtime. +# +# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. +window-titlebar-foreground = + +# This controls when resize overlays are shown. Resize overlays are a +# transient popup that shows the size of the terminal while the surfaces are +# being resized. The possible options are: +# +# * `always` - Always show resize overlays. +# * `never` - Never show resize overlays. +# * `after-first` - The resize overlay will not appear when the surface +# is first created, but will show up if the surface is +# subsequently resized. +# +# The default is `after-first`. +resize-overlay = after-first + +# If resize overlays are enabled, this controls the position of the overlay. +# The possible options are: +# +# * `center` +# * `top-left` +# * `top-center` +# * `top-right` +# * `bottom-left` +# * `bottom-center` +# * `bottom-right` +# +# The default is `center`. +resize-overlay-position = center + +# If resize overlays are enabled, this controls how long the overlay is +# visible on the screen before it is hidden. The default is ¾ of a second or +# 750 ms. +# +# The duration is specified as a series of numbers followed by time units. +# Whitespace is allowed between numbers and units. Each number and unit will +# be added together to form the total duration. +# +# The allowed time units are as follows: +# +# * `y` - 365 SI days, or 8760 hours, or 31536000 seconds. No adjustments +# are made for leap years or leap seconds. +# * `d` - one SI day, or 86400 seconds. +# * `h` - one hour, or 3600 seconds. +# * `m` - one minute, or 60 seconds. +# * `s` - one second. +# * `ms` - one millisecond, or 0.001 second. +# * `us` or `µs` - one microsecond, or 0.000001 second. +# * `ns` - one nanosecond, or 0.000000001 second. +# +# Examples: +# * `1h30m` +# * `45s` +# +# Units can be repeated and will be added together. This means that +# `1h1h` is equivalent to `2h`. This is confusing and should be avoided. +# A future update may disallow this. +# +# The maximum value is `584y 49w 23h 34m 33s 709ms 551µs 615ns`. Any +# value larger than this will be clamped to the maximum value. +resize-overlay-duration = 750ms + +# If true, when there are multiple split panes, the mouse selects the pane +# that is focused. This only applies to the currently focused window; e.g. +# mousing over a split in an unfocused window will not focus that split +# and bring the window to front. +# +# Default is false. +focus-follows-mouse = false + +# Whether to allow programs running in the terminal to read/write to the +# system clipboard (OSC 52, for googling). The default is to allow clipboard +# reading after prompting the user and allow writing unconditionally. +# +# Valid values are: +# +# * `ask` +# * `allow` +# * `deny` +# +clipboard-read = ask + +clipboard-write = allow +# Trims trailing whitespace on data that is copied to the clipboard. This does +# not affect data sent to the clipboard via `clipboard-write`. +clipboard-trim-trailing-spaces = true + +# Require confirmation before pasting text that appears unsafe. This helps +# prevent a "copy/paste attack" where a user may accidentally execute unsafe +# commands by pasting text with newlines. +clipboard-paste-protection = true + +# If true, bracketed pastes will be considered safe. By default, bracketed +# pastes are considered safe. "Bracketed" pastes are pastes while the running +# program has bracketed paste mode enabled (a setting set by the running +# program, not the terminal emulator). +clipboard-paste-bracketed-safe = true + +# Enables or disabled title reporting (CSI 21 t). This escape sequence +# allows the running program to query the terminal title. This is a common +# security issue and is disabled by default. +# +# Warning: This can expose sensitive information at best and enable +# arbitrary code execution at worst (with a maliciously crafted title +# and a minor amount of user interaction). +title-report = false + +# The total amount of bytes that can be used for image data (e.g. the Kitty +# image protocol) per terminal screen. The maximum value is 4,294,967,295 +# (4GiB). The default is 320MB. If this is set to zero, then all image +# protocols will be disabled. +# +# This value is separate for primary and alternate screens so the effective +# limit per surface is double. +image-storage-limit = 320000000 + +# Whether to automatically copy selected text to the clipboard. `true` +# will prefer to copy to the selection clipboard, otherwise it will copy to +# the system clipboard. +# +# The value `clipboard` will always copy text to the selection clipboard +# as well as the system clipboard. +# +# Middle-click paste will always use the selection clipboard. Middle-click +# paste is always enabled even if this is `false`. +# +# The default value is true on Linux and macOS. +copy-on-select = true + +# The time in milliseconds between clicks to consider a click a repeat +# (double, triple, etc.) or an entirely new single click. A value of zero will +# use a platform-specific default. The default on macOS is determined by the +# OS settings. On every other platform it is 500ms. +click-repeat-interval = 0 + +# Additional configuration files to read. This configuration can be repeated +# to read multiple configuration files. Configuration files themselves can +# load more configuration files. Paths are relative to the file containing the +# `config-file` directive. For command-line arguments, paths are relative to +# the current working directory. +# +# Prepend a ? character to the file path to suppress errors if the file does +# not exist. If you want to include a file that begins with a literal ? +# character, surround the file path in double quotes ("). +# +# Cycles are not allowed. If a cycle is detected, an error will be logged and +# the configuration file will be ignored. +# +# Configuration files are loaded after the configuration they're defined +# within in the order they're defined. **THIS IS A VERY SUBTLE BUT IMPORTANT +# POINT.** To put it another way: configuration files do not take effect +# until after the entire configuration is loaded. For example, in the +# configuration below: +# +# ``` +# config-file = "foo" +# a = 1 +# ``` +# +# If "foo" contains `a = 2`, the final value of `a` will be 2, because +# `foo` is loaded after the configuration file that configures the +# nested `config-file` value. +config-file = + +# When this is true, the default configuration file paths will be loaded. +# The default configuration file paths are currently only the XDG +# config path ($XDG_CONFIG_HOME/ghostty/config). +# +# If this is false, the default configuration paths will not be loaded. +# This is targeted directly at using Ghostty from the CLI in a way +# that minimizes external effects. +# +# This is a CLI-only configuration. Setting this in a configuration file +# will have no effect. It is not an error, but it will not do anything. +# This configuration can only be set via CLI arguments. +config-default-files = true + +# Confirms that a surface should be closed before closing it. +# +# This defaults to `true`. If set to `false`, surfaces will close without +# any confirmation. This can also be set to `always`, which will always +# confirm closing a surface, even if shell integration says a process isn't +# running. +confirm-close-surface = true + +# Whether or not to quit after the last surface is closed. +# +# This defaults to `false` on macOS since that is standard behavior for +# a macOS application. On Linux, this defaults to `true` since that is +# generally expected behavior. +# +# On Linux, if this is `true`, Ghostty can delay quitting fully until a +# configurable amount of time has passed after the last window is closed. +# See the documentation of `quit-after-last-window-closed-delay`. +quit-after-last-window-closed = true + +# Controls how long Ghostty will stay running after the last open surface has +# been closed. This only has an effect if `quit-after-last-window-closed` is +# also set to `true`. +# +# The minimum value for this configuration is `1s`. Any values lower than +# this will be clamped to `1s`. +# +# The duration is specified as a series of numbers followed by time units. +# Whitespace is allowed between numbers and units. Each number and unit will +# be added together to form the total duration. +# +# The allowed time units are as follows: +# +# * `y` - 365 SI days, or 8760 hours, or 31536000 seconds. No adjustments +# are made for leap years or leap seconds. +# * `d` - one SI day, or 86400 seconds. +# * `h` - one hour, or 3600 seconds. +# * `m` - one minute, or 60 seconds. +# * `s` - one second. +# * `ms` - one millisecond, or 0.001 second. +# * `us` or `µs` - one microsecond, or 0.000001 second. +# * `ns` - one nanosecond, or 0.000000001 second. +# +# Examples: +# * `1h30m` +# * `45s` +# +# Units can be repeated and will be added together. This means that +# `1h1h` is equivalent to `2h`. This is confusing and should be avoided. +# A future update may disallow this. +# +# The maximum value is `584y 49w 23h 34m 33s 709ms 551µs 615ns`. Any +# value larger than this will be clamped to the maximum value. +# +# By default `quit-after-last-window-closed-delay` is unset and +# Ghostty will quit immediately after the last window is closed if +# `quit-after-last-window-closed` is `true`. +# +# Only implemented on Linux. +quit-after-last-window-closed-delay = + +# This controls whether an initial window is created when Ghostty +# is run. Note that if `quit-after-last-window-closed` is `true` and +# `quit-after-last-window-closed-delay` is set, setting `initial-window` to +# `false` will mean that Ghostty will quit after the configured delay if no +# window is ever created. Only implemented on Linux and macOS. +initial-window = true + +# The position of the "quick" terminal window. To learn more about the +# quick terminal, see the documentation for the `toggle_quick_terminal` +# binding action. +# +# Valid values are: +# +# * `top` - Terminal appears at the top of the screen. +# * `bottom` - Terminal appears at the bottom of the screen. +# * `left` - Terminal appears at the left of the screen. +# * `right` - Terminal appears at the right of the screen. +# * `center` - Terminal appears at the center of the screen. +# +# Changing this configuration requires restarting Ghostty completely. +# +# Note: There is no default keybind for toggling the quick terminal. +# To enable this feature, bind the `toggle_quick_terminal` action to a key. +quick-terminal-position = top + +# The screen where the quick terminal should show up. +# +# Valid values are: +# +# * `main` - The screen that the operating system recommends as the main +# screen. On macOS, this is the screen that is currently receiving +# keyboard input. This screen is defined by the operating system and +# not chosen by Ghostty. +# +# * `mouse` - The screen that the mouse is currently hovered over. +# +# * `macos-menu-bar` - The screen that contains the macOS menu bar as +# set in the display settings on macOS. This is a bit confusing because +# every screen on macOS has a menu bar, but this is the screen that +# contains the primary menu bar. +# +# The default value is `main` because this is the recommended screen +# by the operating system. +quick-terminal-screen = main + +# Duration (in seconds) of the quick terminal enter and exit animation. +# Set it to 0 to disable animation completely. This can be changed at +# runtime. +quick-terminal-animation-duration = 0.2 + +# Automatically hide the quick terminal when focus shifts to another window. +# Set it to false for the quick terminal to remain open even when it loses focus. +quick-terminal-autohide = true + +# This configuration option determines the behavior of the quick terminal +# when switching between macOS spaces. macOS spaces are virtual desktops +# that can be manually created or are automatically created when an +# application is in full-screen mode. +# +# Valid values are: +# +# * `move` - When switching to another space, the quick terminal will +# also moved to the current space. +# +# * `remain` - The quick terminal will stay only in the space where it +# was originally opened and will not follow when switching to another +# space. +# +# The default value is `move`. +quick-terminal-space-behavior = move + +# Whether to enable shell integration auto-injection or not. Shell integration +# greatly enhances the terminal experience by enabling a number of features: +# +# * Working directory reporting so new tabs, splits inherit the +# previous terminal's working directory. +# +# * Prompt marking that enables the "jump_to_prompt" keybinding. +# +# * If you're sitting at a prompt, closing a terminal will not ask +# for confirmation. +# +# * Resizing the window with a complex prompt usually paints much +# better. +# +# Allowable values are: +# +# * `none` - Do not do any automatic injection. You can still manually +# configure your shell to enable the integration. +# +# * `detect` - Detect the shell based on the filename. +# +# * `bash`, `elvish`, `fish`, `zsh` - Use this specific shell injection scheme. +# +# The default value is `detect`. +shell-integration = detect + +# Shell integration features to enable. These require our shell integration +# to be loaded, either automatically via shell-integration or manually. +# +# The format of this is a list of features to enable separated by commas. If +# you prefix a feature with `no-` then it is disabled. If you omit a feature, +# its default value is used, so you must explicitly disable features you don't +# want. You can also use `true` or `false` to turn all features on or off. +# +# Available features: +# +# * `cursor` - Set the cursor to a blinking bar at the prompt. +# +# * `sudo` - Set sudo wrapper to preserve terminfo. +# +# * `title` - Set the window title via shell integration. +# +# Example: `cursor`, `no-cursor`, `sudo`, `no-sudo`, `title`, `no-title` +shell-integration-features = cursor,no-sudo,title + +# Sets the reporting format for OSC sequences that request color information. +# Ghostty currently supports OSC 10 (foreground), OSC 11 (background), and +# OSC 4 (256 color palette) queries, and by default the reported values +# are scaled-up RGB values, where each component are 16 bits. This is how +# most terminals report these values. However, some legacy applications may +# require 8-bit, unscaled, components. We also support turning off reporting +# altogether. The components are lowercase hex values. +# +# Allowable values are: +# +# * `none` - OSC 4/10/11 queries receive no reply +# +# * `8-bit` - Color components are return unscaled, e.g. `rr/gg/bb` +# +# * `16-bit` - Color components are returned scaled, e.g. `rrrr/gggg/bbbb` +# +# The default value is `16-bit`. +osc-color-report-format = 16-bit + +# If true, allows the "KAM" mode (ANSI mode 2) to be used within +# the terminal. KAM disables keyboard input at the request of the +# application. This is not a common feature and is not recommended +# to be enabled. This will not be documented further because +# if you know you need KAM, you know. If you don't know if you +# need KAM, you don't need it. +vt-kam-allowed = false + +# Custom shaders to run after the default shaders. This is a file path +# to a GLSL-syntax shader for all platforms. +# +# Warning: Invalid shaders can cause Ghostty to become unusable such as by +# causing the window to be completely black. If this happens, you can +# unset this configuration to disable the shader. +# +# On Linux, this requires OpenGL 4.2. Ghostty typically only requires +# OpenGL 3.3, but custom shaders push that requirement up to 4.2. +# +# The shader API is identical to the Shadertoy API: you specify a `mainImage` +# function and the available uniforms match Shadertoy. The iChannel0 uniform +# is a texture containing the rendered terminal screen. +# +# If the shader fails to compile, the shader will be ignored. Any errors +# related to shader compilation will not show up as configuration errors +# and only show up in the log, since shader compilation happens after +# configuration loading on the dedicated render thread. For interactive +# development, use [shadertoy.com](https://shadertoy.com). +# +# This can be repeated multiple times to load multiple shaders. The shaders +# will be run in the order they are specified. +# +# Changing this value at runtime and reloading the configuration will only +# affect new windows, tabs, and splits. +custom-shader = + +# If `true` (default), the focused terminal surface will run an animation +# loop when custom shaders are used. This uses slightly more CPU (generally +# less than 10%) but allows the shader to animate. This only runs if there +# are custom shaders and the terminal is focused. +# +# If this is set to `false`, the terminal and custom shader will only render +# when the terminal is updated. This is more efficient but the shader will +# not animate. +# +# This can also be set to `always`, which will always run the animation +# loop regardless of whether the terminal is focused or not. The animation +# loop will still only run when custom shaders are used. Note that this +# will use more CPU per terminal surface and can become quite expensive +# depending on the shader and your terminal usage. +# +# This value can be changed at runtime and will affect all currently +# open terminals. +custom-shader-animation = true + +# Control the in-app notifications that Ghostty shows. +# +# On Linux (GTK) with Adwaita, in-app notifications show up as toasts. Toasts +# appear overlaid on top of the terminal window. They are used to show +# information that is not critical but may be important. +# +# Possible notifications are: +# +# - `clipboard-copy` (default: true) - Show a notification when text is copied +# to the clipboard. +# +# To specify a notification to enable, specify the name of the notification. +# To specify a notification to disable, prefix the name with `no-`. For +# example, to disable `clipboard-copy`, set this configuration to +# `no-clipboard-copy`. To enable it, set this configuration to `clipboard-copy`. +# +# Multiple notifications can be enabled or disabled by separating them +# with a comma. +# +# A value of "false" will disable all notifications. A value of "true" will +# enable all notifications. +# +# This configuration only applies to GTK with Adwaita enabled. +app-notifications = clipboard-copy + +# If anything other than false, fullscreen mode on macOS will not use the +# native fullscreen, but make the window fullscreen without animations and +# using a new space. It's faster than the native fullscreen mode since it +# doesn't use animations. +# +# Important: tabs DO NOT WORK in this mode. Non-native fullscreen removes +# the titlebar and macOS native tabs require the titlebar. If you use tabs, +# you should not use this mode. +# +# If you fullscreen a window with tabs, the currently focused tab will +# become fullscreen while the others will remain in a separate window in +# the background. You can switch to that window using normal window-switching +# keybindings such as command+tilde. When you exit fullscreen, the window +# will return to the tabbed state it was in before. +# +# Allowable values are: +# +# * `visible-menu` - Use non-native macOS fullscreen, keep the menu bar visible +# * `true` - Use non-native macOS fullscreen, hide the menu bar +# * `false` - Use native macOS fullscreen +# +# Changing this option at runtime works, but will only apply to the next +# time the window is made fullscreen. If a window is already fullscreen, +# it will retain the previous setting until fullscreen is exited. +macos-non-native-fullscreen = false + +# The style of the macOS titlebar. Available values are: "native", +# "transparent", "tabs", and "hidden". +# +# The "native" style uses the native macOS titlebar with zero customization. +# The titlebar will match your window theme (see `window-theme`). +# +# The "transparent" style is the same as "native" but the titlebar will +# be transparent and allow your window background color to come through. +# This makes a more seamless window appearance but looks a little less +# typical for a macOS application and may not work well with all themes. +# +# The "transparent" style will also update in real-time to dynamic +# changes to the window background color, e.g. via OSC 11. To make this +# more aesthetically pleasing, this only happens if the terminal is +# a window, tab, or split that borders the top of the window. This +# avoids a disjointed appearance where the titlebar color changes +# but all the topmost terminals don't match. +# +# The "tabs" style is a completely custom titlebar that integrates the +# tab bar into the titlebar. This titlebar always matches the background +# color of the terminal. There are some limitations to this style: +# On macOS 13 and below, saved window state will not restore tabs correctly. +# macOS 14 does not have this issue and any other macOS version has not +# been tested. +# +# The "hidden" style hides the titlebar. Unlike `window-decoration = false`, +# however, it does not remove the frame from the window or cause it to have +# squared corners. Changing to or from this option at run-time may affect +# existing windows in buggy ways. +# +# When "hidden", the top titlebar area can no longer be used for dragging +# the window. To drag the window, you can use option+click on the resizable +# areas of the frame to drag the window. This is a standard macOS behavior +# and not something Ghostty enables. +# +# The default value is "transparent". This is an opinionated choice +# but its one I think is the most aesthetically pleasing and works in +# most cases. +# +# Changing this option at runtime only applies to new windows. +macos-titlebar-style = transparent + +# Whether the proxy icon in the macOS titlebar is visible. The proxy icon +# is the icon that represents the folder of the current working directory. +# You can see this very clearly in the macOS built-in Terminal.app +# titlebar. +# +# The proxy icon is only visible with the native macOS titlebar style. +# +# Valid values are: +# +# * `visible` - Show the proxy icon. +# * `hidden` - Hide the proxy icon. +# +# The default value is `visible`. +# +# This setting can be changed at runtime and will affect all currently +# open windows but only after their working directory changes again. +# Therefore, to make this work after changing the setting, you must +# usually `cd` to a different directory, open a different file in an +# editor, etc. +macos-titlebar-proxy-icon = visible + +# macOS doesn't have a distinct "alt" key and instead has the "option" +# key which behaves slightly differently. On macOS by default, the +# option key plus a character will sometimes produces a Unicode character. +# For example, on US standard layouts option-b produces "∫". This may be +# undesirable if you want to use "option" as an "alt" key for keybindings +# in terminal programs or shells. +# +# This configuration lets you change the behavior so that option is treated +# as alt. +# +# The default behavior (unset) will depend on your active keyboard +# layout. If your keyboard layout is one of the keyboard layouts listed +# below, then the default value is "true". Otherwise, the default +# value is "false". Keyboard layouts with a default value of "true" are: +# +# - U.S. Standard +# - U.S. International +# +# Note that if an *Option*-sequence doesn't produce a printable character, it +# will be treated as *Alt* regardless of this setting. (e.g. `alt+ctrl+a`). +# +# Explicit values that can be set: +# +# If `true`, the *Option* key will be treated as *Alt*. This makes terminal +# sequences expecting *Alt* to work properly, but will break Unicode input +# sequences on macOS if you use them via the *Alt* key. +# +# You may set this to `false` to restore the macOS *Alt* key unicode +# sequences but this will break terminal sequences expecting *Alt* to work. +# +# The values `left` or `right` enable this for the left or right *Option* +# key, respectively. +# +# This does not work with GLFW builds. +macos-option-as-alt = + +# Whether to enable the macOS window shadow. The default value is true. +# With some window managers and window transparency settings, you may +# find false more visually appealing. +macos-window-shadow = true + +# If true, Ghostty on macOS will automatically enable the "Secure Input" +# feature when it detects that a password prompt is being displayed. +# +# "Secure Input" is a macOS security feature that prevents applications from +# reading keyboard events. This can always be enabled manually using the +# `Ghostty > Secure Keyboard Entry` menu item. +# +# Note that automatic password prompt detection is based on heuristics +# and may not always work as expected. Specifically, it does not work +# over SSH connections, but there may be other cases where it also +# doesn't work. +# +# A reason to disable this feature is if you find that it is interfering +# with legitimate accessibility software (or software that uses the +# accessibility APIs), since secure input prevents any application from +# reading keyboard events. +macos-auto-secure-input = true + +# If true, Ghostty will show a graphical indication when secure input is +# enabled. This indication is generally recommended to know when secure input +# is enabled. +# +# Normally, secure input is only active when a password prompt is displayed +# or it is manually (and typically temporarily) enabled. However, if you +# always have secure input enabled, the indication can be distracting and +# you may want to disable it. +macos-secure-input-indication = true + +# Customize the macOS app icon. +# +# This only affects the icon that appears in the dock, application +# switcher, etc. This does not affect the icon in Finder because +# that is controlled by a hardcoded value in the signed application +# bundle and can't be changed at runtime. For more details on what +# exactly is affected, see the `NSApplication.icon` Apple documentation; +# that is the API that is being used to set the icon. +# +# Valid values: +# +# * `official` - Use the official Ghostty icon. +# * `blueprint`, `chalkboard`, `microchip`, `glass`, `holographic`, +# `paper`, `retro`, `xray` - Official variants of the Ghostty icon +# hand-created by artists (no AI). +# * `custom-style` - Use the official Ghostty icon but with custom +# styles applied to various layers. The custom styles must be +# specified using the additional `macos-icon`-prefixed configurations. +# The `macos-icon-ghost-color` and `macos-icon-screen-color` +# configurations are required for this style. +# +# WARNING: The `custom-style` option is _experimental_. We may change +# the format of the custom styles in the future. We're still finalizing +# the exact layers and customization options that will be available. +# +# Other caveats: +# +# * The icon in the update dialog will always be the official icon. +# This is because the update dialog is managed through a +# separate framework and cannot be customized without significant +# effort. +# +macos-icon = official + +# The material to use for the frame of the macOS app icon. +# +# Valid values: +# +# * `aluminum` - A brushed aluminum frame. This is the default. +# * `beige` - A classic 90's computer beige frame. +# * `plastic` - A glossy, dark plastic frame. +# * `chrome` - A shiny chrome frame. +# +# This only has an effect when `macos-icon` is set to `custom-style`. +macos-icon-frame = aluminum + +# The color of the ghost in the macOS app icon. +# +# Note: This configuration is required when `macos-icon` is set to +# `custom-style`. +# +# This only has an effect when `macos-icon` is set to `custom-style`. +# +# Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. +macos-icon-ghost-color = + +# The color of the screen in the macOS app icon. +# +# The screen is a gradient so you can specify multiple colors that +# make up the gradient. Comma-separated colors may be specified as +# as either hex (`#RRGGBB` or `RRGGBB`) or as named X11 colors. +# +# Note: This configuration is required when `macos-icon` is set to +# `custom-style`. +# +# This only has an effect when `macos-icon` is set to `custom-style`. +macos-icon-screen-color = + +# Put every surface (tab, split, window) into a dedicated Linux cgroup. +# +# This makes it so that resource management can be done on a per-surface +# granularity. For example, if a shell program is using too much memory, +# only that shell will be killed by the oom monitor instead of the entire +# Ghostty process. Similarly, if a shell program is using too much CPU, +# only that surface will be CPU-throttled. +# +# This will cause startup times to be slower (a hundred milliseconds or so), +# so the default value is "single-instance." In single-instance mode, only +# one instance of Ghostty is running (see gtk-single-instance) so the startup +# time is a one-time cost. Additionally, single instance Ghostty is much +# more likely to have many windows, tabs, etc. so cgroup isolation is a +# big benefit. +# +# This feature requires systemd. If systemd is unavailable, cgroup +# initialization will fail. By default, this will not prevent Ghostty +# from working (see linux-cgroup-hard-fail). +# +# Valid values are: +# +# * `never` - Never use cgroups. +# * `always` - Always use cgroups. +# * `single-instance` - Enable cgroups only for Ghostty instances launched +# as single-instance applications (see gtk-single-instance). +# +linux-cgroup = single-instance + +# Memory limit for any individual terminal process (tab, split, window, +# etc.) in bytes. If this is unset then no memory limit will be set. +# +# Note that this sets the "memory.high" configuration for the memory +# controller, which is a soft limit. You should configure something like +# systemd-oom to handle killing processes that have too much memory +# pressure. +linux-cgroup-memory-limit = + +# Number of processes limit for any individual terminal process (tab, split, +# window, etc.). If this is unset then no limit will be set. +# +# Note that this sets the "pids.max" configuration for the process number +# controller, which is a hard limit. +linux-cgroup-processes-limit = + +# If this is false, then any cgroup initialization (for linux-cgroup) +# will be allowed to fail and the failure is ignored. This is useful if +# you view cgroup isolation as a "nice to have" and not a critical resource +# management feature, because Ghostty startup will not fail if cgroup APIs +# fail. +# +# If this is true, then any cgroup initialization failure will cause +# Ghostty to exit or new surfaces to not be created. +# +# Note: This currently only affects cgroup initialization. Subprocesses +# must always be able to move themselves into an isolated cgroup. +linux-cgroup-hard-fail = false + +# Enable or disable GTK's OpenGL debugging logs. The default is `true` for +# debug builds, `false` for all others. +gtk-opengl-debug = false + +# Obsolete configuration that should not be set. This was deprecated in +# Ghostty 1.1.3 and no longer has any effect. The configuration key will +# be fully removed in 1.2.0. You can manually override the GSK renderer +# using standard environment variables such as `GSK_RENDERER` (from GTK). +gtk-gsk-renderer = default + +# If `true`, the Ghostty GTK application will run in single-instance mode: +# each new `ghostty` process launched will result in a new window if there is +# already a running process. +# +# If `false`, each new ghostty process will launch a separate application. +# +# The default value is `desktop` which will default to `true` if Ghostty +# detects that it was launched from the `.desktop` file such as an app +# launcher (like Gnome Shell) or by D-Bus activation. If Ghostty is launched +# from the command line, it will default to `false`. +# +# Note that debug builds of Ghostty have a separate single-instance ID +# so you can test single instance without conflicting with release builds. +gtk-single-instance = desktop + +# When enabled, the full GTK titlebar is displayed instead of your window +# manager's simple titlebar. The behavior of this option will vary with your +# window manager. +# +# This option does nothing when `window-decoration` is false or when running +# under macOS. +# +# Changing this value at runtime and reloading the configuration will only +# affect new windows. +gtk-titlebar = true + +# Determines the side of the screen that the GTK tab bar will stick to. +# Top, bottom, left, right, and hidden are supported. The default is top. +# +# If this option has value `left` or `right` when using Adwaita, it falls +# back to `top`. `hidden`, meaning that tabs don't exist, is not supported +# without using Adwaita, falling back to `top`. +# +# When `hidden` is set and Adwaita is enabled, a tab button displaying the +# number of tabs will appear in the title bar. It has the ability to open a +# tab overview for displaying tabs. Alternatively, you can use the +# `toggle_tab_overview` action in a keybind if your window doesn't have a +# title bar, or you can switch tabs with keybinds. +gtk-tabs-location = top + +# If this is `true`, the titlebar will be hidden when the window is maximized, +# and shown when the titlebar is unmaximized. GTK only. +gtk-titlebar-hide-when-maximized = false + +# Determines the appearance of the top and bottom bars when using the +# Adwaita tab bar. This requires `gtk-adwaita` to be enabled (it is +# by default). +# +# Valid values are: +# +# * `flat` - Top and bottom bars are flat with the terminal window. +# * `raised` - Top and bottom bars cast a shadow on the terminal area. +# * `raised-border` - Similar to `raised` but the shadow is replaced with a +# more subtle border. +# +# Changing this value at runtime will only affect new windows. +adw-toolbar-style = raised + +# If `true` (default), then the Ghostty GTK tabs will be "wide." Wide tabs +# are the new typical Gnome style where tabs fill their available space. +# If you set this to `false` then tabs will only take up space they need, +# which is the old style. +gtk-wide-tabs = true + +# If `true` (default), Ghostty will enable Adwaita theme support. This +# will make `window-theme` work properly and will also allow Ghostty to +# properly respond to system theme changes, light/dark mode changing, etc. +# This requires a GTK4 desktop with a GTK4 theme. +# +# If you are running GTK3 or have a GTK3 theme, you may have to set this +# to false to get your theme picked up properly. Having this set to true +# with GTK3 should not cause any problems, but it may not work exactly as +# expected. +# +# This configuration only has an effect if Ghostty was built with +# Adwaita support. +gtk-adwaita = true + +# Custom CSS files to be loaded. +# +# This configuration can be repeated multiple times to load multiple files. +# Prepend a ? character to the file path to suppress errors if the file does +# not exist. If you want to include a file that begins with a literal ? +# character, surround the file path in double quotes ("). +# The file size limit for a single stylesheet is 5MiB. +gtk-custom-css = + +# If `true` (default), applications running in the terminal can show desktop +# notifications using certain escape sequences such as OSC 9 or OSC 777. +desktop-notifications = true + +# If `true`, the bold text will use the bright color palette. +bold-is-bright = false + +# This will be used to set the `TERM` environment variable. +# HACK: We set this with an `xterm` prefix because vim uses that to enable key +# protocols (specifically this will enable `modifyOtherKeys`), among other +# features. An option exists in vim to modify this: `:set +# keyprotocol=ghostty:kitty`, however a bug in the implementation prevents it +# from working properly. https://github.com/vim/vim/pull/13211 fixes this. +term = xterm-ghostty + +# String to send when we receive `ENQ` (`0x05`) from the command that we are +# running. Defaults to an empty string if not set. +enquiry-response = + +# Control the auto-update functionality of Ghostty. This is only supported +# on macOS currently, since Linux builds are distributed via package +# managers that are not centrally controlled by Ghostty. +# +# Checking or downloading an update does not send any information to +# the project beyond standard network information mandated by the +# underlying protocols. To put it another way: Ghostty doesn't explicitly +# add any tracking to the update process. The update process works by +# downloading information about the latest version and comparing it +# client-side to the current version. +# +# Valid values are: +# +# * `off` - Disable auto-updates. +# * `check` - Check for updates and notify the user if an update is +# available, but do not automatically download or install the update. +# * `download` - Check for updates, automatically download the update, +# notify the user, but do not automatically install the update. +# +# If unset, we defer to Sparkle's default behavior, which respects the +# preference stored in the standard user defaults (`defaults(1)`). +# +# Changing this value at runtime works after a small delay. +auto-update = + +# The release channel to use for auto-updates. +# +# The default value of this matches the release channel of the currently +# running Ghostty version. If you download a pre-release version of Ghostty +# then this will be set to `tip` and you will receive pre-release updates. +# If you download a stable version of Ghostty then this will be set to +# `stable` and you will receive stable updates. +# +# Valid values are: +# +# * `stable` - Stable, tagged releases such as "1.0.0". +# * `tip` - Pre-release versions generated from each commit to the +# main branch. This is the version that was in use during private +# beta testing by thousands of people. It is generally stable but +# will likely have more bugs than the stable channel. +# +# Changing this configuration requires a full restart of +# Ghostty to take effect. +# +# This only works on macOS since only macOS has an auto-update feature. +auto-update-channel = + diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index db74b545..5f6279af 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -28,7 +28,7 @@ monitor=HDMI-A-1,prefered,auto,1 # See https://wiki.hyprland.org/Configuring/Keywords/ # Set programs that you use -$terminal = alacritty +$terminal = {{terminal}} $fileManager = $terminal -e yazi $menu = wofi --show drun -ib $browser = floorp diff --git a/config/joshuto/bookmarks.toml b/config/joshuto/bookmarks.toml deleted file mode 100644 index 7f56a84b..00000000 --- a/config/joshuto/bookmarks.toml +++ /dev/null @@ -1,6 +0,0 @@ -bookmark = [ - {key = "r", path = "/"}, - {key = "e", path = "/etc"}, - - {key = "h", path = "~/"}, -] diff --git a/config/joshuto/joshuto.toml b/config/joshuto/joshuto.toml deleted file mode 100644 index 3cdd52b7..00000000 --- a/config/joshuto/joshuto.toml +++ /dev/null @@ -1,51 +0,0 @@ -numbered_command = false - -use_trash = true -watch_files = true -xdg_open = false -xdg_open_fork = false - - -[display] -# default, hsplit -mode = "default" - -automatically_count_files = false -collapse_preview = true -# ratios for parent view (optional), current view and preview -column_ratio = [ 1, 4, 4 ] -scroll_offset = 6 -show_borders = true -show_hidden = false -show_icons = true -tilde_in_titlebar = true -# none, absolute, relative -line_number_style = "none" - -# size, mtime, user, gourp, perm. can be combined with |. -# `none` to disable, `all` to enable all -# all and none can't be combined with other options -linemode = "size" - -[display.sort] -# lexical, mtime, natural, size, ext -sort_method = "natural" -case_sensitive = false -directories_first = true -reverse = false - -[preview] -max_preview_size = 2097152 # 2MB -preview_script = "~/.config/joshuto/preview_file.sh" # make sure it's marked as executable - -[search] -# insensitive, sensitive, smart -string_case_sensitivity = "insensitive" -# see above -glob_case_sensitivity = "sensitive" -# see above -fzf_case_sensitivity = "insensitive" - -[tab] -# inherit, home, root -home_page = "home" diff --git a/config/joshuto/keymap.toml b/config/joshuto/keymap.toml deleted file mode 100644 index 6552cc62..00000000 --- a/config/joshuto/keymap.toml +++ /dev/null @@ -1,172 +0,0 @@ -[default_view] - -keymap = [ - {keys = [ "escape" ], command = "escape"}, - {keys = [ "ctrl+t" ], command = "new_tab"}, - {keys = [ "alt+t" ], command = "new_tab --cursor"}, - {keys = [ "T" ], command = "new_tab --current"}, - {keys = [ "W" ], command = "close_tab"}, - {keys = [ "ctrl+w" ], command = "close_tab"}, - {keys = [ "q" ], command = "close_tab"}, - {keys = [ "ctrl+c" ], command = "quit"}, - {keys = [ "Q" ], command = "quit --output-current-directory"}, - - {keys = [ "R" ], command = "reload_dirlist"}, - {keys = [ "z", "h" ], command = "toggle_hidden"}, - {keys = [ "ctrl+h" ], command = "toggle_hidden"}, - {keys = [ "\t" ], command = "tab_switch 1"}, - {keys = [ "backtab" ], command = "tab_switch -1"}, - - {keys = [ "alt+1" ], command = "tab_switch_index 1"}, - {keys = [ "alt+2" ], command = "tab_switch_index 2"}, - {keys = [ "alt+3" ], command = "tab_switch_index 3"}, - {keys = [ "alt+4" ], command = "tab_switch_index 4"}, - {keys = [ "alt+5" ], command = "tab_switch_index 5"}, - - {keys = [ "1" ], command = "numbered_command 1"}, - {keys = [ "2" ], command = "numbered_command 2"}, - {keys = [ "3" ], command = "numbered_command 3"}, - {keys = [ "4" ], command = "numbered_command 4"}, - {keys = [ "5" ], command = "numbered_command 5"}, - {keys = [ "6" ], command = "numbered_command 6"}, - {keys = [ "7" ], command = "numbered_command 7"}, - {keys = [ "8" ], command = "numbered_command 8"}, - {keys = [ "9" ], command = "numbered_command 9"}, - - # arrow keys - {keys = [ "arrow_up" ], command = "cursor_move_up"}, - {keys = [ "arrow_down" ], command = "cursor_move_down"}, - {keys = [ "arrow_left" ], command = "cd .."}, - {keys = [ "arrow_right" ], command = "open"}, - {keys = [ "\n" ], command = "open"}, - {keys = [ "home" ], command = "cursor_move_home"}, - {keys = [ "end" ], command = "cursor_move_end"}, - {keys = [ "page_up" ], command = "cursor_move_page_up"}, - {keys = [ "page_down" ], command = "cursor_move_page_down"}, - {keys = [ "ctrl+u" ], command = "cursor_move_page_up 0.5"}, - {keys = [ "ctrl+d" ], command = "cursor_move_page_down 0.5"}, - {keys = [ "ctrl+b" ], command = "cursor_move_page_up"}, - {keys = [ "ctrl+f" ], command = "cursor_move_page_down"}, - - # vim-like keybindings - {keys = [ "j" ], command = "cursor_move_down"}, - {keys = [ "k" ], command = "cursor_move_up"}, - {keys = [ "h" ], command = "cd .."}, - {keys = [ "l" ], command = "open"}, - {keys = [ "g", "g" ], command = "cursor_move_home"}, - {keys = [ "G" ], command = "cursor_move_end"}, - {keys = [ "r" ], command = "open_with"}, - - {keys = [ "H" ], command = "cursor_move_page_home"}, - {keys = [ "L" ], command = "cursor_move_page_middle"}, - {keys = [ "M" ], command = "cursor_move_page_end"}, - - {keys = [ "[" ], command = "parent_cursor_move_up"}, - {keys = [ "]" ], command = "parent_cursor_move_down"}, - - {keys = [ "c", "d" ], command = ":cd "}, - {keys = [ "d", "d" ], command = "cut_files"}, - {keys = [ "y", "y" ], command = "copy_files"}, - {keys = [ "y", "n" ], command = "copy_filename"}, - {keys = [ "y", "." ], command = "copy_filename_without_extension"}, - {keys = [ "y", "p" ], command = "copy_filepath"}, - {keys = [ "y", "a" ], command = "copy_filepath --all-selected=true"}, - {keys = [ "y", "d" ], command = "copy_dirpath"}, - - {keys = [ "p", "l" ], command = "symlink_files --relative=false"}, - {keys = [ "p", "L" ], command = "symlink_files --relative=true"}, - - {keys = [ "delete" ], command = "delete_files"}, - {keys = [ "d", "D" ], command = "delete_files"}, - - {keys = [ "p", "p" ], command = "paste_files"}, - {keys = [ "p", "o" ], command = "paste_files --overwrite=true"}, - - {keys = [ "a" ], command = "rename_append"}, - {keys = [ "A" ], command = "rename_prepend"}, - - {keys = [ "f", "t" ], command = ":touch "}, - - {keys = [ " " ], command = "select --toggle=true"}, - {keys = [ "t" ], command = "select --all=true --toggle=true"}, - {keys = [ "V" ], command = "toggle_visual"}, - - {keys = [ "w" ], command = "show_tasks --exit-key=w"}, - {keys = [ "b", "b" ], command = "bulk_rename"}, - {keys = [ "=" ], command = "set_mode"}, - - {keys = [ ":" ], command = ":"}, - {keys = [ ";" ], command = ":"}, - - {keys = [ "'" ], command = ":shell "}, - {keys = [ "m", "k" ], command = ":mkdir "}, - {keys = [ "c", "w" ], command = ":rename "}, - - {keys = [ "/" ], command = ":search "}, - {keys = [ "|" ], command = ":search_inc "}, - {keys = [ "\\" ], command = ":search_glob "}, - {keys = [ "S" ], command = "search_fzf"}, - {keys = [ "C" ], command = "subdir_fzf"}, - - {keys = [ "n" ], command = "search_next"}, - {keys = [ "N" ], command = "search_prev"}, - - {keys = [ "s", "r" ], command = "sort reverse"}, - {keys = [ "s", "l" ], command = "sort lexical"}, - {keys = [ "s", "m" ], command = "sort mtime"}, - {keys = [ "s", "n" ], command = "sort natural"}, - {keys = [ "s", "s" ], command = "sort size"}, - {keys = [ "s", "e" ], command = "sort ext"}, - - {keys = [ "m", "s" ], command = "linemode size"}, - {keys = [ "m", "m" ], command = "linemode mtime"}, - {keys = [ "m", "M" ], command = "linemode size | mtime"}, - {keys = [ "m", "u" ], command = "linemode user"}, - {keys = [ "m", "U" ], command = "linemode user | group"}, - {keys = [ "m", "p" ], command = "linemode perm"}, - - {keys = [ "g", "r" ], command = "cd /"}, - {keys = [ "g", "c" ], command = "cd ~/.config"}, - {keys = [ "g", "d" ], command = "cd ~/Downloads"}, - {keys = [ "g", "e" ], command = "cd /etc"}, - {keys = [ "g", "h" ], command = "cd ~/"}, - {keys = [ "?" ], command = "help"}, -] - -[task_view] - -keymap = [ - # arrow keys - {keys = [ "arrow_up" ], command = "cursor_move_up"}, - {keys = [ "arrow_down" ], command = "cursor_move_down"}, - {keys = [ "home" ], command = "cursor_move_home"}, - {keys = [ "end" ], command = "cursor_move_end"}, - - # vim-like keybindings - {keys = [ "j" ], command = "cursor_move_down"}, - {keys = [ "k" ], command = "cursor_move_up"}, - {keys = [ "g", "g" ], command = "cursor_move_home"}, - {keys = [ "G" ], command = "cursor_move_end"}, - - {keys = [ "w" ], command = "show_tasks"}, - {keys = [ "escape" ], command = "show_tasks"}, -] - -[help_view] - -keymap = [ - # arrow keys - {keys = [ "arrow_up" ], command = "cursor_move_up"}, - {keys = [ "arrow_down" ], command = "cursor_move_down"}, - {keys = [ "home" ], command = "cursor_move_home"}, - {keys = [ "end" ], command = "cursor_move_end"}, - - # vim-like keybindings - {keys = [ "j" ], command = "cursor_move_down"}, - {keys = [ "k" ], command = "cursor_move_up"}, - {keys = [ "g", "g" ], command = "cursor_move_home"}, - {keys = [ "G" ], command = "cursor_move_end"}, - - {keys = [ "w" ], command = "show_tasks"}, - {keys = [ "escape" ], command = "show_tasks"}, -] diff --git a/config/joshuto/mimetype.toml b/config/joshuto/mimetype.toml deleted file mode 100644 index 3db51a10..00000000 --- a/config/joshuto/mimetype.toml +++ /dev/null @@ -1,229 +0,0 @@ -[class] -audio_default = [ - {command = "mpv", args = [ - "--", - ]}, - {command = "mediainfo", confirm_exit = true}, -] - -image_default = [ - {command = "qimgv", args = [ - "--", - ], fork = true, silent = true}, - {command = "krita", args = [ - "--", - ], fork = true, silent = true}, - {command = "exiftool", confirm_exit = true}, - {command = "swappy", args = [ - "-f", - ], fork = true}, -] - -video_default = [ - {command = "mpv", args = [ - "--", - ], fork = true, silent = true}, - {command = "mediainfo", confirm_exit = true}, - {command = "mpv", args = [ - "--mute", - "on", - "--", - ], fork = true, silent = true}, -] - -text_default = [ - {command = "micro"}, - {command = "gedit", fork = true, silent = true}, - {command = "bat", args = [ - "--paging=always", - ]}, -] - -reader_default = [ {command = "evince", fork = true, silent = true} ] - -libreoffice_default = [ {command = "libreoffice", fork = true, silent = true} ] - -[extension] - -## image formats -avif.inherit = "image_default" -bmp.inherit = "image_default" -gif.inherit = "image_default" -heic.inherit = "image_default" -jpeg.inherit = "image_default" -jpe.inherit = "image_default" -jpg.inherit = "image_default" -pgm.inherit = "image_default" -png.inherit = "image_default" -ppm.inherit = "image_default" -webp.inherit = "image_default" - -svg.app_list = [ - {command = "inkview", fork = true, silent = true}, - {command = "inkscape", fork = true, silent = true}, -] -tiff.app_list = [ - {command = "qimgv", fork = true, silent = true}, - {command = "krita", fork = true, silent = true}, -] - -## audio formats -flac.inherit = "audio_default" -m4a.inherit = "audio_default" -mp3.inherit = "audio_default" -ogg.inherit = "audio_default" -wav.inherit = "audio_default" - -## video formats -avi.inherit = "video_default" -av1.inherit = "video_default" -flv.inherit = "video_default" -mkv.inherit = "video_default" -m4v.inherit = "video_default" -mov.inherit = "video_default" -mp4.inherit = "video_default" -ts.inherit = "video_default" -webm.inherit = "video_default" -wmv.inherit = "video_default" - -## text formats -build.inherit = "text_default" -c.inherit = "text_default" -cmake.inherit = "text_default" -conf.inherit = "text_default" -cpp.inherit = "text_default" -css.inherit = "text_default" -csv.inherit = "text_default" -cu.inherit = "text_default" -ebuild.inherit = "text_default" -eex.inherit = "text_default" -env.inherit = "text_default" -ex.inherit = "text_default" -exs.inherit = "text_default" -go.inherit = "text_default" -h.inherit = "text_default" -hpp.inherit = "text_default" -hs.inherit = "text_default" -html.inherit = "text_default" -ini.inherit = "text_default" -java.inherit = "text_default" -js.inherit = "text_default" -json.inherit = "text_default" -kt.inherit = "text_default" -lua.inherit = "text_default" -log.inherit = "text_default" -md.inherit = "text_default" -micro.inherit = "text_default" -ninja.inherit = "text_default" -py.inherit = "text_default" -rkt.inherit = "text_default" -rs.inherit = "text_default" -scss.inherit = "text_default" -sh.inherit = "text_default" -srt.inherit = "text_default" -svelte.inherit = "text_default" -toml.inherit = "text_default" -tsx.inherit = "text_default" -txt.inherit = "text_default" -vim.inherit = "text_default" -xml.inherit = "text_default" -yaml.inherit = "text_default" -yml.inherit = "text_default" - -# archive formats -7z.app_list = [ - {command = "7z", args = [ - "x", - ], confirm_exit = true}, - {command = "file-roller", fork = true, silent = true}, -] -bz2.app_list = [ - {command = "tar", args = [ - "-xvjf", - ], confirm_exit = true}, - {command = "file-roller", fork = true, silent = true}, -] -gz.app_list = [ - {command = "tar", args = [ - "-xvzf", - ], confirm_exit = true}, - {command = "file-roller", fork = true, silent = true}, -] -tar.app_list = [ - {command = "tar", args = [ - "-xvf", - ], confirm_exit = true}, - {command = "file-roller", fork = true, silent = true}, -] -tgz.app_list = [ - {command = "tar", args = [ - "-xvzf", - ], confirm_exit = true}, - {command = "file-roller", fork = true, silent = true}, -] -rar.app_list = [ - {command = "unrar", args = [ - "x", - ], confirm_exit = true}, - {command = "file-roller", fork = true, silent = true}, -] -xz.app_list = [ - {command = "tar", args = [ - "-xvJf", - ], confirm_exit = true}, - {command = "file-roller", fork = true, silent = true}, -] -zip.app_list = [ - {command = "unzip", confirm_exit = true}, - {command = "file-roller", fork = true, silent = true}, -] - -# misc formats -aup.app_list = [ {command = "audacity", fork = true, silent = true} ] - -m3u.app_list = [ - {command = "micro"}, - {command = "mpv"}, - {command = "gedit", fork = true, silent = true}, - {command = "bat", confirm_exit = true}, -] - -odt.inherit = "libreoffice_default" -odf.inherit = "libreoffice_default" -ods.inherit = "libreoffice_default" -odp.inherit = "libreoffice_default" - -doc.inherit = "libreoffice_default" -docx.inherit = "libreoffice_default" -xls.inherit = "libreoffice_default" -xlsx.inherit = "libreoffice_default" -ppt.inherit = "libreoffice_default" -pptx.inherit = "libreoffice_default" - -pdf.inherit = "reader_default" - -kra.app_list = [ {command = "krita", fork = true, silent = true} ] -kdenlive.app_list = [ {command = "kdenlive", fork = true, silent = true} ] - -tex.app_list = [ - {command = "micro"}, - {command = "gedit", fork = true, silent = true}, - {command = "bat", confirm_exit = true}, - {command = "pdflatex"}, -] - -torrent.app_list = [ {command = "transmission-gtk"} ] - -[mimetype] - -# application/octet-stream -[mimetype.application.subtype.octet-stream] -inherit = "video_default" - -# text/* -[mimetype.text] -inherit = "text_default" - -# text/* -[mimetype.video] -inherit = "video_default" diff --git a/config/joshuto/theme.toml b/config/joshuto/theme.toml deleted file mode 100644 index 2e14dd8b..00000000 --- a/config/joshuto/theme.toml +++ /dev/null @@ -1,111 +0,0 @@ -########################################## -## Tabs -########################################## - -# Inactive tabs -[tabs.inactive] - -# Active tabs -[tabs.active] -invert = true - -########################################## -## File List - Selections -########################################## - -# Selected files (standard selection) -[selection] -fg = "light_yellow" -bold = true - -# Files selected in current visual mode -[visual_mode_selection] -fg = "light_red" -bold = true - -[selection.prefix] -prefix = " " -size = 2 - -########################################## -## File List - System File Types -########################################## - -# Basic style, used for regular files (and also device files and FIFOs) -[regular] -fg = "white" - -# For directories -[directory] -fg = "light_blue" -bold = true - -# For symbolic links -[link] -fg = "cyan" -bold = true - -# For socket files -[socket] -fg = "light_magenta" -bold = true - -########################################## -## File List - Exceptional Files -########################################## - -# Files marked as executable -[executable] -fg = "light_green" -bold = true - -# Invalid symbolic links (pointing to non-existing target) -[link_invalid] -fg = "red" -bold = true - -########################################## -## File list - Override style by extension -########################################## -# This sections allows to override the basic -# style with a specific style for the file's -# extension. - -[ext] - -bmp.fg = "yellow" -gif.fg = "yellow" -heic.fg = "yellow" -jpg.fg = "yellow" -jpeg.fg = "yellow" -pgm.fg = "yellow" -png.fg = "yellow" -ppm.fg = "yellow" -svg.fg = "yellow" - -wav.fg = "magenta" -flac.fg = "magenta" -mp3.fg = "magenta" -amr.fg = "magenta" - -avi.fg = "magenta" -flv.fg = "magenta" -m3u.fg = "magenta" -m4a.fg = "magenta" -m4v.fg = "magenta" -mkv.fg = "magenta" -mov.fg = "magenta" -mp4.fg = "magenta" -mpg.fg = "magenta" -rmvb.fg = "magenta" -webm.fg = "magenta" -wmv.fg = "magenta" - -7z.fg = "red" -bz2.fg = "red" -gz.fg = "red" -rar.fg = "red" -tar.fg = "red" -tgz.fg = "red" -xz.fg = "red" -zip.fg = "red" diff --git a/config/rofi/config.rasi b/config/rofi/config.rasi index 2c19aab6..83a3efd1 100644 --- a/config/rofi/config.rasi +++ b/config/rofi/config.rasi @@ -8,7 +8,7 @@ configuration { // xoffset: 0; fixed-num-lines: true; show-icons: true; - terminal: "alacritty"; + terminal: "{{terminal}}"; ssh-clicnt: "ssh"; // ssh-command: "{terminal} -e {ssh-client} {host} [-p {port}]"; // run-command: "{cmd}"; diff --git a/config/shell/env b/config/shell/env index d55df080..88c63e2b 100644 --- a/config/shell/env +++ b/config/shell/env @@ -26,7 +26,7 @@ export BROWSER="floorp" export EDITOR="nvim" export IMAGE="nsxiv" export READER="zathura" -export TERMINAL="alacritty" +export TERMINAL="{{terminal}}" export VIDEO="mpv" export VISUAL="$EDITOR" export WM="awesome" diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf index 3c671315..d7e52a03 100644 --- a/config/tmux/tmux.conf +++ b/config/tmux/tmux.conf @@ -3,6 +3,8 @@ set -g default-terminal "screen-256color" set-option -sa terminal-overrides ",Alacritty*:Tc" set-option -sa terminal-overrides ",alacritty*:Tc" set-option -sa terminal-overrides ",xterm*:Tc" +set-option -sa terminal-overrides ",Ghostty*:Tc" +set-option -sa terminal-overrides ",ghostty*:Tc" set-option -g status-position top set-option -sg escape-time 0 diff --git a/config/waybar/config b/config/waybar/config index 5e626612..8de287db 100644 --- a/config/waybar/config +++ b/config/waybar/config @@ -196,16 +196,6 @@ /* "exec": "$HOME/.config/waybar/scripts/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name */ }, - - "custom/pacman": { - "format": "{} ", - "interval": 600, // every hour - "exec": "checkupdates | wc -l", // # of updates - "exec-if": "exit 0", // always run; consider advanced run conditions - "on-click": "alacritty -e paru -Syu --noconfirm; pkill -RTMIN+8 waybar", // update system - "signal": 8 - }, - "custom/weather": { "exec": "curl 'https://wttr.in/?format=1'", "interval": 600, diff --git a/config/xplr/hack.lua b/config/xplr/hack.lua deleted file mode 100644 index 2c3274d3..00000000 --- a/config/xplr/hack.lua +++ /dev/null @@ -1,59 +0,0 @@ ----@diagnostic disable -local xplr = xplr -- The globally exposed configuration to be overridden. ----@diagnostic enable - --- -- Preview images using imv. --- xplr.config.modes.builtin.default.key_bindings.on_key.P = { --- help = "preview", --- messages = { --- { --- BashExecSilently0 = [===[ --- FIFO_PATH="/tmp/xplr.fifo" --- --- if [ -e "$FIFO_PATH" ]; then --- "$XPLR" -m StopFifo --- rm -f -- "$FIFO_PATH" --- else --- mkfifo "$FIFO_PATH" --- "$HOME/.local/bin/imv-open" "$FIFO_PATH" "$XPLR_FOCUS_PATH" & --- "$XPLR" -m 'StartFifo: %q' "$FIFO_PATH" --- fi --- ]===], --- }, --- }, --- } --- --- -- Batch rename the selected or visible files and directories in `$PWD`. --- xplr.config.modes.builtin.default.key_bindings.on_key.R = { --- help = "batch rename", --- messages = { --- { --- BashExec = [===[ --- SELECTION=$(cat "${XPLR_PIPE_SELECTION_OUT:?}") --- NODES=${SELECTION:-$(cat "${XPLR_PIPE_DIRECTORY_NODES_OUT:?}")} --- if [ "$NODES" ]; then --- echo -e "$NODES" | renamer --- "$XPLR" -m ExplorePwdAsync --- fi --- ]===], --- }, --- }, --- } --- --- -- Serve `$PWD` using a static web server via LAN. --- xplr.config.modes.builtin.default.key_bindings.on_key.S = { --- help = "serve $PWD", --- messages = { --- { --- BashExec0 = [===[ --- IP=$(ip addr | rg -w inet | cut -d/ -f1 | rg -Eo '[0-9]{1,3}\.[0-9]{ 1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sk --prompt 'Select IP > ') --- echo "IP: ${IP:?}" --- read -p "Port (default 5000): " PORT --- echo --- sfz --all --cors --no-ignore --bind ${IP:?} --port ${PORT:-5000} . & --- sleep 1 && read -p '[press enter to exit]' --- kill -9 %1 --- ]===], --- }, --- }, --- } diff --git a/config/xplr/init.lua b/config/xplr/init.lua deleted file mode 100644 index 5b47fc4b..00000000 --- a/config/xplr/init.lua +++ /dev/null @@ -1,48 +0,0 @@ ----@diagnostic disable -local xplr = xplr -- The globally exposed configuration to be overridden. ----@diagnostic enable - --- This is the built-in configuration file that gets loaded and sets the --- default values when xplr loads, before loading any other custom --- configuration file. --- --- You can use this file as a reference to create a your custom config file. --- --- To create a custom configuration file, you need to define the script version --- for compatibility checks. --- --- See https://xplr.dev/en/upgrade-guide --- --- ```lua -version = "0.21.3" - -local home = os.getenv("HOME") -local xpm_path = home .. "/.local/share/xplr/dtomvan/xpm.xplr" -local xpm_url = "https://github.com/dtomvan/xpm.xplr" - -package.path = package.path .. ";" .. xpm_path .. "/?.lua;" .. xpm_path .. "/?/init.lua" - -os.execute(string.format("[ -e '%s' ] || git clone '%s' '%s'", xpm_path, xpm_url, xpm_path)) - -require("xpm").setup({ - plugins = { - "dtomvan/xpm.xplr", - "sayanarijit/fzf.xplr", - "prncss-xyz/icons.xplr", - "sayanarijit/xclip.xplr", - "sayanarijit/trash-cli.xplr", - "sayanarijit/scp.xplr", - "sayanarijit/qrcp.xplr", - "sayanarijit/preview-tabbed.xplr", - "dtomvan/ouch.xplr", - "sayanarijit/nvim-ctrl.xplr", - "Junker/nuke.xplr", - "sayanarijit/fzf.xplr", - "sayanarijit/dragon.xplr", - "sayanarijit/alacritty.xplr", - "sayanarijit/tri-pane.xplr", - "sayanarijit/map.xplr", - }, - auto_install = true, - auto_cleanup = true, -}) diff --git a/config/xplr/init.lua.old b/config/xplr/init.lua.old deleted file mode 100644 index bca79e16..00000000 --- a/config/xplr/init.lua.old +++ /dev/null @@ -1,3079 +0,0 @@ ----@diagnostic disable -local xplr = xplr -- The globally exposed configuration to be overridden. ----@diagnostic enable - --- This is the built-in configuration file that gets loaded and sets the --- default values when xplr loads, before loading any other custom --- configuration file. --- --- You can use this file as a reference to create a your custom config file. --- --- To create a custom configuration file, you need to define the script version --- for compatibility checks. --- --- See https://xplr.dev/en/upgrade-guide --- -version = "0.20.2" - --- # Configuration ------------------------------------------------------------ --- --- xplr can be configured using [Lua][1] via a special file named `init.lua`, --- which can be placed in `~/.config/xplr/` (local to user) or `/etc/xplr/` --- (global) depending on the use case. --- --- When xplr loads, it first executes the [built-in init.lua][2] to set the --- default values, which is then overwritten by another config file, if found --- using the following lookup order: --- --- 1. `--config /path/to/init.lua` --- 2. `~/.config/xplr/init.lua` --- 3. `/etc/xplr/init.lua` --- --- The first one found will be loaded by xplr and the lookup will stop. --- --- The loaded config can be further extended using the `-C` or `--extra-config` --- command-line option. --- --- --- [1]: https://www.lua.org --- [2]: https://github.com/sayanarijit/xplr/blob/main/src/init.lua --- [3]: https://xplr.dev/en/upgrade-guide - --- ## Config ------------------------------------------------------------------ --- --- The xplr configuration, exposed via `xplr.config` Lua API contains the --- following sections. --- --- See: --- --- * [xplr.config.general](https://xplr.dev/en/general-config) --- * [xplr.config.node_types](https://xplr.dev/en/node_types) --- * [xplr.config.layouts](https://xplr.dev/en/layouts) --- * [xplr.config.modes](https://xplr.dev/en/modes) - --- ### General Configuration -------------------------------------------------- --- --- The general configuration properties are grouped together in --- `xplr.config.general`. - --- Set it to `true` if you want to ignore the startup errors. You can still see --- the errors in the logs. --- --- Type: boolean -xplr.config.general.disable_debug_error_mode = false - --- Set it to `true` if you want to enable mouse scrolling. --- --- Type: boolean -xplr.config.general.enable_mouse = false - --- Set it to `true` to show hidden files by default. --- --- Type: boolean -xplr.config.general.show_hidden = true - --- Set it to `true` to use only a subset of selected operations that forbids --- executing commands or performing write operations on the file-system. --- --- Type: boolean -xplr.config.general.read_only = false - --- Set it to `true` if you want to enable a safety feature that will save you --- from yourself when you type recklessly. --- --- Type: boolean -xplr.config.general.enable_recover_mode = false - --- Set it to `true` if you want to hide all remaps in the help menu. --- --- Type: boolean -xplr.config.general.hide_remaps_in_help_menu = false - --- Set it to `true` if you want the cursor to stay in the same position when --- the focus is on the first path and you navigate to the previous path --- (by pressing `up`/`k`), or when the focus is on the last path and you --- navigate to the next path (by pressing `down`/`j`). --- The default behavior is to rotate from the last/first path. --- --- Type: boolean -xplr.config.general.enforce_bounded_index_navigation = false - --- This is the shape of the prompt for the input buffer. --- --- Type: nullable string -xplr.config.general.prompt.format = "❯ " - --- This is the style of the prompt for the input buffer. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.prompt.style = {} - --- The string to indicate an information in logs. --- --- Type: nullable string -xplr.config.general.logs.info.format = "INFO" - --- The style for the information logs. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.logs.info.style = { fg = "LightBlue" } - --- The string to indicate an success in logs. --- --- Type: nullable string -xplr.config.general.logs.success.format = "SUCCESS" - --- The style for the success logs. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.logs.success.style = { fg = "Green" } - --- The string to indicate an warnings in logs. --- --- Type: nullable string -xplr.config.general.logs.warning.format = "WARNING" - --- The style for the warnings logs. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.logs.warning.style = { fg = "Yellow" } - --- The string to indicate an error in logs. --- --- Type: nullable string -xplr.config.general.logs.error.format = "ERROR" - --- The style for the error logs. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.logs.error.style = { fg = "Red" } - --- Columns to display in the table header. --- --- Type: nullable list of tables with the following fields: --- --- * format: nullable string --- * style: [Style](https://xplr.dev/en/style) -xplr.config.general.table.header.cols = { - { format = " index", style = {} }, - { format = "╭─── path", style = {} }, - { format = "permissions", style = {} }, - { format = "size", style = {} }, - { format = "modified", style = {} }, -} - --- Style of the table header. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.table.header.style = {} - --- Height of the table header. --- --- Type: nullable integer -xplr.config.general.table.header.height = 1 - --- Columns to display in each row in the table. --- --- Type: nullable list of tables with the following fields: --- --- * format: nullable string --- * style: [Style](https://xplr.dev/en/style) -xplr.config.general.table.row.cols = { - { - format = "builtin.fmt_general_table_row_cols_0", - style = {}, - }, - { - format = "builtin.fmt_general_table_row_cols_1", - style = {}, - }, - { - format = "builtin.fmt_general_table_row_cols_2", - style = {}, - }, - { - format = "builtin.fmt_general_table_row_cols_3", - style = {}, - }, - { - format = "builtin.fmt_general_table_row_cols_4", - style = {}, - }, -} - --- Default style of the table. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.table.row.style = {} - --- Height of the table rows. --- --- Type: nullable integer -xplr.config.general.table.row.height = 0 - --- Default style of the table. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.table.style = {} - --- Tree to display in the table. --- --- Type: nullable list of tables with the following fields: --- --- * format: nullable string --- * style: [Style](https://xplr.dev/en/style) -xplr.config.general.table.tree = { - { format = "├", style = {} }, - { format = "├", style = {} }, - { format = "╰", style = {} }, -} - --- Spacing between the columns in the table. --- --- Type: nullable integer -xplr.config.general.table.col_spacing = 1 - --- Constraint for the column widths. --- --- Type: nullable list of [Constraint](https://xplr.dev/en/layouts#constraint) -xplr.config.general.table.col_widths = { - { Percentage = 10 }, - { Percentage = 50 }, - { Percentage = 10 }, - { Percentage = 10 }, - { Percentage = 20 }, -} - --- The content that is placed before the item name for each row by default. --- --- Type: nullable string -xplr.config.general.default_ui.prefix = " " - --- The content which is appended to each item name for each row by default. --- --- Type: nullable string -xplr.config.general.default_ui.suffix = "" - --- The default style of each item for each row. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.default_ui.style = {} - --- The string placed before the item name for a focused row. --- --- Type: nullable string -xplr.config.general.focus_ui.prefix = "▸[" - --- The string placed after the item name for a focused row. --- --- Type: nullable string -xplr.config.general.focus_ui.suffix = "]" - --- Style for focused item. --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.focus_ui.style = { add_modifiers = { "Bold" } } - --- The string placed before the item name for a selected row. --- --- Type: nullable string -xplr.config.general.selection_ui.prefix = " {" - --- The string placed after the item name for a selected row. --- --- Type: nullable string -xplr.config.general.selection_ui.suffix = "}" - --- Style for selected rows. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.selection_ui.style = { - fg = "DarkGray", - add_modifiers = { "CrossedOut" }, -} - --- The string placed before item name for a selected row that gets the focus. --- --- Type: nullable string -xplr.config.general.focus_selection_ui.prefix = "▸[" - --- The string placed after the item name for a selected row that gets the focus. --- --- Type: nullable string -xplr.config.general.focus_selection_ui.suffix = "]" - --- Style for a selected row that gets the focus. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.focus_selection_ui.style = { - add_modifiers = { "Bold", "CrossedOut" }, -} - --- The shape of the separator for the Sort & filter panel. --- --- Type: nullable string -xplr.config.general.sort_and_filter_ui.separator.format = " › " - --- The style of the separator for the Sort & filter panel. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.sort_and_filter_ui.separator.style = { - add_modifiers = { "Dim" }, -} - --- The content of the default identifier in Sort & filter panel. --- --- Type: nullable string -xplr.config.general.sort_and_filter_ui.default_identifier.format = nil - --- Style for the default identifier in Sort & filter panel. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.sort_and_filter_ui.default_identifier.style = {} - --- The shape of the forward direction indicator for sort identifiers in Sort & filter panel. --- --- Type: nullable string -xplr.config.general.sort_and_filter_ui.sort_direction_identifiers.forward.format = "↓" - --- Style of forward direction indicator in Sort & filter panel. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.sort_and_filter_ui.sort_direction_identifiers.forward.style = nil - --- The shape of the reverse direction indicator for sort identifiers in Sort & filter panel. --- --- Type: nullable string -xplr.config.general.sort_and_filter_ui.sort_direction_identifiers.reverse.format = "↑" - --- Style of reverse direction indicator in Sort & filter panel. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.sort_and_filter_ui.sort_direction_identifiers.reverse.style = nil - --- The identifiers used to denote applied sorters in the Sort & filter panel. --- --- Type: nullable mapping of the following key-value pairs: --- --- * key: [Sorter](https://xplr.dev/en/sorting#sorter) --- * value: --- * format: nullable string --- * style: [Style](https://xplr.dev/en/style) -xplr.config.general.sort_and_filter_ui.sorter_identifiers = { - ByExtension = { format = "ext", style = {} }, - ByICanonicalAbsolutePath = { format = "[ci]abs", style = {} }, - ByIRelativePath = { format = "[i]rel", style = {} }, - ByISymlinkAbsolutePath = { format = "[si]abs", style = {} }, - ByIsBroken = { format = "⨯", style = {} }, - ByIsDir = { format = "dir", style = {} }, - ByIsFile = { format = "file", style = {} }, - ByIsReadonly = { format = "ro", style = {} }, - ByIsSymlink = { format = "sym", style = {} }, - ByMimeEssence = { format = "mime", style = {} }, - ByRelativePath = { format = "rel", style = {} }, - BySize = { format = "size", style = {} }, - ByCreated = { format = "created", style = {} }, - ByLastModified = { format = "modified", style = {} }, - ByCanonicalAbsolutePath = { format = "[c]abs", style = {} }, - ByCanonicalExtension = { format = "[c]ext", style = {} }, - ByCanonicalIsDir = { format = "[c]dir", style = {} }, - ByCanonicalIsFile = { format = "[c]file", style = {} }, - ByCanonicalIsReadonly = { format = "[c]ro", style = {} }, - ByCanonicalMimeEssence = { format = "[c]mime", style = {} }, - ByCanonicalSize = { format = "[c]size", style = {} }, - ByCanonicalCreated = { format = "[c]created", style = {} }, - ByCanonicalLastModified = { format = "[c]modified", style = {} }, - BySymlinkAbsolutePath = { format = "[s]abs", style = {} }, - BySymlinkExtension = { format = "[s]ext", style = {} }, - BySymlinkIsDir = { format = "[s]dir", style = {} }, - BySymlinkIsFile = { format = "[s]file", style = {} }, - BySymlinkIsReadonly = { format = "[s]ro", style = {} }, - BySymlinkMimeEssence = { format = "[s]mime", style = {} }, - BySymlinkSize = { format = "[s]size", style = {} }, - BySymlinkCreated = { format = "[s]created", style = {} }, - BySymlinkLastModified = { format = "[s]modified", style = {} }, -} - --- The identifiers used to denote applied filters in the Sort & filter panel. --- --- Type: nullable mapping of the following key-value pairs: --- --- * key: [Filter](https://xplr.dev/en/filtering#filter) --- * value: --- * format: nullable string --- * style: [Style](https://xplr.dev/en/style) -xplr.config.general.sort_and_filter_ui.filter_identifiers = { - RelativePathDoesContain = { format = "rel=~", style = {} }, - RelativePathDoesEndWith = { format = "rel=$", style = {} }, - RelativePathDoesNotContain = { format = "rel!~", style = {} }, - RelativePathDoesNotEndWith = { format = "rel!$", style = {} }, - RelativePathDoesNotStartWith = { format = "rel!^", style = {} }, - RelativePathDoesStartWith = { format = "rel=^", style = {} }, - RelativePathIs = { format = "rel==", style = {} }, - RelativePathIsNot = { format = "rel!=", style = {} }, - RelativePathDoesMatchRegex = { format = "rel=/", style = {} }, - RelativePathDoesNotMatchRegex = { format = "rel!/", style = {} }, - IRelativePathDoesContain = { format = "[i]rel=~", style = {} }, - IRelativePathDoesEndWith = { format = "[i]rel=$", style = {} }, - IRelativePathDoesNotContain = { format = "[i]rel!~", style = {} }, - IRelativePathDoesNotEndWith = { format = "[i]rel!$", style = {} }, - IRelativePathDoesNotStartWith = { format = "[i]rel!^", style = {} }, - IRelativePathDoesStartWith = { format = "[i]rel=^", style = {} }, - IRelativePathIs = { format = "[i]rel==", style = {} }, - IRelativePathIsNot = { format = "[i]rel!=", style = {} }, - IRelativePathDoesMatchRegex = { format = "[i]rel=/", style = {} }, - IRelativePathDoesNotMatchRegex = { format = "[i]rel!/", style = {} }, - AbsolutePathDoesContain = { format = "abs=~", style = {} }, - AbsolutePathDoesEndWith = { format = "abs=$", style = {} }, - AbsolutePathDoesNotContain = { format = "abs!~", style = {} }, - AbsolutePathDoesNotEndWith = { format = "abs!$", style = {} }, - AbsolutePathDoesNotStartWith = { format = "abs!^", style = {} }, - AbsolutePathDoesStartWith = { format = "abs=^", style = {} }, - AbsolutePathIs = { format = "abs==", style = {} }, - AbsolutePathIsNot = { format = "abs!=", style = {} }, - AbsolutePathDoesMatchRegex = { format = "abs=/", style = {} }, - AbsolutePathDoesNotMatchRegex = { format = "abs!/", style = {} }, - IAbsolutePathDoesContain = { format = "[i]abs=~", style = {} }, - IAbsolutePathDoesEndWith = { format = "[i]abs=$", style = {} }, - IAbsolutePathDoesNotContain = { format = "[i]abs!~", style = {} }, - IAbsolutePathDoesNotEndWith = { format = "[i]abs!$", style = {} }, - IAbsolutePathDoesNotStartWith = { format = "[i]abs!^", style = {} }, - IAbsolutePathDoesStartWith = { format = "[i]abs=^", style = {} }, - IAbsolutePathIs = { format = "[i]abs==", style = {} }, - IAbsolutePathIsNot = { format = "[i]abs!=", style = {} }, - IAbsolutePathDoesMatchRegex = { format = "[i]abs=/", style = {} }, - IAbsolutePathDoesNotMatchRegex = { format = "[i]abs!/", style = {} }, -} - --- The identifiers used to denote applied search input. --- --- Type: { format = nullable string, style = [Style](https://xplr.dev/en/style) } -xplr.config.general.sort_and_filter_ui.search_identifier = { - format = "search:", - style = {}, -} - --- The content for panel title by default. --- --- Type: nullable string -xplr.config.general.panel_ui.default.title.format = nil - --- The style for panel title by default. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.default.title.style = { - fg = "Reset", - add_modifiers = { "Bold" }, -} - --- Style of the panels by default. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.default.style = {} - --- Defines where to show borders for the panels by default. --- --- Type: nullable list of [Border](https://xplr.dev/en/borders#border) -xplr.config.general.panel_ui.default.borders = { - "Top", - "Right", - "Bottom", - "Left", -} - --- Type of the borders by default. --- --- Type: nullable [Border Type](https://xplr.dev/en/borders#border-type) -xplr.config.general.panel_ui.default.border_type = "Rounded" - --- Style of the panel borders by default. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.default.border_style = { fg = "DarkGray" } - --- The content for the table panel title. --- --- Type: nullable string -xplr.config.general.panel_ui.table.title.format = nil - --- Style of the table panel title. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.table.title.style = {} - --- Style of the table panel. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.table.style = {} - --- Defines where to show borders for the table panel. --- --- Type: nullable list of [Border](https://xplr.dev/en/borders#border) -xplr.config.general.panel_ui.table.borders = nil - --- Type of the borders for table panel. --- --- Type: nullable [Border Type](https://xplr.dev/en/borders#border-type) -xplr.config.general.panel_ui.table.border_type = nil - --- Style of the table panel borders. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.table.border_style = {} - --- The content for the help menu panel title. --- --- Type: nullable string -xplr.config.general.panel_ui.help_menu.title.format = nil - --- Style of the help menu panel title. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.help_menu.title.style = {} - --- Style of the help menu panel. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.help_menu.style = {} - --- Defines where to show borders for the help menu panel. --- --- Type: nullable list of [Border](https://xplr.dev/en/borders#border) -xplr.config.general.panel_ui.help_menu.borders = nil - --- Type of the borders for help menu panel. --- --- Type: nullable [Border Type](https://xplr.dev/en/borders#border-type) -xplr.config.general.panel_ui.help_menu.border_type = nil - --- Style of the help menu panel borders. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.help_menu.border_style = {} - --- The content for the input & logs panel title. --- --- Type: nullable string -xplr.config.general.panel_ui.input_and_logs.title.format = nil - --- Style of the input & logs panel title. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.input_and_logs.title.style = {} - --- Style of the input & logs panel. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.input_and_logs.style = {} --- Defines where to show borders for the input & logs panel. --- --- Type: nullable list of [Border](https://xplr.dev/en/borders#border) -xplr.config.general.panel_ui.input_and_logs.borders = nil - --- Type of the borders for input & logs panel. --- --- Type: nullable [Border Type](https://xplr.dev/en/borders#border-type) -xplr.config.general.panel_ui.input_and_logs.border_type = nil - --- Style of the input & logs panel borders. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.input_and_logs.border_style = {} - --- The content for the selection panel title. --- --- Type: nullable string -xplr.config.general.panel_ui.selection.title.format = nil - --- Style of the selection panel title. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.selection.title.style = {} - --- Style of the selection panel. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.selection.style = {} --- Defines where to show borders for the selection panel. --- --- Type: nullable list of [Border](https://xplr.dev/en/borders#border) -xplr.config.general.panel_ui.selection.borders = nil - --- Type of the borders for selection panel. --- --- Type: nullable [Border Type](https://xplr.dev/en/borders#border-type) -xplr.config.general.panel_ui.selection.border_type = nil - --- Style of the selection panel borders. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.selection.border_style = {} - --- The content for the sort & filter panel title. --- --- Type: nullable string -xplr.config.general.panel_ui.sort_and_filter.title.format = nil - --- Style of the sort & filter panel title. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.sort_and_filter.title.style = {} - --- Style of the sort & filter panel. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.sort_and_filter.style = {} - --- Defines where to show borders for the sort & filter panel. --- --- Type: nullable list of [Border](https://xplr.dev/en/borders#border) -xplr.config.general.panel_ui.sort_and_filter.borders = nil - --- Type of the borders for sort & filter panel. --- --- Type: nullable [Border Type](https://xplr.dev/en/borders#border-type) -xplr.config.general.panel_ui.sort_and_filter.border_type = nil - --- Style of the sort & filter panel borders. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.general.panel_ui.sort_and_filter.border_style = {} - --- Initial group if sorters applied to the nodes list in the table. --- --- Type: nullable list of [Node Sorter](https://xplr.dev/en/sorting#node-sorter-applicable) -xplr.config.general.initial_sorting = { - { sorter = "ByCanonicalIsDir", reverse = true }, - { sorter = "ByIRelativePath", reverse = false }, -} - --- The name of one of the modes to use when xplr loads. --- --- Type: nullable string -xplr.config.general.initial_mode = "default" - --- The name of one of the layouts to use when xplr loads. --- --- Type: nullable string -xplr.config.general.initial_layout = "default" - --- Set it to a file path to start fifo when xplr loads. --- Generally it is used to integrate with external tools like previewers. --- --- Type: nullable string -xplr.config.general.start_fifo = nil - --- Use it to define a set of key bindings that are available by default in --- every [mode](https://xplr.dev/en/mode). They can be overwritten. --- --- Type: [Key Bindings](https://xplr.dev/en/configure-key-bindings#key-bindings) -xplr.config.general.global_key_bindings = { - on_key = { - ["esc"] = { - messages = { - "PopMode", - }, - }, - ["ctrl-c"] = { - messages = { - "Terminate", - }, - }, - }, -} - --- ### Node Types ------------------------------------------------------------- --- --- This section defines how to deal with different kinds of nodes (files, --- directories, symlinks etc.) based on their properties. --- --- One node can fall into multiple categories. For example, a node can have the --- *extension* `md`, and also be a *file*. In that case, the properties from --- the more specific category i.e. *extension* will be used. --- --- This can be configured using the `xplr.config.node_types` Lua API. - --- The style for the directory nodes --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.node_types.directory.style = { - fg = "Blue", -} - --- Metadata for the directory nodes. --- You can set as many metadata as you want. --- --- Type: nullable string --- --- Example: --- --- ```lua --- xplr.config.node_types.directory.meta.foo = "foo" --- xplr.config.node_types.directory.meta.bar = "bar" --- ``` -xplr.config.node_types.directory.meta.icon = "" - --- The style for the file nodes. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.node_types.file.style = {} - --- Metadata for the file nodes. --- You can set as many metadata as you want. --- --- Type: nullable string --- --- Example: --- --- ```lua --- xplr.config.node_types.file.meta.foo = "foo" --- xplr.config.node_types.file.meta.bar = "bar" --- ``` -xplr.config.node_types.file.meta.icon = "" - --- The style for the symlink nodes. --- --- Type: [Style](https://xplr.dev/en/style) -xplr.config.node_types.symlink.style = { - fg = "Cyan", - add_modifiers = { "Italic" }, -} - --- Metadata for the symlink nodes. --- You can set as many metadata as you want. --- --- Type: nullable string --- --- Example: --- --- ```lua --- xplr.config.node_types.symlink.meta.foo = "foo" --- xplr.config.node_types.symlink.meta.bar = "bar" --- ``` -xplr.config.node_types.symlink.meta.icon = "" - --- Metadata and style based on mime types. --- It is possible to use the wildcard `*` to match all mime sub types. It will --- be overwritten by the more specific sub types that are defined. --- --- Type: mapping of the following key-value pairs: --- --- * key: string --- * value: --- * key: string --- * value: [Node Type](https://xplr.dev/en/node-type) --- --- Example: --- --- ```lua --- xplr.config.node_types.mime_essence = { --- application = { --- -- application/* --- ["*"] = { meta = { icon = "a" } } --- --- -- application/pdf --- pdf = { meta = { icon = "" }, style = { fg = "Blue" } }, --- --- -- application/zip --- zip = { meta = { icon = ""} }, --- }, --- } --- ``` -xplr.config.node_types.mime_essence = { - audio = { - ["*"] = { meta = { icon = "" } }, - }, - image = { - ["*"] = { meta = { icons = "" } }, - }, - video = { - ["*"] = { meta = { icons = "" } }, - }, - text = { - ["*"] = { meta = { icons = "" } }, - }, -} - --- Metadata and style based on extension. --- --- Type: mapping of the following key-value pairs: --- --- * key: string --- * value: [Node Type](https://xplr.dev/en/node-type) --- --- Example: --- --- ```lua --- xplr.config.node_types.extension.md = { meta = { icon = "" }, style = { fg = "Blue" } } --- xplr.config.node_types.extension.rs = { meta = { icon = "🦀" } } --- ``` -xplr.config.node_types.extension = { - -- file extensions (vim-devicons) - ai = { meta = { icon = "" } }, - awk = { meta = { icon = "" } }, - bash = { meta = { icon = "" } }, - bat = { meta = { icon = "" } }, - bmp = { meta = { icon = "" } }, - c = { meta = { icon = "" } }, - cc = { meta = { icon = "" } }, - clj = { meta = { icon = "" } }, - cljc = { meta = { icon = "" } }, - cljs = { meta = { icon = "" } }, - coffee = { meta = { icon = "" } }, - conf = { meta = { icon = "" } }, - cp = { meta = { icon = "" } }, - cpp = { meta = { icon = "" } }, - cs = { meta = { icon = "" } }, - csh = { meta = { icon = "" } }, - css = { meta = { icon = "" } }, - cxx = { meta = { icon = "" } }, - ["c++"] = { meta = { icon = "" } }, - d = { meta = { icon = "" } }, - dart = { meta = { icon = "" } }, - db = { meta = { icon = "" } }, - diff = { meta = { icon = "" } }, - dump = { meta = { icon = "" } }, - edn = { meta = { icon = "" } }, - eex = { meta = { icon = "" } }, - ejs = { meta = { icon = "" } }, - elm = { meta = { icon = "" } }, - erl = { meta = { icon = "" } }, - ex = { meta = { icon = "" } }, - exs = { meta = { icon = "" } }, - fish = { meta = { icon = "" } }, - fs = { meta = { icon = "" } }, - fsi = { meta = { icon = "" } }, - fsscript = { meta = { icon = "" } }, - fsx = { meta = { icon = "" } }, - ["f#"] = { meta = { icon = "" } }, - gemspec = { meta = { icon = "" } }, - gif = { meta = { icon = "" } }, - go = { meta = { icon = "" } }, - h = { meta = { icon = "" } }, - haml = { meta = { icon = "" } }, - hbs = { meta = { icon = "" } }, - heex = { meta = { icon = "" } }, - hh = { meta = { icon = "" } }, - hpp = { meta = { icon = "" } }, - hrl = { meta = { icon = "" } }, - hs = { meta = { icon = "" } }, - htm = { meta = { icon = "" } }, - html = { meta = { icon = "" } }, - hxx = { meta = { icon = "" } }, - ico = { meta = { icon = "" } }, - ini = { meta = { icon = "" } }, - java = { meta = { icon = "" } }, - jl = { meta = { icon = "" } }, - jpeg = { meta = { icon = "" } }, - jpg = { meta = { icon = "" } }, - js = { meta = { icon = "" } }, - json = { meta = { icon = "" } }, - jsx = { meta = { icon = "" } }, - ksh = { meta = { icon = "" } }, - leex = { meta = { icon = "" } }, - less = { meta = { icon = "" } }, - lhs = { meta = { icon = "" } }, - lua = { meta = { icon = "" } }, - markdown = { meta = { icon = "" } }, - md = { meta = { icon = "" } }, - mdx = { meta = { icon = "" } }, - mjs = { meta = { icon = "" } }, - mk = { meta = { icon = "" } }, - ml = { meta = { icon = "λ" } }, - mli = { meta = { icon = "λ" } }, - mustache = { meta = { icon = "" } }, - nix = { meta = { icon = "" } }, - pem = { meta = { icon = "" } }, - php = { meta = { icon = "" } }, - pl = { meta = { icon = "" } }, - pm = { meta = { icon = "" } }, - png = { meta = { icon = "" } }, - pp = { meta = { icon = "" } }, - ps1 = { meta = { icon = "" } }, - psb = { meta = { icon = "" } }, - psd = { meta = { icon = "" } }, - py = { meta = { icon = "" } }, - pyc = { meta = { icon = "" } }, - pyd = { meta = { icon = "" } }, - pyo = { meta = { icon = "" } }, - r = { meta = { icon = "ﳒ" } }, - rake = { meta = { icon = "" } }, - rb = { meta = { icon = "" } }, - rlib = { meta = { icon = "" } }, - rmd = { meta = { icon = "" } }, - rproj = { meta = { icon = "鉶" } }, - rs = { meta = { icon = "" } }, - rss = { meta = { icon = "" } }, - sass = { meta = { icon = "" } }, - scala = { meta = { icon = "" } }, - scss = { meta = { icon = "" } }, - sh = { meta = { icon = "" } }, - slim = { meta = { icon = "" } }, - sln = { meta = { icon = "" } }, - sol = { meta = { icon = "ﲹ" } }, - sql = { meta = { icon = "" } }, - styl = { meta = { icon = "" } }, - suo = { meta = { icon = "" } }, - swift = { meta = { icon = "" } }, - t = { meta = { icon = "" } }, - tex = { meta = { icon = "ﭨ" } }, - toml = { meta = { icon = "" } }, - ts = { meta = { icon = "" } }, - tsx = { meta = { icon = "" } }, - twig = { meta = { icon = "" } }, - vim = { meta = { icon = "" } }, - vue = { meta = { icon = "﵂" } }, - webmanifest = { meta = { icon = "" } }, - webp = { meta = { icon = "" } }, - xcplayground = { meta = { icon = "" } }, - xul = { meta = { icon = "" } }, - yaml = { meta = { icon = "" } }, - yml = { meta = { icon = "" } }, - zsh = { meta = { icon = "" } }, - -- archives or compressed (extensions from dircolors defaults) - ["7z"] = { meta = { icon = "" } }, - ace = { meta = { icon = "" } }, - alz = { meta = { icon = "" } }, - arc = { meta = { icon = "" } }, - arj = { meta = { icon = "" } }, - bz = { meta = { icon = "" } }, - bz2 = { meta = { icon = "" } }, - cab = { meta = { icon = "" } }, - cpio = { meta = { icon = "" } }, - deb = { meta = { icon = "" } }, - dwm = { meta = { icon = "" } }, - dz = { meta = { icon = "" } }, - ear = { meta = { icon = "" } }, - esd = { meta = { icon = "" } }, - gz = { meta = { icon = "" } }, - jar = { meta = { icon = "" } }, - lha = { meta = { icon = "" } }, - lrz = { meta = { icon = "" } }, - lz = { meta = { icon = "" } }, - lz4 = { meta = { icon = "" } }, - lzh = { meta = { icon = "" } }, - lzma = { meta = { icon = "" } }, - lzo = { meta = { icon = "" } }, - rar = { meta = { icon = "" } }, - rpm = { meta = { icon = "" } }, - rz = { meta = { icon = "" } }, - sar = { meta = { icon = "" } }, - swm = { meta = { icon = "" } }, - t7z = { meta = { icon = "" } }, - tar = { meta = { icon = "" } }, - taz = { meta = { icon = "" } }, - tbz = { meta = { icon = "" } }, - tbz2 = { meta = { icon = "" } }, - tgz = { meta = { icon = "" } }, - tlz = { meta = { icon = "" } }, - txz = { meta = { icon = "" } }, - tz = { meta = { icon = "" } }, - tzo = { meta = { icon = "" } }, - tzst = { meta = { icon = "" } }, - war = { meta = { icon = "" } }, - wim = { meta = { icon = "" } }, - xz = { meta = { icon = "" } }, - z = { meta = { icon = "" } }, - zip = { meta = { icon = "" } }, - zoo = { meta = { icon = "" } }, - zst = { meta = { icon = "" } }, - -- image formats (extensions from dircolors defaults) - jpg = { meta = { icon = "" } }, - jpeg = { meta = { icon = "" } }, - mjpg = { meta = { icon = "" } }, - mjpeg = { meta = { icon = "" } }, - bmp = { meta = { icon = "" } }, - pbm = { meta = { icon = "" } }, - pgm = { meta = { icon = "" } }, - ppm = { meta = { icon = "" } }, - tga = { meta = { icon = "" } }, - xbm = { meta = { icon = "" } }, - xpm = { meta = { icon = "" } }, - tif = { meta = { icon = "" } }, - tiff = { meta = { icon = "" } }, - png = { meta = { icon = "" } }, - svg = { meta = { icon = "" } }, - svgz = { meta = { icon = "" } }, - pcx = { meta = { icon = "" } }, - m2v = { meta = { icon = "" } }, - ogm = { meta = { icon = "" } }, - nuv = { meta = { icon = "" } }, - rm = { meta = { icon = "" } }, - rmvb = { meta = { icon = "" } }, - flc = { meta = { icon = "" } }, - fli = { meta = { icon = "" } }, - gl = { meta = { icon = "" } }, - dl = { meta = { icon = "" } }, - xcf = { meta = { icon = "" } }, - xwd = { meta = { icon = "" } }, - cgm = { meta = { icon = "" } }, - emf = { meta = { icon = "" } }, - ogx = { meta = { icon = "" } }, - -- video formats - mkv = { meta = { icon = "" } }, - asf = { meta = { icon = "" } }, - yuv = { meta = { icon = "" } }, - avi = { meta = { icon = "" } }, - gif = { meta = { icon = "" } }, - mpg = { meta = { icon = "" } }, - mpeg = { meta = { icon = "" } }, - qt = { meta = { icon = "" } }, - mng = { meta = { icon = "" } }, - ogv = { meta = { icon = "" } }, - webm = { meta = { icon = "" } }, - vob = { meta = { icon = "" } }, - flv = { meta = { icon = "" } }, - mov = { meta = { icon = "" } }, - wmv = { meta = { icon = "" } }, - mp4 = { meta = { icon = "" } }, - m4v = { meta = { icon = "" } }, - mp4v = { meta = { icon = "" } }, - -- audio formats (extensions from dircolors defaults) - aac = { meta = { icon = "" } }, - au = { meta = { icon = "" } }, - flac = { meta = { icon = "" } }, - m4a = { meta = { icon = "" } }, - mid = { meta = { icon = "" } }, - midi = { meta = { icon = "" } }, - mka = { meta = { icon = "" } }, - mp3 = { meta = { icon = "" } }, - mpc = { meta = { icon = "" } }, - ogg = { meta = { icon = "" } }, - ra = { meta = { icon = "" } }, - wav = { meta = { icon = "" } }, - oga = { meta = { icon = "" } }, - opus = { meta = { icon = "" } }, - spx = { meta = { icon = "" } }, - xspf = { meta = { icon = "" } }, - -- other formats - pdf = { meta = { icon = "" } }, -} - --- Metadata and style based on special file names. --- --- Type: mapping of the following key-value pairs: --- --- * key: string --- * value: [Node Type](https://xplr.dev/en/node-type) --- --- Example: --- --- ```lua --- xplr.config.node_types.special["Cargo.toml"] = { meta = { icon = "" } } --- xplr.config.node_types.special["Downloads"] = { meta = { icon = "" }, style = { fg = "Blue" } } --- ``` -xplr.config.node_types.special = { - -- file names (vim-devicons) - [".DS_Store"] = { meta = { icon = "" } }, - [".bashprofile"] = { meta = { icon = "" } }, - [".bashrc"] = { meta = { icon = "" } }, - [".ds_store"] = { meta = { icon = "" } }, - [".gitattributes"] = { meta = { icon = "" } }, - [".gitconfig"] = { meta = { icon = "" } }, - [".gitignore"] = { meta = { icon = "" } }, - [".gitlab-ci.yml"] = { meta = { icon = "" } }, - [".gvimrc"] = { meta = { icon = "" } }, - [".vimrc"] = { meta = { icon = "" } }, - [".zprofile"] = { meta = { icon = "" } }, - [".zshenv"] = { meta = { icon = "" } }, - [".zshrc"] = { meta = { icon = "" } }, - ["CMakeLists.txt"] = { meta = { icon = "" } }, - ["Docker-compose.yml"] = { meta = { icon = "" } }, - ["Dockerfile"] = { meta = { icon = "" } }, - ["Dropbox"] = { meta = { icon = "" } }, - ["Gemfile"] = { meta = { icon = "" } }, - ["Gruntfile.coffee"] = { meta = { icon = "" } }, - ["Gruntfile.js"] = { meta = { icon = "" } }, - ["Gruntfile.ls"] = { meta = { icon = "" } }, - ["Gulpfile.coffee"] = { meta = { icon = "" } }, - ["Gulpfile.js"] = { meta = { icon = "" } }, - ["Gulpfile.ls"] = { meta = { icon = "" } }, - ["LICENSE"] = { meta = { icon = "" } }, - ["Makefile"] = { meta = { icon = "" } }, - ["Procfile"] = { meta = { icon = "" } }, - ["Rakefile"] = { meta = { icon = "" } }, - ["React.jsx"] = { meta = { icon = "" } }, - ["_gvimrc"] = { meta = { icon = "" } }, - ["_vimrc"] = { meta = { icon = "" } }, - ["backbone.min.js"] = { meta = { icon = "" } }, - ["cmakelists.txt"] = { meta = { icon = "" } }, - ["config.ru"] = { meta = { icon = "" } }, - ["docker-compose.yml"] = { meta = { icon = "" } }, - ["dockerfile"] = { meta = { icon = "" } }, - ["dropbox"] = { meta = { icon = "" } }, - ["favicon.ico"] = { meta = { icon = "" } }, - ["gemfile"] = { meta = { icon = "" } }, - ["gruntfile.coffee"] = { meta = { icon = "" } }, - ["gruntfile.js"] = { meta = { icon = "" } }, - ["gruntfile.ls"] = { meta = { icon = "" } }, - ["gulpfile.coffee"] = { meta = { icon = "" } }, - ["gulpfile.js"] = { meta = { icon = "" } }, - ["gulpfile.ls"] = { meta = { icon = "" } }, - ["license"] = { meta = { icon = "" } }, - ["makefile"] = { meta = { icon = "" } }, - ["mix.lock"] = { meta = { icon = "" } }, - ["node_modules"] = { meta = { icon = "" } }, - ["procfile"] = { meta = { icon = "" } }, - ["rakefile"] = { meta = { icon = "" } }, - ["react.jsx"] = { meta = { icon = "" } }, - ["robots.txt"] = { meta = { icon = "ﮧ" } }, - -- file patterns (file name adaptations) - ["Vagrantfile "] = { meta = { icon = "" } }, - ["angular.min.js"] = { meta = { icon = "" } }, - ["jquery.min.js"] = { meta = { icon = "" } }, - ["materialize.min.css"] = { meta = { icon = "" } }, - ["materialize.min.js"] = { meta = { icon = "" } }, - ["mootools.min.js"] = { meta = { icon = "" } }, - ["require.min.js"] = { meta = { icon = "" } }, - ["vimrc"] = { meta = { icon = "" } }, -} - --- ### Layouts ---------------------------------------------------------------- --- --- xplr layouts define the structure of the UI, i.e. how many panel we see, --- placement and size of the panels, how they look etc. --- --- This is configuration exposed via the `xplr.config.layouts` API. --- --- `xplr.config.layouts.builtin` contain some built-in panels which can be --- overridden, but you can't add or remove panels in it. --- --- You can add new panels in `xplr.config.layouts.custom`. --- --- ##### Example: Defining Custom Layout --- --- ![demo](https://s6.gifyu.com/images/layout.png) --- --- ```lua --- xplr.config.layouts.builtin.default = { --- Horizontal = { --- config = { --- margin = 1, --- horizontal_margin = 2, --- vertical_margin = 3, --- constraints = { --- { Percentage = 50 }, --- { Percentage = 50 }, --- } --- }, --- splits = { --- "Table", --- "HelpMenu", --- } --- } --- } --- ``` - --- The default layout --- --- Type: [Layout](https://xplr.dev/en/layout) -xplr.config.layouts.builtin.default = { - Horizontal = { - config = { - constraints = { - { Percentage = 70 }, - { Percentage = 30 }, - }, - }, - splits = { - { - Vertical = { - config = { - constraints = { - { Length = 3 }, - { Min = 1 }, - { Length = 3 }, - }, - }, - splits = { - "SortAndFilter", - "Table", - "InputAndLogs", - }, - }, - }, - { - Vertical = { - config = { - constraints = { - { Percentage = 30 }, - { Percentage = 70 }, - }, - }, - splits = { - "Selection", - "HelpMenu", - }, - }, - }, - }, - }, -} - --- The layout without help menu --- --- Type: [Layout](https://xplr.dev/en/layout) -xplr.config.layouts.builtin.no_help = { - Horizontal = { - config = { - constraints = { - { Percentage = 70 }, - { Percentage = 30 }, - }, - }, - splits = { - { - Vertical = { - config = { - constraints = { - { Length = 3 }, - { Min = 1 }, - { Length = 3 }, - }, - }, - splits = { - "SortAndFilter", - "Table", - "InputAndLogs", - }, - }, - }, - "Selection", - }, - }, -} - --- The layout without selection panel --- --- Type: [Layout](https://xplr.dev/en/layout) -xplr.config.layouts.builtin.no_selection = { - Horizontal = { - config = { - constraints = { - { Percentage = 70 }, - { Percentage = 30 }, - }, - }, - splits = { - { - Vertical = { - config = { - constraints = { - { Length = 3 }, - { Min = 1 }, - { Length = 3 }, - }, - }, - splits = { - "SortAndFilter", - "Table", - "InputAndLogs", - }, - }, - }, - "HelpMenu", - }, - }, -} - --- The layout without help menu and selection panel --- --- Type: [Layout](https://xplr.dev/en/layout) -xplr.config.layouts.builtin.no_help_no_selection = { - Vertical = { - config = { - constraints = { - { Length = 3 }, - { Min = 1 }, - { Length = 3 }, - }, - }, - splits = { - "SortAndFilter", - "Table", - "InputAndLogs", - }, - }, -} - --- This is where you can define custom layouts --- --- Type: mapping of the following key-value pairs: --- --- * key: string --- * value: [Layout](https://xplr.dev/en/layout) --- --- Example: --- --- ```lua --- xplr.config.layouts.custom.example = "Nothing" -- Show a blank screen --- xplr.config.general.initial_layout = "example" -- Load the example layout --- ``` -xplr.config.layouts.custom = {} - --- ### Modes ------------------------------------------------------------------ --- --- xplr is a modal file explorer. That means the users switch between different --- modes, each containing a different set of key bindings to avoid clashes. --- Users can switch between these modes at run-time. --- --- The modes can be configured using the `xplr.config.modes` Lua API. --- --- `xplr.config.modes.builtin` contain some built-in modes which can be --- overridden, but you can't add or remove modes in it. - --- The builtin default mode. --- Visit the [Default Key Bindings](https://xplr.dev/en/default-key-bindings) --- to see what each mode does. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.default = { - name = "default", - key_bindings = { - on_key = { - ["#"] = { - messages = { - "PrintAppStateAndQuit", - }, - }, - ["."] = { - help = "show hidden", - messages = { - { - ToggleNodeFilter = { filter = "RelativePathDoesNotStartWith", input = "." }, - }, - "ExplorePwdAsync", - }, - }, - [":"] = { - help = "action", - messages = { - "PopMode", - { SwitchModeBuiltin = "action" }, - }, - }, - ["?"] = { - help = "global help menu", - messages = { - { - BashExec = [===[ - [ -z "$PAGER" ] && PAGER="less -+F" - cat -- "${XPLR_PIPE_GLOBAL_HELP_MENU_OUT}" | ${PAGER:?} - ]===], - }, - }, - }, - ["G"] = { - help = "go to bottom", - messages = { - "PopMode", - "FocusLast", - }, - }, - ["ctrl-a"] = { - help = "select/unselect all", - messages = { - "ToggleSelectAll", - }, - }, - ["ctrl-f"] = { - help = "search", - messages = { - "PopMode", - { SwitchModeBuiltin = "search" }, - { SetInputBuffer = "" }, - }, - }, - ["ctrl-i"] = { - help = "next visited path", - messages = { - "NextVisitedPath", - }, - }, - ["ctrl-o"] = { - help = "last visited path", - messages = { - "LastVisitedPath", - }, - }, - ["ctrl-r"] = { - help = "refresh screen", - messages = { - "ClearScreen", - }, - }, - ["ctrl-u"] = { - help = "clear selection", - messages = { - "ClearSelection", - }, - }, - ["ctrl-w"] = { - help = "switch layout", - messages = { - { SwitchModeBuiltin = "switch_layout" }, - }, - }, - ["d"] = { - help = "delete", - messages = { - "PopMode", - { SwitchModeBuiltin = "delete" }, - }, - }, - ["down"] = { - help = "down", - messages = { - "FocusNext", - }, - }, - ["enter"] = { - help = "quit with result", - messages = { - "PrintResultAndQuit", - }, - }, - ["f"] = { - help = "filter", - messages = { - "PopMode", - { SwitchModeBuiltin = "filter" }, - }, - }, - ["g"] = { - help = "go to", - messages = { - "PopMode", - { SwitchModeBuiltin = "go_to" }, - }, - }, - ["left"] = { - help = "back", - messages = { - "Back", - }, - }, - ["q"] = { - help = "quit", - messages = { - "Quit", - }, - }, - ["r"] = { - help = "rename", - messages = { - "PopMode", - { SwitchModeBuiltin = "rename" }, - { - BashExecSilently0 = [===[ - NAME=$(basename "${XPLR_FOCUS_PATH:?}") - "$XPLR" -m 'SetInputBuffer: %q' "${NAME:?}" - ]===], - }, - }, - }, - ["ctrl-d"] = { - help = "duplicate as", - messages = { - "PopMode", - { SwitchModeBuiltin = "duplicate_as" }, - { - BashExecSilently0 = [===[ - NAME=$(basename "${XPLR_FOCUS_PATH:?}") - "$XPLR" -m 'SetInputBuffer: %q' "${NAME:?}" - ]===], - }, - }, - }, - ["right"] = { - help = "enter", - messages = { - "Enter", - }, - }, - ["s"] = { - help = "sort", - messages = { - "PopMode", - { SwitchModeBuiltin = "sort" }, - }, - }, - ["space"] = { - help = "toggle selection", - messages = { - "ToggleSelection", - "FocusNext", - }, - }, - ["up"] = { - help = "up", - messages = { - "FocusPrevious", - }, - }, - ["~"] = { - help = "go home", - messages = { - { - BashExecSilently0 = [===[ - "$XPLR" -m 'ChangeDirectory: %q' "${HOME:?}" - ]===], - }, - }, - }, - ["page-up"] = { - help = "scroll up", - messages = { - "ScrollUp", - }, - }, - ["page-down"] = { - help = "scroll down", - messages = { - "ScrollDown", - }, - }, - ["{"] = { - help = "scroll up half", - messages = { - "ScrollUpHalf", - }, - }, - ["}"] = { - help = "scroll down half", - messages = { - "ScrollDownHalf", - }, - }, - }, - on_number = { - help = "input", - messages = { - "PopMode", - { SwitchModeBuiltin = "number" }, - "BufferInputFromKey", - }, - }, - }, -} - -xplr.config.modes.builtin.default.key_bindings.on_key["tab"] = - xplr.config.modes.builtin.default.key_bindings.on_key["ctrl-i"] -xplr.config.modes.builtin.default.key_bindings.on_key["v"] = - xplr.config.modes.builtin.default.key_bindings.on_key["space"] -xplr.config.modes.builtin.default.key_bindings.on_key["V"] = - xplr.config.modes.builtin.default.key_bindings.on_key["ctrl-a"] -xplr.config.modes.builtin.default.key_bindings.on_key["/"] = - xplr.config.modes.builtin.default.key_bindings.on_key["ctrl-f"] -xplr.config.modes.builtin.default.key_bindings.on_key["h"] = - xplr.config.modes.builtin.default.key_bindings.on_key["left"] -xplr.config.modes.builtin.default.key_bindings.on_key["j"] = - xplr.config.modes.builtin.default.key_bindings.on_key["down"] -xplr.config.modes.builtin.default.key_bindings.on_key["k"] = xplr.config.modes.builtin.default.key_bindings.on_key["up"] -xplr.config.modes.builtin.default.key_bindings.on_key["l"] = - xplr.config.modes.builtin.default.key_bindings.on_key["right"] - --- The builtin debug error mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.debug_error = { - name = "debug error", - layout = { - Vertical = { - config = { - constraints = { - { Min = 14 }, - { MinLessThanScreenHeight = 14 }, - }, - }, - splits = { - { - CustomContent = { - title = "debug error", - body = { - StaticParagraph = { - render = [[ - - Some errors occurred during startup. - If you think this is a bug, please report it at: - - https://github.com/sayanarijit/xplr/issues/new - - Press `enter` to open the logs in your $EDITOR. - Press `escape` to ignore the errors and continue with the default config. - - To disable this mode, set `xplr.config.general.disable_debug_error_mode` - to `true` in your config file. - ]], - }, - }, - }, - }, - "InputAndLogs", - }, - }, - }, - key_bindings = { - on_key = { - ["enter"] = { - help = "open logs in editor", - messages = { - { - BashExec = [===[ - cat "${XPLR_PIPE_LOGS_OUT:?}" | ${EDITOR:-vi} - - ]===], - }, - }, - }, - ["q"] = { - help = "quit", - messages = { - "Quit", - }, - }, - }, - default = { - messages = {}, - }, - }, -} - --- The builtin recover mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.recover = { - name = "recover", - layout = { - CustomContent = { - title = " recover ", - body = { - StaticParagraph = { - render = [[ - - You pressed an invalid key and went into "recover" mode. - This mode saves you from performing unwanted actions. - - Let's calm down, press `escape`, and try again. - - To disable this mode, set `xplr.config.general.enable_recover_mode` - to `false` in your config file. - ]], - }, - }, - }, - }, - key_bindings = { - default = { - messages = {}, - }, - }, -} - --- The builtin go to path mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.go_to_path = { - name = "go to path", - key_bindings = { - on_key = { - ["enter"] = { - help = "submit", - messages = { - { - BashExecSilently0 = [===[ - PTH=${XPLR_INPUT_BUFFER} - PTH_ESC=$(printf %q "$PTH") - if [ -d "$PTH" ]; then - "$XPLR" -m 'ChangeDirectory: %q' "$PTH" - elif [ -e "$PTH" ]; then - "$XPLR" -m 'FocusPath: %q' "$PTH" - else - "$XPLR" -m 'LogError: %q' "could not find $PTH_ESC" - fi - ]===], - }, - "PopMode", - }, - }, - ["tab"] = { - help = "try complete", - messages = { - { CallLuaSilently = "builtin.try_complete_path" }, - }, - }, - }, - default = { - messages = { - "UpdateInputBufferFromKey", - }, - }, - }, -} - --- The builtin selection ops mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.selection_ops = { - name = "selection ops", - layout = "HelpMenu", - key_bindings = { - on_key = { - ["c"] = { - help = "copy here", - messages = { - { - BashExec0 = [===[ - (while IFS= read -r -d '' PTH; do - PTH_ESC=$(printf %q "$PTH") - if cp -vr -- "${PTH:?}" ./; then - "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC copied to ." - else - "$XPLR" -m 'LogError: %q' "Failed to copy $PTH_ESC to ." - fi - done < "${XPLR_PIPE_SELECTION_OUT:?}") - "$XPLR" -m ExplorePwdAsync - "$XPLR" -m ClearSelection - read -p "[enter to continue]" - ]===], - }, - "PopMode", - }, - }, - ["m"] = { - help = "move here", - messages = { - { - BashExec0 = [===[ - (while IFS= read -r -d '' PTH; do - PTH_ESC=$(printf %q "$PTH") - if mv -v -- "${PTH:?}" ./; then - "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC moved to ." - else - "$XPLR" -m 'LogError: %q' "Failed to move $PTH_ESC to ." - fi - done < "${XPLR_PIPE_SELECTION_OUT:?}") - "$XPLR" -m ExplorePwdAsync - read -p "[enter to continue]" - ]===], - }, - "PopMode", - }, - }, - ["u"] = { - help = "clear selection", - messages = { - "ClearSelection", - "PopMode", - }, - }, - }, - }, -} - --- The builtin create mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.create = { - name = "create", - layout = "HelpMenu", - key_bindings = { - on_key = { - ["d"] = { - help = "create directory", - messages = { - "PopMode", - { SwitchModeBuiltin = "create_directory" }, - { SetInputBuffer = "" }, - }, - }, - ["f"] = { - help = "create file", - messages = { - "PopMode", - { SwitchModeBuiltin = "create_file" }, - { SetInputBuffer = "" }, - }, - }, - }, - }, -} - --- The builtin create directory mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.create_directory = { - name = "create directory", - prompt = "ð ❯ ", - key_bindings = { - on_key = { - ["tab"] = { - help = "try complete", - messages = { - { CallLuaSilently = "builtin.try_complete_path" }, - }, - }, - ["enter"] = { - help = "submit", - messages = { - { - BashExecSilently0 = [===[ - PTH="$XPLR_INPUT_BUFFER" - PTH_ESC=$(printf %q "$PTH") - if [ "$PTH" ]; then - mkdir -p -- "$PTH" \ - && "$XPLR" -m 'SetInputBuffer: ""' \ - && "$XPLR" -m ExplorePwd \ - && "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC created" \ - && "$XPLR" -m 'FocusPath: %q' "$PTH" - else - "$XPLR" -m PopMode - fi - ]===], - }, - }, - }, - }, - default = { - messages = { - "UpdateInputBufferFromKey", - }, - }, - }, -} - --- The builtin create file mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.create_file = { - name = "create file", - prompt = "ƒ ❯ ", - key_bindings = { - on_key = { - ["tab"] = { - help = "try complete", - messages = { - { CallLuaSilently = "builtin.try_complete_path" }, - }, - }, - ["enter"] = { - help = "submit", - messages = { - { - BashExecSilently0 = [===[ - PTH="$XPLR_INPUT_BUFFER" - PTH_ESC=$(printf %q "$PTH") - if [ "$PTH" ]; then - mkdir -p -- "$(dirname $(realpath -m $PTH))" \ - && touch -- "$PTH" \ - && "$XPLR" -m 'SetInputBuffer: ""' \ - && "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC created" \ - && "$XPLR" -m 'ExplorePwd' \ - && "$XPLR" -m 'FocusPath: %q' "$PTH" - else - "$XPLR" -m PopMode - fi - ]===], - }, - }, - }, - }, - default = { - messages = { - "UpdateInputBufferFromKey", - }, - }, - }, -} - --- The builtin number mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.number = { - name = "number", - prompt = ":", - key_bindings = { - on_key = { - ["down"] = { - help = "to down", - messages = { - "FocusNextByRelativeIndexFromInput", - "PopMode", - }, - }, - ["enter"] = { - help = "to index", - messages = { - "FocusByIndexFromInput", - "PopMode", - }, - }, - ["up"] = { - help = "to up", - messages = { - "FocusPreviousByRelativeIndexFromInput", - "PopMode", - }, - }, - }, - on_navigation = { - messages = { - "UpdateInputBufferFromKey", - }, - }, - on_number = { - help = "input", - messages = { - "UpdateInputBufferFromKey", - }, - }, - }, -} - -xplr.config.modes.builtin.number.key_bindings.on_key["j"] = xplr.config.modes.builtin.number.key_bindings.on_key["down"] -xplr.config.modes.builtin.number.key_bindings.on_key["k"] = xplr.config.modes.builtin.number.key_bindings.on_key["up"] - --- The builtin go to mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.go_to = { - name = "go to", - layout = "HelpMenu", - key_bindings = { - on_key = { - ["f"] = { - help = "follow symlink", - messages = { - "FollowSymlink", - "PopMode", - }, - }, - ["g"] = { - help = "top", - messages = { - "FocusFirst", - "PopMode", - }, - }, - ["p"] = { - help = "path", - messages = { - "PopMode", - { SwitchModeBuiltin = "go_to_path" }, - { SetInputBuffer = "" }, - }, - }, - ["i"] = { - help = "initial $PWD", - messages = { - "PopMode", - { - BashExecSilently0 = [===[ - "$XPLR" -m 'ChangeDirectory: %q' "${XPLR_INITIAL_PWD:?}" - ]===], - }, - }, - }, - ["x"] = { - help = "open in gui", - messages = { - { - BashExecSilently0 = [===[ - if [ -z "$OPENER" ]; then - if command -v xdg-open; then - OPENER=xdg-open - elif command -v open; then - OPENER=open - else - "$XPLR" -m 'LogError: "$OPENER not found"' - exit 1 - fi - fi - (while IFS= read -r -d '' PTH; do - $OPENER "${PTH:?}" > /dev/null 2>&1 - done < "${XPLR_PIPE_RESULT_OUT:?}") - ]===], - }, - "ClearScreen", - "PopMode", - }, - }, - }, - }, -} - --- The builtin rename mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.rename = { - name = "rename", - key_bindings = { - on_key = { - ["tab"] = { - help = "try complete", - messages = { - { CallLuaSilently = "builtin.try_complete_path" }, - }, - }, - ["enter"] = { - help = "submit", - messages = { - { - BashExecSilently0 = [===[ - SRC="${XPLR_FOCUS_PATH:?}" - SRC_ESC=$(printf %q "$SRC") - TARGET="${XPLR_INPUT_BUFFER:?}" - TARGET_ESC=$(printf %q "$TARGET") - if [ -e "${TARGET:?}" ]; then - "$XPLR" -m 'LogError: %q' "$TARGET_ESC already exists" - else - mv -- "${SRC:?}" "${TARGET:?}" \ - && "$XPLR" -m ExplorePwd \ - && "$XPLR" -m 'FocusPath: %q' "$TARGET" \ - && "$XPLR" -m 'LogSuccess: %q' "$SRC_ESC renamed to $TARGET_ESC" - fi - ]===], - }, - "PopMode", - }, - }, - }, - default = { - messages = { - "UpdateInputBufferFromKey", - }, - }, - }, -} - --- The builtin duplicate as mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.duplicate_as = { - name = "duplicate as", - key_bindings = { - on_key = { - ["tab"] = { - help = "try complete", - messages = { - { CallLuaSilently = "builtin.try_complete_path" }, - }, - }, - ["enter"] = { - help = "submit", - messages = { - { - BashExecSilently0 = [===[ - SRC="${XPLR_FOCUS_PATH:?}" - SRC_ESC=$(printf %q "$SRC") - TARGET="${XPLR_INPUT_BUFFER:?}" - TARGET_ESC=$(printf %q "$TARGET") - if [ -e "${TARGET:?}" ]; then - "$XPLR" -m 'LogError: %q' "$TARGET_ESC already exists" - else - cp -r -- "${SRC:?}" "${TARGET:?}" \ - && "$XPLR" -m ExplorePwd \ - && "$XPLR" -m 'FocusPath: %q' "$TARGET_ESC" \ - && "$XPLR" -m 'LogSuccess: %q' "$SRC_ESC duplicated as $TARGET_ESC" - fi - ]===], - }, - "PopMode", - }, - }, - }, - default = { - messages = { - "UpdateInputBufferFromKey", - }, - }, - }, -} - --- The builtin delete mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.delete = { - name = "delete", - layout = "HelpMenu", - key_bindings = { - on_key = { - ["D"] = { - help = "force delete", - messages = { - { - BashExec0 = [===[ - (while IFS= read -r -d '' PTH; do - PTH_ESC=$(printf %q "$PTH") - if rm -rfv -- "${PTH:?}"; then - "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC deleted" - else - "$XPLR" -m 'LogError: %q' "Failed to delete $PTH_ESC" - fi - done < "${XPLR_PIPE_RESULT_OUT:?}") - "$XPLR" -m ExplorePwdAsync - read -p "[enter to continue]" - ]===], - }, - "PopMode", - }, - }, - ["d"] = { - help = "delete", - messages = { - { - BashExec0 = [===[ - (while IFS= read -r -d '' PTH; do - PTH_ESC=$(printf %q "$PTH") - if [ -d "$PTH" ] && [ ! -L "$PTH" ]; then - if rmdir -v -- "${PTH:?}"; then - "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC deleted" - else - "$XPLR" -m 'LogError: %q' "Failed to delete $PTH_ESC" - fi - else - if rm -v -- "${PTH:?}"; then - "$XPLR" -m 'LogSuccess: %q' "$PTH_ESC deleted" - else - "$XPLR" -m 'LogError: %q' "Failed to delete $PTH_ESC" - fi - fi - done < "${XPLR_PIPE_RESULT_OUT:?}") - "$XPLR" -m ExplorePwdAsync - read -p "[enter to continue]" - ]===], - }, - "PopMode", - }, - }, - }, - }, -} - --- The builtin action mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.action = { - name = "action to", - layout = "HelpMenu", - key_bindings = { - on_key = { - ["!"] = { - help = "shell", - messages = { - "PopMode", - { Call0 = { command = os.getenv("SHELL") or "bash", args = { "-i" } } }, - "ExplorePwdAsync", - }, - }, - ["c"] = { - help = "create", - messages = { - "PopMode", - { SwitchModeBuiltin = "create" }, - }, - }, - ["e"] = { - help = "open in editor", - messages = { - { - BashExec0 = [===[ - ${EDITOR:-vi} "${XPLR_FOCUS_PATH:?}" - ]===], - }, - "PopMode", - }, - }, - ["l"] = { - help = "logs", - messages = { - { - BashExec = [===[ - [ -z "$PAGER" ] && PAGER="less -+F" - cat -- "${XPLR_PIPE_LOGS_OUT}" | ${PAGER:?} - ]===], - }, - "PopMode", - }, - }, - ["s"] = { - help = "selection operations", - messages = { - "PopMode", - { SwitchModeBuiltin = "selection_ops" }, - }, - }, - ["m"] = { - help = "toggle mouse", - messages = { - "PopMode", - "ToggleMouse", - }, - }, - ["v"] = { - help = "vroot", - messages = { - "PopMode", - { SwitchModeBuiltin = "vroot" }, - }, - }, - ["q"] = { - help = "quit options", - messages = { - "PopMode", - { SwitchModeBuiltin = "quit" }, - }, - }, - }, - on_number = { - help = "go to index", - messages = { - "PopMode", - { SwitchModeBuiltin = "number" }, - "BufferInputFromKey", - }, - }, - }, -} - --- The builtin quit mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.quit = { - name = "quit", - layout = "HelpMenu", - key_bindings = { - on_key = { - ["enter"] = { - help = "just quit", - messages = { - "Quit", - }, - }, - ["p"] = { - help = "quit printing pwd", - messages = { - "PrintPwdAndQuit", - }, - }, - ["f"] = { - help = "quit printing focus", - messages = { - "PrintFocusPathAndQuit", - }, - }, - ["s"] = { - help = "quit printing selection", - messages = { - "PrintSelectionAndQuit", - }, - }, - ["r"] = { - help = "quit printing result", - messages = { - "PrintResultAndQuit", - }, - }, - }, - }, -} - --- The builtin search mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.search = { - name = "search", - prompt = "/", - key_bindings = { - on_key = { - ["up"] = { - help = "up", - messages = { - "FocusPrevious", - }, - }, - ["down"] = { - help = "down", - messages = { - "FocusNext", - }, - }, - ["right"] = { - help = "enter", - messages = { - "Enter", - { SetInputBuffer = "" }, - }, - }, - ["left"] = { - help = "back", - messages = { - "Back", - { SetInputBuffer = "" }, - }, - }, - ["tab"] = { - help = "toggle selection", - messages = { - "ToggleSelection", - "FocusNext", - }, - }, - ["enter"] = { - help = "submit", - messages = { - "AcceptSearch", - "PopMode", - }, - }, - ["esc"] = { - help = "cancel", - messages = { - "CancelSearch", - "PopMode", - }, - }, - }, - default = { - messages = { - "UpdateInputBufferFromKey", - "SearchFuzzyFromInput", - "ExplorePwdAsync", - }, - }, - }, -} - -xplr.config.modes.builtin.search.key_bindings.on_key["ctrl-n"] = - xplr.config.modes.builtin.search.key_bindings.on_key["down"] -xplr.config.modes.builtin.search.key_bindings.on_key["ctrl-p"] = - xplr.config.modes.builtin.search.key_bindings.on_key["up"] - --- The builtin filter mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.filter = { - name = "filter", - key_bindings = { - on_key = { - ["r"] = { - help = "relative path does match regex", - messages = { - { SwitchModeBuiltin = "relative_path_does_match_regex" }, - { SetInputBuffer = "" }, - { AddNodeFilterFromInput = "RelativePathDoesMatchRegex" }, - "ExplorePwdAsync", - }, - }, - ["R"] = { - help = "relative path does not match regex", - messages = { - { SwitchModeBuiltin = "relative_path_does_not_match_regex" }, - { SetInputBuffer = "" }, - { AddNodeFilterFromInput = "RelativePathDoesNotMatchRegex" }, - "ExplorePwdAsync", - }, - }, - ["backspace"] = { - help = "remove last filter", - messages = { - "RemoveLastNodeFilter", - "ExplorePwdAsync", - }, - }, - ["ctrl-r"] = { - help = "reset filters", - messages = { - "ResetNodeFilters", - "ExplorePwdAsync", - }, - }, - ["ctrl-u"] = { - help = "clear filters", - messages = { - "ClearNodeFilters", - "ExplorePwdAsync", - }, - }, - }, - }, -} - --- The builtin relative_path_does_match_regex mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.relative_path_does_match_regex = { - name = "relative path does match regex", - prompt = xplr.config.general.sort_and_filter_ui.filter_identifiers.RelativePathDoesMatchRegex.format, - key_bindings = { - on_key = { - ["enter"] = { - help = "submit", - messages = { - "PopMode", - }, - }, - ["esc"] = { - messages = { - { RemoveNodeFilterFromInput = "RelativePathDoesMatchRegex" }, - "PopMode", - "ExplorePwdAsync", - }, - }, - }, - default = { - messages = { - { RemoveNodeFilterFromInput = "RelativePathDoesMatchRegex" }, - "UpdateInputBufferFromKey", - { AddNodeFilterFromInput = "RelativePathDoesMatchRegex" }, - "ExplorePwdAsync", - }, - }, - }, -} - --- The builtin relative_path_does_not_match_regex mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.relative_path_does_not_match_regex = { - name = "relative path does not match regex", - prompt = xplr.config.general.sort_and_filter_ui.filter_identifiers.RelativePathDoesNotMatchRegex.format, - key_bindings = { - on_key = { - ["enter"] = { - help = "submit", - messages = { - "PopMode", - }, - }, - ["esc"] = { - messages = { - { RemoveNodeFilterFromInput = "RelativePathDoesNotMatchRegex" }, - "PopMode", - "ExplorePwdAsync", - }, - }, - }, - default = { - messages = { - { RemoveNodeFilterFromInput = "RelativePathDoesNotMatchRegex" }, - "UpdateInputBufferFromKey", - { AddNodeFilterFromInput = "RelativePathDoesNotMatchRegex" }, - "ExplorePwdAsync", - }, - }, - }, -} - --- The builtin sort mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.sort = { - name = "sort", - key_bindings = { - on_key = { - ["!"] = { - help = "reverse sorters", - messages = { - "ReverseNodeSorters", - "ExplorePwdAsync", - }, - }, - ["E"] = { - help = "by canonical extension reverse", - messages = { - { AddNodeSorter = { sorter = "ByCanonicalExtension", reverse = true } }, - "ExplorePwdAsync", - }, - }, - ["M"] = { - help = "by canonical mime essence reverse", - messages = { - { AddNodeSorter = { sorter = "ByCanonicalMimeEssence", reverse = true } }, - "ExplorePwdAsync", - }, - }, - ["N"] = { - help = "by node type reverse", - messages = { - { AddNodeSorter = { sorter = "ByCanonicalIsDir", reverse = true } }, - { AddNodeSorter = { sorter = "ByCanonicalIsFile", reverse = true } }, - { AddNodeSorter = { sorter = "ByIsSymlink", reverse = true } }, - "ExplorePwdAsync", - }, - }, - ["R"] = { - help = "by relative path reverse", - messages = { - { AddNodeSorter = { sorter = "ByIRelativePath", reverse = true } }, - "ExplorePwdAsync", - }, - }, - ["S"] = { - help = "by size reverse", - messages = { - { AddNodeSorter = { sorter = "BySize", reverse = true } }, - "ExplorePwdAsync", - }, - }, - ["backspace"] = { - help = "remove last sorter", - messages = { - "RemoveLastNodeSorter", - "ExplorePwdAsync", - }, - }, - ["ctrl-r"] = { - help = "reset sorters", - messages = { - "ResetNodeSorters", - "ExplorePwdAsync", - }, - }, - ["ctrl-u"] = { - help = "clear sorters", - messages = { - "ClearNodeSorters", - "ExplorePwdAsync", - }, - }, - ["e"] = { - help = "by canonical extension", - messages = { - { AddNodeSorter = { sorter = "ByCanonicalExtension", reverse = false } }, - "ExplorePwdAsync", - }, - }, - ["enter"] = { - help = "submit", - messages = { - "PopMode", - }, - }, - ["m"] = { - help = "by canonical mime essence", - messages = { - { AddNodeSorter = { sorter = "ByCanonicalMimeEssence", reverse = false } }, - "ExplorePwdAsync", - }, - }, - ["n"] = { - help = "by node type", - messages = { - { AddNodeSorter = { sorter = "ByCanonicalIsDir", reverse = false } }, - { AddNodeSorter = { sorter = "ByCanonicalIsFile", reverse = false } }, - { AddNodeSorter = { sorter = "ByIsSymlink", reverse = false } }, - "ExplorePwdAsync", - }, - }, - ["r"] = { - help = "by relative path", - messages = { - { AddNodeSorter = { sorter = "ByIRelativePath", reverse = false } }, - "ExplorePwdAsync", - }, - }, - ["s"] = { - help = "by size", - messages = { - { AddNodeSorter = { sorter = "BySize", reverse = false } }, - "ExplorePwdAsync", - }, - }, - ["c"] = { - help = "by created", - messages = { - { AddNodeSorter = { sorter = "ByCreated", reverse = false } }, - "ExplorePwdAsync", - }, - }, - ["C"] = { - help = "by created reverse", - messages = { - { AddNodeSorter = { sorter = "ByCreated", reverse = true } }, - "ExplorePwdAsync", - }, - }, - ["l"] = { - help = "by last modified", - messages = { - { AddNodeSorter = { sorter = "ByLastModified", reverse = false } }, - "ExplorePwdAsync", - }, - }, - ["L"] = { - help = "by last modified reverse", - messages = { - { AddNodeSorter = { sorter = "ByLastModified", reverse = true } }, - "ExplorePwdAsync", - }, - }, - }, - }, -} - --- The builtin switch layout mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.switch_layout = { - name = "switch layout", - layout = "HelpMenu", - key_bindings = { - on_key = { - ["1"] = { - help = "default", - messages = { - { SwitchLayoutBuiltin = "default" }, - "PopMode", - }, - }, - ["2"] = { - help = "no help menu", - messages = { - { SwitchLayoutBuiltin = "no_help" }, - "PopMode", - }, - }, - ["3"] = { - help = "no selection panel", - messages = { - { SwitchLayoutBuiltin = "no_selection" }, - "PopMode", - }, - }, - ["4"] = { - help = "no help or selection", - messages = { - { SwitchLayoutBuiltin = "no_help_no_selection" }, - "PopMode", - }, - }, - }, - }, -} - --- The builtin vroot mode. --- --- Type: [Mode](https://xplr.dev/en/mode) -xplr.config.modes.builtin.vroot = { - name = "vroot", - layout = "HelpMenu", - key_bindings = { - on_key = { - ["v"] = { - help = "toggle vroot", - messages = { - "PopMode", - "ToggleVroot", - }, - }, - ["."] = { - help = "vroot $PWD", - messages = { - "PopMode", - { - BashExecSilently0 = [===[ - "$XPLR" -m 'SetVroot: %q' "${PWD:?}" - ]===], - }, - }, - }, - ["/"] = { - help = "vroot /", - messages = { - "PopMode", - { SetVroot = "/" }, - }, - }, - ["~"] = { - help = "vroot $HOME", - messages = { - "PopMode", - { - BashExecSilently0 = [===[ - "$XPLR" -m 'SetVroot: %q' "${HOME:?}" - ]===], - }, - }, - }, - ["ctrl-r"] = { - help = "reset vroot", - messages = { - "PopMode", - "ResetVroot", - }, - }, - ["ctrl-u"] = { - help = "unset vroot", - messages = { - "PopMode", - "UnsetVroot", - }, - }, - }, - }, -} - --- This is where you define custom modes. --- --- Type: mapping of the following key-value pairs: --- --- * key: string --- * value: [Mode](https://xplr.dev/en/mode) --- --- Example: --- --- ```lua --- xplr.config.modes.custom.example = { --- name = "example", --- key_bindings = { --- on_key = { --- enter = { --- help = "default mode", --- messages = { --- "PopMode", --- { SwitchModeBuiltin = "default" }, --- }, --- }, --- }, --- }, --- } --- --- xplr.config.general.initial_mode = "example" --- ``` -xplr.config.modes.custom = {} - --- ## Function ---------------------------------------------------------------- --- --- While `xplr.config` defines all the static parts of the configuration, --- `xplr.fn` defines all the dynamic parts using functions. --- --- See: [Lua Function Calls](https://xplr.dev/en/lua-function-calls) --- --- As always, `xplr.fn.builtin` is where the built-in functions are defined --- that can be overwritten. - --- Tries to auto complete the path in the input buffer -xplr.fn.builtin.try_complete_path = function(m) - if not m.input_buffer then - return - end - - local function matches_all(str, paths) - for _, path in ipairs(paths) do - if string.sub(path, 1, #str) ~= str then - return false - end - end - return true - end - - local path = m.input_buffer - local explorer_config = { - filters = { - { filter = "RelativePathDoesStartWith", input = xplr.util.basename(path) }, - }, - } - local parent = xplr.util.dirname(path) - if not parent or parent == "" then - parent = "./" - elseif parent ~= "/" then - parent = parent .. "/" - end - - local nodes = xplr.util.explore(parent, explorer_config) - local found = {} - for _, node in ipairs(nodes) do - table.insert(found, parent .. node.relative_path) - end - local count = #found - - if count == 0 then - return - elseif count == 1 then - return { - { SetInputBuffer = found[1] }, - } - else - local first = found[1] - while #first > #path and matches_all(path, found) do - path = string.sub(first, 1, #path + 1) - end - - if matches_all(path, found) then - return { - { SetInputBuffer = path }, - } - end - - return { - { SetInputBuffer = string.sub(path, 1, #path - 1) }, - } - end -end - --- Renders the first column in the table -xplr.fn.builtin.fmt_general_table_row_cols_0 = function(m) - local r = "" - if m.is_before_focus then - r = r .. " -" - else - r = r .. " " - end - - r = r .. m.relative_index .. "│" .. m.index - - return r -end - --- Renders the second column in the table -xplr.fn.builtin.fmt_general_table_row_cols_1 = function(m) - local r = m.tree .. m.prefix - - local function path_escape(path) - return string.gsub(string.gsub(path, "\\", "\\\\"), "\n", "\\n") - end - - if m.meta.icon == nil then - r = r .. "" - else - r = r .. m.meta.icon .. " " - end - - r = r .. path_escape(m.relative_path) - - if m.is_dir then - r = r .. "/" - end - - r = r .. m.suffix .. " " - - if m.is_symlink then - r = r .. "-> " - - if m.is_broken then - r = r .. "×" - else - r = r .. path_escape(m.symlink.absolute_path) - - if m.symlink.is_dir then - r = r .. "/" - end - end - end - - return r -end - --- Renders the third column in the table -xplr.fn.builtin.fmt_general_table_row_cols_2 = function(m) - local no_color = os.getenv("NO_COLOR") - - local function green(x) - if no_color == nil then - return "\x1b[32m" .. x .. "\x1b[0m" - else - return x - end - end - - local function yellow(x) - if no_color == nil then - return "\x1b[33m" .. x .. "\x1b[0m" - else - return x - end - end - - local function red(x) - if no_color == nil then - return "\x1b[31m" .. x .. "\x1b[0m" - else - return x - end - end - - local function bit(x, color, cond) - if cond then - return color(x) - else - return color("-") - end - end - - local p = m.permissions - - local r = "" - - r = r .. bit("r", green, p.user_read) - r = r .. bit("w", yellow, p.user_write) - - if p.user_execute == false and p.setuid == false then - r = r .. bit("-", red, p.user_execute) - elseif p.user_execute == true and p.setuid == false then - r = r .. bit("x", red, p.user_execute) - elseif p.user_execute == false and p.setuid == true then - r = r .. bit("S", red, p.user_execute) - else - r = r .. bit("s", red, p.user_execute) - end - - r = r .. bit("r", green, p.group_read) - r = r .. bit("w", yellow, p.group_write) - - if p.group_execute == false and p.setuid == false then - r = r .. bit("-", red, p.group_execute) - elseif p.group_execute == true and p.setuid == false then - r = r .. bit("x", red, p.group_execute) - elseif p.group_execute == false and p.setuid == true then - r = r .. bit("S", red, p.group_execute) - else - r = r .. bit("s", red, p.group_execute) - end - - r = r .. bit("r", green, p.other_read) - r = r .. bit("w", yellow, p.other_write) - - if p.other_execute == false and p.setuid == false then - r = r .. bit("-", red, p.other_execute) - elseif p.other_execute == true and p.setuid == false then - r = r .. bit("x", red, p.other_execute) - elseif p.other_execute == false and p.setuid == true then - r = r .. bit("T", red, p.other_execute) - else - r = r .. bit("t", red, p.other_execute) - end - - return r -end - --- Renders the fourth column in the table -xplr.fn.builtin.fmt_general_table_row_cols_3 = function(m) - if not m.is_dir then - return m.human_size - else - return "" - end -end - --- Renders the fifth column in the table -xplr.fn.builtin.fmt_general_table_row_cols_4 = function(m) - return tostring(os.date("%a %b %d %H:%M:%S %Y", m.last_modified / 1000000000)) -end - --- This is where the custom functions can be added. --- --- There is currently no restriction on what kind of functions can be defined --- in `xplr.fn.custom`. --- --- You can also use nested tables such as --- `xplr.fn.custom.my_plugin.my_function` to define custom functions. -xplr.fn.custom = {} - --- ## Hooks ------------------------------------------------------------------- --- --- This section of the configuration cannot be overwritten by another config --- file or plugin, since this is an optional lua return statement specific to --- each config file. It can be used to define things that should be explicit --- for reasons like performance concerns, such as hooks. --- --- Plugins should expose the hooks, and require users to subscribe to them --- explicitly. --- --- Example: --- --- ```lua --- return { --- -- Add messages to send when the xplr loads. --- -- This is similar to the `--on-load` command-line option. --- -- --- -- Type: list of [Message](https://xplr.dev/en/message#message)s --- on_load = { --- { LogSuccess = "Configuration successfully loaded!" }, --- { CallLuaSilently = "custom.some_plugin_with_hooks.on_load" }, --- }, --- --- -- Add messages to send when the directory changes. --- -- --- -- Type: list of [Message](https://xplr.dev/en/message#message)s --- on_directory_change = { --- { LogSuccess = "Changed directory" }, --- { CallLuaSilently = "custom.some_plugin_with_hooks.on_directory_change" }, --- }, --- --- -- Add messages to send when the focus changes. --- -- --- -- Type: list of [Message](https://xplr.dev/en/message#message)s --- on_focus_change = { --- { LogSuccess = "Changed focus" }, --- { CallLuaSilently = "custom.some_plugin_with_hooks.on_focus_change" }, --- } --- --- -- Add messages to send when the mode is switched. --- -- --- -- Type: list of [Message](https://xplr.dev/en/message#message)s --- on_mode_switch = { --- { LogSuccess = "Switched mode" }, --- { CallLuaSilently = "custom.some_plugin_with_hooks.on_mode_switch" }, --- } --- --- -- Add messages to send when the layout is switched --- -- --- -- Type: list of [Message](https://xplr.dev/en/message#message)s --- on_layout_switch = { --- { LogSuccess = "Switched layout" }, --- { CallLuaSilently = "custom.some_plugin_with_hooks.on_layout_switch" }, --- } --- } --- ``` - -local home = os.getenv("HOME") -local xpm_path = home .. "/.local/share/xplr/dtomvan/xpm.xplr" -local xpm_url = "https://github.com/dtomvan/xpm.xplr" - -package.path = package.path .. ";" .. xpm_path .. "/?.lua;" .. xpm_path .. "/?/init.lua" - -os.execute(string.format("[ -e '%s' ] || git clone '%s' '%s'", xpm_path, xpm_url, xpm_path)) - -require("xpm").setup({ - plugins = { - "dtomvan/xpm.xplr", - "Junker/nuke.xplr", - }, - auto_install = true, - auto_cleanup = true, -}) - -xplr.config.modes.builtin.default.key_bindings.on_key.x = { - help = "xpm", - messages = { - "PopMode", - { SwitchModeCustom = "xpm" }, - }, -} - -require("nuke").setup({ - pager = "less -R", -- default: less -R - open = { - run_executables = false, -- default: false - custom = { - { mime = "image/*", command = "nsxiv -aio {}" }, - { mime = "video/*", command = "mpv {} -quiet" }, - { mime = "audio/*", command = "mpv --audio-display=no {}" }, - }, - }, - view = { - show_line_numbers = true, -- default: false - }, - smart_view = { - custom = { - { extension = "so", command = "ldd -r {} | less" }, - }, - }, -}) - -return { - on_load = {}, - on_directory_change = {}, - on_focus_change = {}, - on_mode_switch = {}, - on_layout_switch = {}, -} diff --git a/config/yazi/init.lua b/config/yazi/init.lua index 539fa879..e2158b87 100644 --- a/config/yazi/init.lua +++ b/config/yazi/init.lua @@ -20,3 +20,52 @@ require("augment-command"):setup({ wraparound_file_navigation = false, }) require("git"):setup() +require("yatline"):setup({ + show_background = false, + section_separator = { open = "", close = "" }, + part_separator = { open = "", close = "" }, + inverse_separator = { open = "", close = "" }, + + header_line = { + left = { + section_a = { + { type = "line", custom = false, name = "tabs", params = { "left" } }, + }, + section_b = {}, + section_c = {}, + }, + right = { + section_a = { + { type = "string", custom = false, name = "date", params = { "%A, %d %B %Y" } }, + }, + section_b = { + { type = "string", custom = false, name = "date", params = { "%X" } }, + }, + section_c = {}, + }, + }, + + status_line = { + left = { + section_a = {}, + section_b = {}, + section_c = { + { type = "string", custom = false, name = "hovered_path" }, + { type = "coloreds", custom = false, name = "task_states" }, + }, + }, + right = { + section_a = { + { type = "string", custom = false, name = "cursor_position" }, + { type = "string", custom = false, name = "cursor_percentage" }, + }, + section_b = { + { type = "string", custom = false, name = "hovered_file_extension", params = { true } }, + }, + section_c = { + { type = "coloreds", custom = false, name = "permissions" }, + { type = "coloreds", custom = false, name = "count", params = "true" }, + }, + }, + }, +}) diff --git a/config/yazi/keymap.toml b/config/yazi/keymap.toml index 874858a7..55bd91c9 100644 --- a/config/yazi/keymap.toml +++ b/config/yazi/keymap.toml @@ -116,15 +116,15 @@ keymap = [ # 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 = [ "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"}, @@ -156,6 +156,8 @@ prepend_keymap = [ {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"}, + # vidir + {on = "B", run = [ "escape --visual", "plugin --sync vidir" ], desc = "Bulk rename with vidir"}, # chmod {on = [ "c", "m" ], run = "plugin chmod", desc = "Chmod on selected files"}, # Archive @@ -169,23 +171,29 @@ prepend_keymap = [ # 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"}, - # vidir - {on = "B", run = 'vidir "$1"', desc = "Bulk rename"}, # Max Preview {on = "T", run = "plugin --sync max-preview", desc = "Maximize or restore preview"}, # Hide Preview {on = "", run = "plugin --sync hide-preview", desc = "Hide or show preview"}, # Relative motions - {on = [ "1" ], run = "plugin relative-motions -- 1", desc = "Move in relative steps"}, - {on = [ "2" ], run = "plugin relative-motions -- 2", desc = "Move in relative steps"}, - {on = [ "3" ], run = "plugin relative-motions -- 3", desc = "Move in relative steps"}, - {on = [ "4" ], run = "plugin relative-motions -- 4", desc = "Move in relative steps"}, - {on = [ "5" ], run = "plugin relative-motions -- 5", desc = "Move in relative steps"}, - {on = [ "6" ], run = "plugin relative-motions -- 6", desc = "Move in relative steps"}, - {on = [ "7" ], run = "plugin relative-motions -- 7", desc = "Move in relative steps"}, - {on = [ "8" ], run = "plugin relative-motions -- 8", desc = "Move in relative steps"}, - {on = [ "9" ], run = "plugin relative-motions -- 9", desc = "Move in relative steps"}, + {on = [ "1" ], run = "plugin relative-motions 1", desc = "Move in relative steps"}, + {on = [ "2" ], run = "plugin relative-motions 2", desc = "Move in relative steps"}, + {on = [ "3" ], run = "plugin relative-motions 3", desc = "Move in relative steps"}, + {on = [ "4" ], run = "plugin relative-motions 4", desc = "Move in relative steps"}, + {on = [ "5" ], run = "plugin relative-motions 5", desc = "Move in relative steps"}, + {on = [ "6" ], run = "plugin relative-motions 6", desc = "Move in relative steps"}, + {on = [ "7" ], run = "plugin relative-motions 7", desc = "Move in relative steps"}, + {on = [ "8" ], run = "plugin relative-motions 8", desc = "Move in relative steps"}, + {on = [ "9" ], run = "plugin relative-motions 9", desc = "Move in relative steps"}, {on = [ "c", "s" ], run = "plugin what-size", desc = "Calc size of selection or cwd"}, + {on = "M", run = "plugin mount", desc = "Mount"}, + {on = "F", run = "plugin smart-filter", desc = "Smart filter"}, + {on = "", run = "plugin diff", desc = "Diff the selected with the hovered file"}, + {on = [ "" ], run = "seek 5"}, + {on = [ "" ], run = "seek -5"}, + {on = [ "z", "h" ], run = "plugin time-travel --args=prev", desc = "Go to previous snapshot"}, + {on = [ "z", "l" ], run = "plugin time-travel --args=next", desc = "Go to next snapshot"}, + {on = [ "z", "e" ], run = "plugin time-travel --args=exit", desc = "Exit browsing snapshots"}, ] [tasks] diff --git a/config/yazi/package.toml b/config/yazi/package.toml index cc58e779..1ed266e3 100644 --- a/config/yazi/package.toml +++ b/config/yazi/package.toml @@ -1,23 +1,8 @@ -[[plugin.deps]] -use = "AnirudhG07/nbpreview" -rev = "bc573d5" -hash = "ab61298c387a63e781a87129f533883b" - -[[plugin.deps]] -use = "Reledia/glow" -rev = "2da96e3" -hash = "f9ee1436e3b853508d87f7d49dce56e6" - [[plugin.deps]] use = "Reledia/hexyl" rev = "016a09b" hash = "50da29476e744dba37d77fb209328fd1" -[[plugin.deps]] -use = "Sonico98/exifaudio" -rev = "7ff7141" -hash = "666ccba55119fba4c25b8ad354b2855c" - [[plugin.deps]] use = "dedukun/relative-motions" rev = "ce2e890" @@ -28,11 +13,6 @@ use = "hankertrix/augment-command" rev = "91ba6c5" hash = "6ac13898ec80c623e2d9ea90b947c86a" -[[plugin.deps]] -use = "imsi32/yatline" -rev = "2ecf715" -hash = "38e2ea4703ea606d4eef574e8e8b8fd7" - [[plugin.deps]] use = "kirasok/torrent-preview" rev = "4ca5996" @@ -50,18 +30,68 @@ hash = "6e789212eb41d937bab04877ca361099" [[plugin.deps]] use = "yazi-rs/plugins:git" -rev = "4b027c7" +rev = "864a021" hash = "e0ada736ea676c2bbb3ec705a49526ef" [[plugin.deps]] use = "yazi-rs/plugins:chmod" -rev = "4b027c7" +rev = "864a021" hash = "2f1053f89d1a301a648ab181d0948e38" [[plugin.deps]] use = "yazi-rs/plugins:full-border" -rev = "4b027c7" +rev = "864a021" hash = "1f3dad061209081a6b04dd6ff2cb06c7" +[[plugin.deps]] +use = "yazi-rs/plugins:mount" +rev = "864a021" +hash = "dd97eede8e20e59cd2604e8006e470e2" + +[[plugin.deps]] +use = "yazi-rs/plugins:smart-filter" +rev = "864a021" +hash = "f0c4b41b5d19a3144958383333eff6e7" + +[[plugin.deps]] +use = "yazi-rs/plugins:mime-ext" +rev = "864a021" +hash = "5e24c167e9ae9a203a48f2a438b8c705" + +[[plugin.deps]] +use = "yazi-rs/plugins:diff" +rev = "864a021" +hash = "7a08e303167d5b655c06da6d570f0333" + +[[plugin.deps]] +use = "AnirudhG07/rich-preview" +rev = "fdcf373" +hash = "bd1737dd44b202f412122e6a3b378d4c" + +[[plugin.deps]] +use = "macydnah/office" +rev = "d1e3e51" +hash = "35241f7d85abc5a0d2441020bc597ceb" + +[[plugin.deps]] +use = "boydaihungst/mediainfo" +rev = "9629b1e" +hash = "5204b4e2bd238c40fa66cf0a0191f084" + +[[plugin.deps]] +use = "iynaix/time-travel" +rev = "7e0179e" +hash = "69967963fba96295a07b68354fc91ea9" + +[[plugin.deps]] +use = "imsi32/yatline" +rev = "2ecf715" +hash = "38e2ea4703ea606d4eef574e8e8b8fd7" + +[[plugin.deps]] +use = "kristoferssolo/vidir" +rev = "54ef22b" +hash = "e3fe41820f43c3511be9846cc7bdf638" + [flavor] deps = [] diff --git a/config/yazi/plugins/exifaudio.yazi/LICENSE b/config/yazi/plugins/diff.yazi/LICENSE similarity index 97% rename from config/yazi/plugins/exifaudio.yazi/LICENSE rename to config/yazi/plugins/diff.yazi/LICENSE index 78aae84a..fb5b1d62 100644 --- a/config/yazi/plugins/exifaudio.yazi/LICENSE +++ b/config/yazi/plugins/diff.yazi/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Sonico98 +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 diff --git a/config/yazi/plugins/diff.yazi/README.md b/config/yazi/plugins/diff.yazi/README.md new file mode 100644 index 00000000..54faeb37 --- /dev/null +++ b/config/yazi/plugins/diff.yazi/README.md @@ -0,0 +1,28 @@ +# diff.yazi + +Diff the selected file with the hovered file, create a living patch, and copy it to the clipboard. + +https://github.com/yazi-rs/plugins/assets/17523360/eff5e949-386a-44ea-82f9-4cb4a2c37aad + +## Installation + +```sh +ya pack -a yazi-rs/plugins:diff +``` + +## Usage + +Add this to your `~/.config/yazi/keymap.toml`: + +```toml +[[manager.prepend_keymap]] +on = "" +run = "plugin diff" +desc = "Diff the selected with the hovered file" +``` + +Make sure the C + d key is not used elsewhere. + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/config/yazi/plugins/diff.yazi/main.lua b/config/yazi/plugins/diff.yazi/main.lua new file mode 100644 index 00000000..21dde6de --- /dev/null +++ b/config/yazi/plugins/diff.yazi/main.lua @@ -0,0 +1,41 @@ +--- @since 25.2.7 + +local function info(content) + return ya.notify { + title = "Diff", + content = content, + timeout = 5, + } +end + +local selected_url = ya.sync(function() + for _, u in pairs(cx.active.selected) do + return u + end +end) + +local hovered_url = ya.sync(function() + local h = cx.active.current.hovered + return h and h.url +end) + +return { + entry = function() + local a, b = selected_url(), hovered_url() + if not a then + return info("No file selected") + elseif not b then + return info("No file hovered") + end + + local output, err = Command("diff"):arg("-Naur"):arg(tostring(a)):arg(tostring(b)):output() + if not output then + return info("Failed to run diff, error: " .. err) + elseif output.stdout == "" then + return info("No differences found") + end + + ya.clipboard(output.stdout) + info("Diff copied to clipboard") + end, +} diff --git a/config/yazi/plugins/exifaudio.yazi/README.md b/config/yazi/plugins/exifaudio.yazi/README.md deleted file mode 100644 index e646d0c0..00000000 --- a/config/yazi/plugins/exifaudio.yazi/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# 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 -# Automatically with yazi 0.3.0 -ya pack -a "Sonico98/exifaudio" - -# Or manually under: -# 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`. - -Optional: if you have [mediainfo](https://mediaarea.net/en/MediaInfo) installed and in your `PATH`, it will be used instead for more accurate metadata. Exiftool is still required to display the cover. - -## Thanks - -Thanks to [sxyazi](https://github.com/sxyazi) for the PDF previewer code, on which this previewer is based on. diff --git a/config/yazi/plugins/exifaudio.yazi/main.lua b/config/yazi/plugins/exifaudio.yazi/main.lua deleted file mode 100644 index 60e024b6..00000000 --- a/config/yazi/plugins/exifaudio.yazi/main.lua +++ /dev/null @@ -1,237 +0,0 @@ -local M = {} - -function GetPath(str) - local sep = '/' - if ya.target_family() == "windows" then - sep = '\\' - end - return str:match("(.*"..sep..")") -end - -function Exiftool(...) - 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(...), - }) - :stdout(Command.PIPED) - :stderr(Command.NULL) - :spawn() - return child -end - -function Mediainfo(...) - local file, cache_dir = ... - local template = cache_dir.."mediainfo.txt" - local child = Command("mediainfo") - :args({ - "--Output=file://"..template, tostring(file) - }) - :stdout(Command.PIPED) - :stderr(Command.NULL) - :spawn() - return child -end - -function M:peek(job) - local cache = ya.file_cache(job) - if not cache then - return - end - - -- Get cache dir to find the mediainfo template file - local cache_dir = GetPath(tostring(cache)) - - -- Try mediainfo, otherwise use exiftool - local status, child = pcall(Mediainfo, job.file.url, cache_dir) - if not status or child == nil then - status, child = pcall(Exiftool, job.file.url) - if not status or child == nil then - local error = ui.Line { ui.Span("Make sure exiftool is installed and in your PATH") } - -- TODO)) Remove legacy method when v0.4 gets released - local function display_error_legacy() - local p = ui.Paragraph(job.area, { error }):wrap(ui.Paragraph.WRAP) - ya.preview_widgets(job, { p }) - end - local function display_error() - local p = ui.Text(error):area(job.area):wrap(ui.Text.WRAP) - ya.preview_widgets(job, { p }) - end - if pcall(display_error) then else pcall(display_error_legacy) end - return - end - end - - local limit = job.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 > job.skip then - local m_title, m_tag = Prettify(next) - if m_title ~= "" and m_tag ~= "" then - 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 - end - until i >= job.skip + limit - - -- TODO)) Remove legacy method when v0.4 gets released - local function display_metadata_legacy() - local p = ui.Paragraph(job.area, metadata):wrap(ui.Paragraph.WRAP) - ya.preview_widgets(job, { p }) - end - local function display_metadata() - local p = ui.Text(metadata):area(job.area):wrap(ui.Text.WRAP) - ya.preview_widgets(job, { p }) - end - if pcall(display_metadata) then else pcall(display_metadata_legacy) end - - local cover_width = job.area.w / 2 - 5 - local cover_height = (job.area.h / 4) + 3 - - local bottom_right = ui.Rect { - x = job.area.right - cover_width, - y = job.area.bottom - cover_height, - w = cover_width, - h = cover_height, - } - - if self:preload(job) == 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 - if str ~= "\n" then - table.insert(t, str) - else - table.insert(t, nil) - end - end - - -- Add back semicolon to title, rejoin tag data if it happened to contain a semicolon - local title, tag_data = "", "" - if t[1] ~= nil then - title, tag_data = t[1]..":", table.concat(t, ":", 2) - end - return title, tag_data - -end - -function M:seek(job) - local h = cx.active.current.hovered - if h and h.url == job.file.url then - ya.manager_emit("peek", { - tostring(math.max(0, cx.active.preview.skip + job.units)), - only_if = tostring(job.file.url), - }) - end -end - -function M:preload(job) - local cache = ya.file_cache(job) - if not cache or fs.cha(cache) then - if not ya.__250127 then -- TODO: remove this - return 1 - end - return true - end - - local mediainfo_template = 'General;"\ -$if(%Track%,Title: %Track%,)\ -$if(%Track/Sort%,Sort Title: %Track/Sort%,)\ -$if(%Title/Sort%,Sort Title: %Title/Sort%,)\ -$if(%TITLESORT%,Sort Title: %TITLESORT%,)\ -$if(%Performer%,Artist: %Performer%,)\ -$if(%Performer/Sort%,Sort Artist: %Performer/Sort%,)\ -$if(%ARTISTSORT%,Sort Artist: %ARTISTSORT%,)\ -$if(%Album%,Album: %Album%,)\ -$if(%Album/Sort%,Sort Album: %Album/Sort%)\ -$if(%ALBUMSORT%,Sort Album: %ALBUMSORT%)\ -$if(%Album/Performer%,Album Artist: %Album/Performer%)\ -$if(%Album/Performer/Sort%,Sort Album Artist: %Album/Performer/Sort%)\ -$if(%Genre%,Genre: %Genre%)\ -$if(%Track/Position%,Track Number: %Track/Position%)\ -$if(%Recorded_Date%,Year: %Recorded_Date%)\ -$if(%Duration/String%,Duration: %Duration/String%)\ -$if(%BitRate/String%,Bitrate: %BitRate/String%)\ -"\ -Audio;"Sample Rate: %SamplingRate%\ -Channels: %Channel(s)%"\ -' - - -- Write the mediainfo template file into yazi's cache dir - local cache_dir = GetPath(tostring(cache)) - fs.write(Url(cache_dir.."mediainfo.txt"), mediainfo_template) - - local output = Command("exiftool") - :args({ "-b", "-CoverArt", "-Picture", tostring(job.file.url) }) - :stdout(Command.PIPED) - :stderr(Command.PIPED) - :output() - - if not output then - if not ya.__250127 then -- TODO: remove this - return 0 - end - return true, Err("Couldn't extract cover art, error: %s", err) - end - - return fs.write(cache, output.stdout) and true or false -end - -return M diff --git a/config/yazi/plugins/glow.yazi/LICENSE b/config/yazi/plugins/glow.yazi/LICENSE deleted file mode 100644 index de882e53..00000000 --- a/config/yazi/plugins/glow.yazi/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright © 2024 Reledia - -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. diff --git a/config/yazi/plugins/glow.yazi/README.md b/config/yazi/plugins/glow.yazi/README.md deleted file mode 100644 index ba66ae77..00000000 --- a/config/yazi/plugins/glow.yazi/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# glow.yazi - -Plugin for [Yazi](https://github.com/sxyazi/yazi) to preview markdown files with [glow](https://github.com/charmbracelet/glow). To install, run the below mentioned command: - -```bash -ya pack -a Reledia/glow -``` - -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`. - -## Feature - -+ You can modify line wrap in `main.lua`, the current value is 55. -+ You can press `ctrl+e` to scroll up and `ctrl+y` to scroll down the readme file in preview panel in yazi: (add this to `keymap.toml`) -```toml -prepend_keymap = [ - # glow.yazi - { on = [""], run = "seek 5" }, - { on = [""], run = "seek -5" }, -] -``` diff --git a/config/yazi/plugins/glow.yazi/main.lua b/config/yazi/plugins/glow.yazi/main.lua deleted file mode 100644 index 8883feb4..00000000 --- a/config/yazi/plugins/glow.yazi/main.lua +++ /dev/null @@ -1,64 +0,0 @@ -local M = {} - -function M:peek(job) - -- Set a fixed width of 50 characters for the preview - local preview_width = 55 - - local child = Command("glow") - :args({ - "--style", - "dark", - "--width", - tostring(preview_width), -- Use fixed width instead of job.area.w - tostring(job.file.url), - }) - :env("CLICOLOR_FORCE", "1") - :stdout(Command.PIPED) - :stderr(Command.PIPED) - :spawn() - - if not child then - return require("code").peek(job) - end - - local limit = job.area.h - local i, lines = 0, "" - repeat - local next, event = child:read_line() - if event == 1 then - return require("code").peek(job) - elseif event ~= 0 then - break - end - - i = i + 1 - if i > job.skip then - lines = lines .. next - end - until i >= job.skip + limit - - child:start_kill() - if job.skip > 0 and i < job.skip + limit then - ya.mgr_emit("peek", { - tostring(math.max(0, i - limit)), - only_if = job.file.url, - upper_bound = true - }) - else - lines = lines:gsub("\t", string.rep(" ", rt.preview.tab_size)) - ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) }) - end -end - -function M:seek(job) - local h = cx.active.current.hovered - if not h or h.url ~= job.file.url then - return - end - ya.mgr_emit('peek', { - math.max(0, cx.active.preview.skip + job.units), - only_if = job.file.url, - }) -end - -return M diff --git a/config/yazi/plugins/mediainfo.yazi/LICENSE b/config/yazi/plugins/mediainfo.yazi/LICENSE new file mode 100644 index 00000000..0399f1c2 --- /dev/null +++ b/config/yazi/plugins/mediainfo.yazi/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2024 Lauri Niskanen + +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. diff --git a/config/yazi/plugins/mediainfo.yazi/README.md b/config/yazi/plugins/mediainfo.yazi/README.md new file mode 100644 index 00000000..71a2b942 --- /dev/null +++ b/config/yazi/plugins/mediainfo.yazi/README.md @@ -0,0 +1,98 @@ +# mediainfo.yazi + + + +- [mediainfo.yazi](#mediainfo-yazi) + - [Installation](#installation) + + +This is a Yazi plugin for previewing media files. The preview shows thumbnail +using `ffmpeg` if available and media metadata using `mediainfo`. + +> [!IMPORTANT] +> Minimum version: yazi v25.2.7. + +## Preview + +- Video + +![video](assets/2025-02-15-09-15-39.png) + +- Audio file with cover + +![audio_with_cover_picture](assets/2025-02-15-09-14-23.png) + +- Images + +![image](assets/2025-02-15-16-52-39.png) + +- Subtitle + +![subrip](assets/2025-02-15-16-51-11.png) + +- SVG+XML file doesn't have useful information, so it only show the image preview. +- There are more extensions which are supported by mediainfo. Just add file's MIME type to `previewers`, `preloaders`. + +## Installation + +Install mediainfo CLI: + +- [https://mediaarea.net/en/MediaInfo/Download](https://mediaarea.net/en/MediaInfo/Download) +- Run this command in terminal to check if it's installed correctly: + + ```bash + mediainfo --version + ``` + +- If it output `Not found` then add it to your PATH environment variable. It's better to ask ChatGPT to help you (Prompt: `Add MediaInfo CLI to PATH environment variable in Windows`). + +Install + config this plugin: + +> [!IMPORTANT] +> `mediainfo` use video, image, svg, magick built-in plugins behind the scene to render preview image, song cover. +> So you can remove those 3 plugins from `preloaders` and `previewers` sections in `yazi.toml`. + +If you have cache problem, run this cmd, and follow the tips: `yazi --clear-cache` + +```bash +ya pack -a boydaihungst/mediainfo +``` + +Config folder for each OS: https://yazi-rs.github.io/docs/configuration/overview +Create `.../yazi/yazi.toml` and add: + +```toml +[plugin] + prepend_preloaders = [ + # Replace magick, image, video with mediainfo + { mime = "{audio,video,image}/*", run = "mediainfo" }, + { mime = "application/subrip", run = "mediainfo" }, + ] + prepend_previewers = [ + # Replace magick, image, video with mediainfo + { mime = "{audio,video,image}/*", run = "mediainfo"}, + { mime = "application/subrip", run = "mediainfo" }, + ] + # There are more extensions which are supported by mediainfo. + # Just add file's MIME type to `previewers`, `preloaders` above. + # https://mediaarea.net/en/MediaInfo/Support/Formats + +``` + +## Custom theme + +Using the same style with spotter +Read more: https://github.com/sxyazi/yazi/pull/2391 + +Edit or add `yazi/theme.toml`: + +```toml +[spot] +# Section header style. +# Example: Video, Text, Image,... with green color in preview images above +title = { fg = "green" } + +# Value style. +# Example: `Format: FLAC` with blue color in preview images above +tbl_col = { fg = "blue" } +``` diff --git a/config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-09-14-23.png b/config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-09-14-23.png new file mode 100644 index 00000000..2b758d2a Binary files /dev/null and b/config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-09-14-23.png differ diff --git a/config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-09-15-39.png b/config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-09-15-39.png new file mode 100644 index 00000000..b24ade58 Binary files /dev/null and b/config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-09-15-39.png differ diff --git a/config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-16-51-11.png b/config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-16-51-11.png new file mode 100644 index 00000000..bb3279aa Binary files /dev/null and b/config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-16-51-11.png differ diff --git a/config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-16-52-39.png b/config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-16-52-39.png new file mode 100644 index 00000000..9e23c410 Binary files /dev/null and b/config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-16-52-39.png differ diff --git a/config/yazi/plugins/mediainfo.yazi/main.lua b/config/yazi/plugins/mediainfo.yazi/main.lua new file mode 100644 index 00000000..814bfc13 --- /dev/null +++ b/config/yazi/plugins/mediainfo.yazi/main.lua @@ -0,0 +1,237 @@ +--- @since 25.2.7 + +local skip_labels = { + ["Complete name"] = true, + ["CompleteName_Last"] = true, + ["Unique ID"] = true, + ["File size"] = true, + ["Format/Info"] = true, + ["Codec ID/Info"] = true, + ["MD5 of the unencoded content"] = true, +} + +local magick_image_mimes = { + avif = true, + hei = true, + heic = true, + heif = true, + ["heif-sequence"] = true, + ["heic-sequence"] = true, + jxl = true, + xml = true, + ["svg+xml"] = true, +} + +local M = {} +local suffix = "_mediainfo" + +local function read_mediainfo_cached_file(file_path) + -- Open the file in read mode + local file = io.open(file_path, "r") + + if file then + -- Read the entire file content + local content = file:read("*all") + file:close() + return content + end +end + +function M:peek(job) + local start = os.clock() + local cache_img_url_no_skip = ya.file_cache({ file = job.file, skip = 0 }) + if not job.mime then + return + end + local is_video = string.find(job.mime, "^video/") + local is_audio = string.find(job.mime, "^audio/") + local is_image = string.find(job.mime, "^image/") + local cache_img_url = (is_audio or is_image) and cache_img_url_no_skip + + if is_video then + cache_img_url = ya.file_cache({ file = job.file, skip = math.min(90, job.skip) }) + end + local ok, err = self:preload(job) + if not ok or err then + return + end + local cache_mediainfo_path = tostring(cache_img_url_no_skip) .. suffix + ya.sleep(math.max(0, (rt and rt.preview or PREVIEW).image_delay / 1000 + start - os.clock())) + local output = read_mediainfo_cached_file(cache_mediainfo_path) + + local lines = {} + local max_lines = math.floor(job.area.h / 2) + local last_line = 0 + local is_wrap = rt and rt.preview and rt.preview.wrap == "yes" + + if output then + local max_width = math.max(1, job.area.w) + if output:match("^Error:") then + job.args.force_reload_mediainfo = true + local _ok, _err = self:preload(job) + if not _ok or _err then + return + end + output = read_mediainfo_cached_file(cache_mediainfo_path) + end + + for str in output:gsub("\n+$", ""):gmatch("[^\n]*") do + local label, value = str:match("(.*[^ ]) +: (.*)") + local line + if label then + if not skip_labels[label] then + line = ui.Line({ + ui.Span(label .. ": "):style(ui.Style():fg("reset"):bold()), + ui.Span(value):style((th and th.spot and th.spot.tbl_col) or ui.Style():fg("blue")), + }) + end + elseif str ~= "General" then + line = ui.Line({ ui.Span(str):style((th and th.spot and th.spot.title) or ui.Style():fg("green")) }) + end + + if line then + local line_height = math.max(1, is_wrap and math.ceil(line:width() / max_width) or 1) + if (last_line + line_height) > job.skip then + table.insert(lines, line) + end + if (last_line + line_height) >= job.skip + max_lines then + last_line = job.skip + max_lines + break + end + last_line = last_line + line_height + end + end + end + local mediainfo_height = math.min(max_lines, last_line) + + if (job.skip > 0 and #lines == 0) and (not is_video or (is_video and job.skip >= 90)) then + ya.manager_emit("peek", { math.max(0, job.skip - max_lines), only_if = job.file.url, upper_bound = false }) + return + end + local rendered_img_rect = cache_img_url + and ya.image_show( + cache_img_url, + ui.Rect({ + x = job.area.x, + y = job.area.y, + w = job.area.w, + h = job.area.h - mediainfo_height, + }) + ) + or nil + local image_height = rendered_img_rect and rendered_img_rect.h or 0 + + ya.preview_widgets(job, { + ui.Text(lines) + :area(ui.Rect({ + x = job.area.x, + y = job.area.y + image_height, + w = job.area.w, + h = job.area.h - image_height, + })) + :wrap(is_wrap and ui.Text.WRAP or ui.Text.WRAP_NO), + }) +end + +function M:seek(job) + local h = cx.active.current.hovered + if h and h.url == job.file.url then + local step = ya.clamp(-10, job.units, 10) + ya.manager_emit("peek", { + math.max(0, cx.active.preview.skip + job.units), + only_if = job.file.url, + }) + end +end + +function M:preload(job) + local cache_img_url_no_skip = ya.file_cache({ file = job.file, skip = 0 }) + local cache_img_url_no_skip_cha = cache_img_url_no_skip and fs.cha(cache_img_url_no_skip) + if not cache_img_url_no_skip then + return true + end + local cache_mediainfo_url = Url(tostring(cache_img_url_no_skip) .. suffix) + local err_msg = "" + -- seekable mimetype + if job.mime and string.find(job.mime, "^video/") then + local video = require("video") + local cache_img_status, video_preload_err = video:preload({ file = job.file, skip = math.min(90, job.skip) }) + if not cache_img_status and video_preload_err then + err_msg = err_msg + .. string.format("Failed to start `%s`, Do you have `%s` installed?\n", "ffmpeg", "ffmpeg") + end + end + -- none-seekable mimetype + if cache_img_url_no_skip and (not cache_img_url_no_skip_cha or cache_img_url_no_skip_cha.len <= 0) then + -- audio + if job.mime and string.find(job.mime, "^audio/") then + local qv = 31 - math.floor((rt and rt.preview or PREVIEW).image_quality * 0.3) + local status, _ = Command("ffmpeg"):args({ + "-v", + "quiet", + "-threads", + 1, + "-hwaccel", + "auto", + "-skip_frame", + "nokey", + "-an", + "-sn", + "-dn", + "-i", + tostring(job.file.url), + "-vframes", + 1, + "-q:v", + qv, + "-vf", + string.format( + "scale=-1:'min(%d,ih)':flags=fast_bilinear", + (rt and rt.preview or PREVIEW).max_height / 2 + ), + "-f", + "image2", + "-y", + tostring(cache_img_url_no_skip), + }):status() + + -- NOTE: Ignore this err msg because some audio types doesn't have cover image + -- + -- if not status or not status.success then + -- err_msg = err_msg + -- .. string.format("Failed to start `%s`, Do you have `%s` installed?\n", "ffmpeg", "ffmpeg") + -- end + + -- image + elseif job.mime and string.find(job.mime, "^image/") then + local svg_plugin_ok, svg_plugin = pcall(require, "svg") + local mime = job.mime:match(".*/(.*)$") + + local image = magick_image_mimes[mime] + and ((mime == "svg+xml" and svg_plugin_ok) and svg_plugin or require("magick")) + or require("image") + local no_skip_job = { skip = 0, file = job.file } + -- image = ya.dict_merge(image, no_skip_job) + local cache_img_status, image_preload_err = image:preload(no_skip_job) + if not cache_img_status and image_preload_err then + err_msg = err_msg .. "Failed to cache image , check cache folder permissions\n" + end + end + end + + local cache_mediainfo_cha = fs.cha(cache_mediainfo_url) + if cache_mediainfo_cha and not job.args.force_reload_mediainfo then + return true + end + local cmd = "mediainfo" + local output, err = Command(cmd):args({ tostring(job.file.url) }):stdout(Command.PIPED):output() + if err then + err_msg = err_msg .. string.format("Failed to start `%s`, Do you have `%s` installed?\n", cmd, cmd) + end + return fs.write( + cache_mediainfo_url, + (err_msg ~= "" and "Error: " .. err_msg or "") .. (output and output.stdout or "") + ) +end + +return M diff --git a/config/yazi/plugins/mime-ext.yazi/LICENSE b/config/yazi/plugins/mime-ext.yazi/LICENSE new file mode 100644 index 00000000..fb5b1d62 --- /dev/null +++ b/config/yazi/plugins/mime-ext.yazi/LICENSE @@ -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. diff --git a/config/yazi/plugins/mime-ext.yazi/README.md b/config/yazi/plugins/mime-ext.yazi/README.md new file mode 100644 index 00000000..e7715765 --- /dev/null +++ b/config/yazi/plugins/mime-ext.yazi/README.md @@ -0,0 +1,56 @@ +# mime-ext.yazi + +A mime-type provider based on a file extension database, replacing the [builtin `file(1)`](https://github.com/sxyazi/yazi/blob/main/yazi-plugin/preset/plugins/mime.lua) to speed up mime-type retrieval at the expense of accuracy. + +See https://yazi-rs.github.io/docs/tips#make-yazi-even-faster for more information. + +## Installation + +```sh +ya pack -a yazi-rs/plugins:mime-ext +``` + +## Usage + +Add this to your `~/.config/yazi/yazi.toml`: + +```toml +[[plugin.prepend_fetchers]] +id = "mime" +name = "*" +run = "mime-ext" +prio = "high" +``` + +## Advanced + +You can also customize it in your `~/.config/yazi/init.lua` with: + +```lua +require("mime-ext"):setup { + -- Expand the existing filename database (lowercase), for example: + with_files = { + makefile = "text/makefile", + -- ... + }, + + -- Expand the existing extension database (lowercase), for example: + with_exts = { + mk = "text/makefile", + -- ... + }, + + -- If the mime-type is not in both filename and extension databases, + -- then fallback to Yazi's preset `mime` plugin, which uses `file(1)` + fallback_file1 = false, +} +``` + +## TODO + +- Add more file types (PRs welcome!). +- Compress mime-type tables. + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/config/yazi/plugins/mime-ext.yazi/main.lua b/config/yazi/plugins/mime-ext.yazi/main.lua new file mode 100644 index 00000000..c3e06388 --- /dev/null +++ b/config/yazi/plugins/mime-ext.yazi/main.lua @@ -0,0 +1,1126 @@ +--- @since 25.4.4 + +local FILES = { + [".envrc"] = "text/plain", + [".gitconfig"] = "text/plain", + [".gitignore"] = "text/plain", + [".luacheckrc"] = "text/lua", + [".npmrc"] = "text/plain", + [".styluaignore"] = "text/plain", + [".zshenv"] = "text/plain", + [".zshrc"] = "text/plain", + ["cargo.lock"] = "application/json", + ["flake.lock"] = "application/json", + license = "text/plain", +} + +local EXTS = { + ["123"] = "application/lotus-1-2-3", + ["3dml"] = "text/in3d.3dml", + ["3ds"] = "image/3ds", + ["3g2"] = "video/3gpp2", + ["3gp"] = "video/3gpp", + ["7z"] = "application/7z-compressed", + ["for"] = "text/fortran", + ["in"] = "text/plain", + ["n-gage"] = "application/nokia.n-gage.symbian.install", + ["sfd-hdstx"] = "application/hydrostatix.sof-data", + aab = "application/authorware-bin", + aac = "audio/aac", + aam = "application/authorware-map", + aas = "application/authorware-seg", + abw = "application/abiword", + ac = "application/pkix-attr-cert", + acc = "application/americandynamics.acc", + ace = "application/ace-compressed", + acu = "application/acucobol", + acutc = "application/acucorp", + adp = "audio/adpcm", + aep = "application/audiograph", + afm = "application/font-type1", + afp = "application/ibm.modcap", + ahead = "application/ahead.space", + ai = "application/postscript", + aif = "audio/aiff", + aifc = "audio/aiff", + aiff = "audio/aiff", + air = "application/adobe.air-application-installer-package+zip", + ait = "application/dvb.ait", + ami = "application/amiga.ami", + apk = "application/android.package-archive", + appcache = "text/cache-manifest", + application = "application/ms-application", + apr = "application/lotus-approach", + arc = "application/freearc", + asc = "application/pgp-signature", + asf = "video/ms-asf", + asm = "text/asm", + aso = "application/accpac.simply.aso", + ass = "text/ass", + asx = "video/ms-asf", + atc = "application/acucorp", + atom = "application/atom+xml", + atomcat = "application/atomcat+xml", + atomsvc = "application/atomsvc+xml", + atx = "application/antix.game-component", + au = "audio/basic", + avi = "video/msvideo", + avif = "image/avif", + aw = "application/applixware", + azf = "application/airzip.filesecure.azf", + azs = "application/airzip.filesecure.azs", + azw = "application/amazon.ebook", + bash = "text/shellscript", + bat = "application/msdownload", + bcpio = "application/bcpio", + bdf = "application/font-bdf", + bdm = "application/syncml.dm+wbxml", + bean = "text/plain", + beancount = "text/plain", + bed = "application/realvnc.bed", + bh2 = "application/fujitsu.oasysprs", + bin = "application/octet-stream", + blb = "application/blorb", + blorb = "application/blorb", + bmi = "application/bmi", + bmp = "image/bmp", + book = "application/framemaker", + box = "application/previewsystems.box", + boz = "application/bzip2", + bpk = "application/octet-stream", + btif = "image/prs.btif", + bz = "application/bzip", + bz2 = "application/bzip2", + c = "text/c", + c11amc = "application/cluetrust.cartomobile-config", + c11amz = "application/cluetrust.cartomobile-config-pkg", + c4d = "application/clonk.c4group", + c4f = "application/clonk.c4group", + c4g = "application/clonk.c4group", + c4p = "application/clonk.c4group", + c4u = "application/clonk.c4group", + cab = "application/ms-cab-compressed", + caf = "audio/caf", + cap = "application/tcpdump.pcap", + car = "application/curl.car", + cat = "application/ms-pki.seccat", + cb7 = "application/cbr", + cba = "application/cbr", + cbr = "application/cbr", + cbt = "application/cbr", + cbz = "application/cbr", + cc = "text/c", + cct = "application/director", + ccxml = "application/ccxml+xml", + cdbcmsg = "application/contact.cmsg", + cdf = "application/netcdf", + cdkey = "application/mediastation.cdkey", + cdmia = "application/cdmi-capability", + cdmic = "application/cdmi-container", + cdmid = "application/cdmi-domain", + cdmio = "application/cdmi-object", + cdmiq = "application/cdmi-queue", + cdx = "chemical/cdx", + cdxml = "application/chemdraw+xml", + cdy = "application/cinderella", + cer = "application/pkix-cert", + cfg = "text/plain", + cfs = "application/cfs-compressed", + cgm = "image/cgm", + chat = "application/chat", + chm = "application/ms-htmlhelp", + chrt = "application/kde.kchart", + cif = "chemical/cif", + cii = "application/anser-web-certificate-issue-initiation", + cil = "application/ms-artgalry", + cla = "application/claymore", + class = "application/java-vm", + clkk = "application/crick.clicker.keyboard", + clkp = "application/crick.clicker.palette", + clkt = "application/crick.clicker.template", + clkw = "application/crick.clicker.wordbank", + clkx = "application/crick.clicker", + clp = "application/msclip", + cmc = "application/cosmocaller", + cmdf = "chemical/cmdf", + cml = "chemical/cml", + cmp = "application/yellowriver-custom-menu", + cmx = "image/cmx", + cod = "application/rim.cod", + com = "application/msdownload", + conf = "text/plain", + cpio = "application/cpio", + cpp = "text/c", + cpt = "application/mac-compactpro", + crd = "application/mscardfile", + crl = "application/pkix-crl", + crt = "application/x509-ca-cert", + cryptonote = "application/rig.cryptonote", + csh = "application/csh", + csml = "chemical/csml", + csp = "application/commonspace", + css = "text/css", + cst = "application/director", + csv = "text/csv", + cu = "application/cu-seeme", + curl = "text/curl", + cww = "application/prs.cww", + cxt = "application/director", + cxx = "text/c", + dae = "model/collada+xml", + daf = "application/mobius.daf", + dart = "application/dart", + dataless = "application/fdsn.seed", + davmount = "application/davmount+xml", + dbk = "application/docbook+xml", + dcr = "application/director", + dcurl = "text/curl.dcurl", + dd2 = "application/oma.dd2+xml", + ddd = "application/fujixerox.ddd", + deb = "application/debian-package", + def = "text/plain", + deploy = "application/octet-stream", + der = "application/x509-ca-cert", + dfac = "application/dreamfactory", + dgc = "application/dgc-compressed", + dic = "text/c", + dir = "application/director", + dis = "application/mobius.dis", + dist = "application/octet-stream", + distz = "application/octet-stream", + djv = "image/djvu", + djvu = "image/djvu", + dll = "application/msdownload", + dmg = "application/apple-diskimage", + dmp = "application/tcpdump.pcap", + dms = "application/octet-stream", + dna = "application/dna", + doc = "application/msword", + docm = "application/ms-word.document.macroenabled.12", + docx = "application/openxmlformats-officedocument.wordprocessingml.document", + dot = "application/msword", + dotm = "application/ms-word.template.macroenabled.12", + dotx = "application/openxmlformats-officedocument.wordprocessingml.template", + dp = "application/osgi.dp", + dpg = "application/dpgraph", + dra = "audio/dra", + dsc = "text/prs.lines.tag", + dssc = "application/dssc+der", + dtb = "application/dtbook+xml", + dtd = "application/xml-dtd", + dts = "audio/dts", + dtshd = "audio/dts.hd", + dump = "application/octet-stream", + dvb = "video/dvb.file", + dvi = "application/dvi", + dwf = "model/dwf", + dwg = "image/dwg", + dxf = "image/dxf", + dxp = "application/spotfire.dxp", + dxr = "application/director", + ebuild = "application/gentoo.ebuild", + ecelp4800 = "audio/nuera.ecelp4800", + ecelp7470 = "audio/nuera.ecelp7470", + ecelp9600 = "audio/nuera.ecelp9600", + eclass = "application/gentoo.eclass", + ecma = "application/ecmascript", + edm = "application/novadigm.edm", + edx = "application/novadigm.edx", + efif = "application/picsel", + ei6 = "application/pg.osasli", + elc = "application/octet-stream", + emf = "application/msmetafile", + eml = "message/rfc822", + emma = "application/emma+xml", + emz = "application/msmetafile", + env = "text/plain", + eol = "audio/digital-winds", + eot = "application/ms-fontobject", + eps = "application/postscript", + epub = "application/epub+zip", + es3 = "application/eszigno3+xml", + esa = "application/osgi.subsystem", + esf = "application/epson.esf", + et3 = "application/eszigno3+xml", + etx = "text/setext", + eva = "application/eva", + evy = "application/envoy", + exe = "application/msdownload", + exi = "application/exi", + ext = "application/novadigm.ext", + ez = "application/andrew-inset", + ez2 = "application/ezpix-album", + ez3 = "application/ezpix-package", + f = "text/fortran", + f4v = "video/f4v", + f77 = "text/fortran", + f90 = "text/fortran", + fbs = "image/fastbidsheet", + fcdt = "application/adobe.formscentral.fcdt", + fcs = "application/isac.fcs", + fdf = "application/fdf", + fe_launch = "application/denovo.fcselayout-link", + fg5 = "application/fujitsu.oasysgp", + fgd = "application/director", + fh = "image/freehand", + fh4 = "image/freehand", + fh5 = "image/freehand", + fh7 = "image/freehand", + fhc = "image/freehand", + fig = "application/xfig", + fish = "text/shellscript", + flac = "audio/flac", + fli = "video/fli", + flo = "application/micrografx.flo", + flv = "video/flv", + flw = "application/kde.kivio", + flx = "text/fmi.flexstor", + fly = "text/fly", + fm = "application/framemaker", + fnc = "application/frogans.fnc", + fpx = "image/fpx", + frame = "application/framemaker", + fsc = "application/fsc.weblaunch", + fst = "image/fst", + ftc = "application/fluxtime.clip", + fti = "application/anser-web-funds-transfer-initiation", + fvt = "video/fvt", + fxp = "application/adobe.fxp", + fxpl = "application/adobe.fxp", + fzs = "application/fuzzysheet", + g2w = "application/geoplan", + g3 = "image/g3fax", + g3w = "application/geospace", + gac = "application/groove-account", + gam = "application/tads", + gbr = "application/rpki-ghostbusters", + gca = "application/gca-compressed", + gdl = "model/gdl", + geo = "application/dynageo", + gex = "application/geometry-explorer", + ggb = "application/geogebra.file", + ggs = "application/geogebra.slides", + ggt = "application/geogebra.tool", + ghf = "application/groove-help", + gif = "image/gif", + gim = "application/groove-identity-message", + gml = "application/gml+xml", + gmx = "application/gmx", + gnumeric = "application/gnumeric", + go = "text/go", + gph = "application/flographit", + gpx = "application/gpx+xml", + gqf = "application/grafeq", + gqs = "application/grafeq", + gram = "application/srgs", + gramps = "application/gramps-xml", + gre = "application/geometry-explorer", + grv = "application/groove-injector", + grxml = "application/srgs+xml", + gsf = "application/font-ghostscript", + gtar = "application/gtar", + gtm = "application/groove-tool-message", + gtw = "model/gtw", + gv = "text/graphviz", + gxf = "application/gxf", + gxt = "application/geonext", + h = "text/c", + h261 = "video/h261", + h263 = "video/h263", + h264 = "video/h264", + hal = "application/hal+xml", + hbci = "application/hbci", + hcl = "text/hcl", + hdf = "application/hdf", + hh = "text/c", + hlp = "application/winhlp", + hpgl = "application/hp-hpgl", + hpid = "application/hp-hpid", + hpp = "text/c", + hps = "application/hp-hps", + hqx = "application/mac-binhex40", + htke = "application/kenameaapp", + htm = "text/html", + html = "text/html", + hvd = "application/yamaha.hv-dic", + hvp = "application/yamaha.hv-voice", + hvs = "application/yamaha.hv-script", + i2g = "application/intergeo", + icc = "application/iccprofile", + ice = "conference/cooltalk", + icm = "application/iccprofile", + ico = "image/icon", + ics = "text/calendar", + ief = "image/ief", + ifb = "text/calendar", + ifm = "application/shana.informed.formdata", + iges = "model/iges", + igl = "application/igloader", + igm = "application/insors.igm", + igs = "model/iges", + igx = "application/micrografx.igx", + iif = "application/shana.informed.interchange", + imp = "application/accpac.simply.imp", + ims = "application/ms-ims", + ini = "text/plain", + ink = "application/inkml+xml", + inkml = "application/inkml+xml", + install = "application/install-instructions", + iota = "application/astraea-software.iota", + ipfix = "application/ipfix", + ipk = "application/shana.informed.package", + irm = "application/ibm.rights-management", + irp = "application/irepository.package+xml", + iso = "application/iso9660-image", + itp = "application/shana.informed.formtemplate", + ivp = "application/immervision-ivp", + ivu = "application/immervision-ivu", + jad = "text/sun.j2me.app-descriptor", + jam = "application/jam", + jar = "application/java-archive", + java = "text/java-source", + jisp = "application/jisp", + jlt = "application/hp-jlyt", + jnlp = "application/java-jnlp-file", + joda = "application/joost.joda-archive", + jpe = "image/jpeg", + jpeg = "image/jpeg", + jpg = "image/jpeg", + jpgm = "video/jpm", + jpgv = "video/jpeg", + jpm = "video/jpm", + js = "text/javascript", + json = "application/json", + jsonc = "application/json", + jsonml = "application/jsonml+json", + jsx = "text/jsx", + jxl = "image/jxl", + kar = "audio/midi", + karbon = "application/kde.karbon", + kfo = "application/kde.kformula", + kia = "application/kidspiration", + kml = "application/google-earth.kml+xml", + kmz = "application/google-earth.kmz", + kne = "application/kinar", + knp = "application/kinar", + kon = "application/kde.kontour", + kpr = "application/kde.kpresenter", + kpt = "application/kde.kpresenter", + kpxx = "application/ds-keypoint", + ksp = "application/kde.kspread", + ktr = "application/kahootz", + ktx = "image/ktx", + ktz = "application/kahootz", + kwd = "application/kde.kword", + kwt = "application/kde.kword", + lasxml = "application/las.las+xml", + latex = "application/latex", + lbd = "application/llamagraphics.life-balance.desktop", + lbe = "application/llamagraphics.life-balance.exchange+xml", + les = "application/hhe.lesson-player", + lha = "application/lzh-compressed", + link66 = "application/route66.link66+xml", + list = "text/plain", + list3820 = "application/ibm.modcap", + listafp = "application/ibm.modcap", + lnk = "application/ms-shortcut", + log = "text/plain", + lostxml = "application/lost+xml", + lrf = "application/octet-stream", + lrm = "application/ms-lrm", + ltf = "application/frogans.ltf", + lua = "text/lua", + lvp = "audio/lucent.voice", + lwp = "application/lotus-wordpro", + lzh = "application/lzh-compressed", + m13 = "application/msmediaview", + m14 = "application/msmediaview", + m1v = "video/mpeg", + m21 = "application/mp21", + m2a = "audio/mpeg", + m2t = "video/mp2t", + m2ts = "video/mp2t", + m2v = "video/mpeg", + m3a = "audio/mpeg", + m3u = "audio/mpegurl", + m3u8 = "application/apple.mpegurl", + m4a = "audio/mp4", + m4u = "video/mpegurl", + m4v = "video/m4v", + ma = "application/mathematica", + mads = "application/mads+xml", + mag = "application/ecowin.chart", + maker = "application/framemaker", + man = "text/troff", + mar = "application/octet-stream", + mathml = "application/mathml+xml", + mb = "application/mathematica", + mbk = "application/mobius.mbk", + mbox = "application/mbox", + mc1 = "application/medcalcdata", + mcd = "application/mcd", + mcurl = "text/curl.mcurl", + md = "text/markdown", + mdb = "application/msaccess", + mdi = "image/ms-modi", + me = "text/troff", + mesh = "model/mesh", + meta4 = "application/metalink4+xml", + metalink = "application/metalink+xml", + mets = "application/mets+xml", + mfm = "application/mfmp", + mft = "application/rpki-manifest", + mgp = "application/osgeo.mapguide.package", + mgz = "application/proteus.magazine", + mid = "audio/midi", + midi = "audio/midi", + mie = "application/mie", + mif = "application/mif", + mime = "message/rfc822", + mj2 = "video/mj2", + mjp2 = "video/mj2", + mjs = "text/javascript", + mk3d = "video/matroska", + mka = "audio/matroska", + mks = "video/matroska", + mkv = "video/matroska", + mlp = "application/dolby.mlp", + mmd = "application/chipnuts.karaoke-mmd", + mmf = "application/smaf", + mmr = "image/fujixerox.edmics-mmr", + mng = "video/mng", + mny = "application/msmoney", + mobi = "application/mobipocket-ebook", + mods = "application/mods+xml", + mov = "video/quicktime", + movie = "video/sgi-movie", + mp2 = "audio/mpeg", + mp21 = "application/mp21", + mp2a = "audio/mpeg", + mp3 = "audio/mpeg", + mp4 = "video/mp4", + mp4a = "audio/mp4", + mp4s = "application/mp4", + mp4v = "video/mp4", + mpc = "application/mophun.certificate", + mpe = "video/mpeg", + mpeg = "video/mpeg", + mpg = "video/mpeg", + mpg4 = "video/mp4", + mpga = "audio/mpeg", + mpkg = "application/apple.installer+xml", + mpm = "application/blueice.multipass", + mpn = "application/mophun.application", + mpp = "application/ms-project", + mpt = "application/ms-project", + mpy = "application/ibm.minipay", + mqy = "application/mobius.mqy", + mrc = "application/marc", + mrcx = "application/marcxml+xml", + ms = "text/troff", + mscml = "application/mediaservercontrol+xml", + mseed = "application/fdsn.mseed", + mseq = "application/mseq", + msf = "application/epson.msf", + msh = "model/mesh", + msi = "application/msdownload", + msl = "application/mobius.msl", + msty = "application/muvee.style", + mts = "video/mp2t", + mus = "application/musician", + musicxml = "application/recordare.musicxml+xml", + mvb = "application/msmediaview", + mwf = "application/mfer", + mxf = "application/mxf", + mxl = "application/recordare.musicxml", + mxml = "application/xv+xml", + mxs = "application/triscape.mxs", + mxu = "video/mpegurl", + n3 = "text/n3", + nb = "application/mathematica", + nbp = "application/wolfram.player", + nc = "application/netcdf", + ncx = "application/dtbncx+xml", + nfo = "text/nfo", + ngdat = "application/nokia.n-gage.data", + nitf = "application/nitf", + nix = "text/nix", + nlu = "application/neurolanguage.nlu", + nml = "application/enliven", + nnd = "application/noblenet-directory", + nns = "application/noblenet-sealer", + nnw = "application/noblenet-web", + npx = "image/net-fpx", + nsc = "application/conference", + nsf = "application/lotus-notes", + ntf = "application/nitf", + nzb = "application/nzb", + oa2 = "application/fujitsu.oasys2", + oa3 = "application/fujitsu.oasys3", + oas = "application/fujitsu.oasys", + obd = "application/msbinder", + obj = "application/tgif", + oda = "application/oda", + odb = "application/oasis.opendocument.database", + odc = "application/oasis.opendocument.chart", + odf = "application/oasis.opendocument.formula", + odft = "application/oasis.opendocument.formula-template", + odg = "application/oasis.opendocument.graphics", + odi = "application/oasis.opendocument.image", + odm = "application/oasis.opendocument.text-master", + odp = "application/oasis.opendocument.presentation", + ods = "application/oasis.opendocument.spreadsheet", + odt = "application/oasis.opendocument.text", + oga = "audio/ogg", + ogg = "audio/ogg", + ogv = "video/ogg", + ogx = "application/ogg", + omdoc = "application/omdoc+xml", + onepkg = "application/onenote", + onetmp = "application/onenote", + onetoc = "application/onenote", + onetoc2 = "application/onenote", + opf = "application/oebps-package+xml", + opml = "text/opml", + oprc = "application/palm", + opus = "audio/ogg", + org = "application/lotus-organizer", + osf = "application/yamaha.openscoreformat", + osfpvg = "application/yamaha.openscoreformat.osfpvg+xml", + otc = "application/oasis.opendocument.chart-template", + otf = "font/otf", + otg = "application/oasis.opendocument.graphics-template", + oth = "application/oasis.opendocument.text-web", + oti = "application/oasis.opendocument.image-template", + otp = "application/oasis.opendocument.presentation-template", + ots = "application/oasis.opendocument.spreadsheet-template", + ott = "application/oasis.opendocument.text-template", + oxps = "application/oxps", + oxt = "application/openofficeorg.extension", + p = "text/pascal", + p10 = "application/pkcs10", + p12 = "application/pkcs12", + p7b = "application/pkcs7-certificates", + p7c = "application/pkcs7-mime", + p7m = "application/pkcs7-mime", + p7r = "application/pkcs7-certreqresp", + p7s = "application/pkcs7-signature", + p8 = "application/pkcs8", + pas = "text/pascal", + patch = "text/diff", + paw = "application/pawaafile", + pbd = "application/powerbuilder6", + pbm = "image/portable-bitmap", + pcap = "application/tcpdump.pcap", + pcf = "application/font-pcf", + pcl = "application/hp-pcl", + pclxl = "application/hp-pclxl", + pct = "image/pict", + pcurl = "application/curl.pcurl", + pcx = "image/pcx", + pdb = "application/palm", + pdf = "application/pdf", + pfa = "application/font-type1", + pfb = "application/font-type1", + pfm = "application/font-type1", + pfr = "application/font-tdpfr", + pfx = "application/pkcs12", + pgm = "image/portable-graymap", + pgn = "application/chess-pgn", + pgp = "application/pgp-encrypted", + php = "text/php", + pic = "image/pict", + pkg = "application/octet-stream", + pki = "application/pkixcmp", + pkipath = "application/pkix-pkipath", + plb = "application/3gpp.pic-bw-large", + plc = "application/mobius.plc", + plf = "application/pocketlearn", + pls = "application/pls+xml", + pml = "application/ctc-posml", + png = "image/png", + pnm = "image/portable-anymap", + portpkg = "application/macports.portpkg", + pot = "application/ms-powerpoint", + potm = "application/ms-powerpoint.template.macroenabled.12", + potx = "application/openxmlformats-officedocument.presentationml.template", + ppam = "application/ms-powerpoint.addin.macroenabled.12", + ppd = "application/cups-ppd", + ppm = "image/portable-pixmap", + pps = "application/ms-powerpoint", + ppsm = "application/ms-powerpoint.slideshow.macroenabled.12", + ppsx = "application/openxmlformats-officedocument.presentationml.slideshow", + ppt = "application/ms-powerpoint", + pptm = "application/ms-powerpoint.presentation.macroenabled.12", + pptx = "application/openxmlformats-officedocument.presentationml.presentation", + pqa = "application/palm", + prc = "application/mobipocket-ebook", + pre = "application/lotus-freelance", + prf = "application/pics-rules", + ps = "application/postscript", + psb = "application/3gpp.pic-bw-small", + psd = "image/adobe.photoshop", + psf = "application/font-linux-psf", + pskcxml = "application/pskc+xml", + ptid = "application/pvi.ptid1", + pub = "application/mspublisher", + pvb = "application/3gpp.pic-bw-var", + pwn = "application/3m.post-it-notes", + py = "text/python", + pya = "audio/ms-playready.media.pya", + pyv = "video/ms-playready.media.pyv", + qam = "application/epson.quickanime", + qbo = "application/intu.qbo", + qfx = "application/intu.qfx", + qml = "text/qml", + qps = "application/publishare-delta-tree", + qt = "video/quicktime", + qwd = "application/quark.quarkxpress", + qwt = "application/quark.quarkxpress", + qxb = "application/quark.quarkxpress", + qxd = "application/quark.quarkxpress", + qxl = "application/quark.quarkxpress", + qxt = "application/quark.quarkxpress", + r = "text/r", + ra = "audio/pn-realaudio", + ram = "audio/pn-realaudio", + rar = "application/rar", + ras = "image/cmu-raster", + rb = "text/ruby", + rcprofile = "application/ipunplugged.rcprofile", + rdf = "application/rdf+xml", + rdz = "application/data-vision.rdz", + rep = "application/businessobjects", + res = "application/dtbresource+xml", + rgb = "image/rgb", + rif = "application/reginfo+xml", + rip = "audio/rip", + ris = "application/research-info-systems", + rl = "application/resource-lists+xml", + rlc = "image/fujixerox.edmics-rlc", + rld = "application/resource-lists-diff+xml", + rm = "application/rn-realmedia", + rmi = "audio/midi", + rmp = "audio/pn-realaudio-plugin", + rms = "application/jcp.javame.midlet-rms", + rmvb = "application/rn-realmedia-vbr", + rnc = "application/relax-ng-compact-syntax", + roa = "application/rpki-roa", + roff = "text/troff", + rp9 = "application/cloanto.rp9", + rpm = "application/rpm", + rpss = "application/nokia.radio-presets", + rpst = "application/nokia.radio-preset", + rq = "application/sparql-query", + rs = "text/rust", + rsd = "application/rsd+xml", + rss = "application/rss+xml", + rtf = "application/rtf", + rtx = "text/richtext", + s = "text/asm", + s3m = "audio/s3m", + saf = "application/yamaha.smaf-audio", + sbml = "application/sbml+xml", + sc = "application/ibm.secure-container", + scd = "application/msschedule", + scm = "application/lotus-screencam", + scq = "application/scvp-cv-request", + scs = "application/scvp-cv-response", + scss = "text/scss", + scurl = "text/curl.scurl", + sda = "application/stardivision.draw", + sdc = "application/stardivision.calc", + sdd = "application/stardivision.impress", + sdkd = "application/solent.sdkm+xml", + sdkm = "application/solent.sdkm+xml", + sdp = "application/sdp", + sdw = "application/stardivision.writer", + see = "application/seemail", + seed = "application/fdsn.seed", + sema = "application/sema", + semd = "application/semd", + semf = "application/semf", + ser = "application/java-serialized-object", + setpay = "application/set-payment-initiation", + setreg = "application/set-registration-initiation", + sfs = "application/spotfire.sfs", + sfv = "text/sfv", + sgi = "image/sgi", + sgl = "application/stardivision.writer-global", + sgm = "text/sgml", + sgml = "text/sgml", + sh = "text/shellscript", + shar = "application/shar", + shf = "application/shf+xml", + sid = "image/mrsid-image", + sig = "application/pgp-signature", + sil = "audio/silk", + silo = "model/mesh", + sis = "application/symbian.install", + sisx = "application/symbian.install", + sit = "application/stuffit", + sitx = "application/stuffitx", + skd = "application/koan", + skm = "application/koan", + skp = "application/koan", + skt = "application/koan", + sldm = "application/ms-powerpoint.slide.macroenabled.12", + sldx = "application/openxmlformats-officedocument.presentationml.slide", + slt = "application/epson.salt", + sm = "application/stepmania.stepchart", + smf = "application/stardivision.math", + smi = "application/smil+xml", + smil = "application/smil+xml", + smv = "video/smv", + smzip = "application/stepmania.package", + snd = "audio/basic", + snf = "application/font-snf", + so = "application/octet-stream", + spc = "application/pkcs7-certificates", + spf = "application/yamaha.smaf-phrase", + spl = "application/futuresplash", + spot = "text/in3d.spot", + spp = "application/scvp-vp-response", + spq = "application/scvp-vp-request", + spx = "audio/ogg", + sql = "application/sql", + src = "application/wais-source", + srt = "application/subrip", + sru = "application/sru+xml", + srx = "application/sparql-results+xml", + ssdl = "application/ssdl+xml", + sse = "application/kodak-descriptor", + ssf = "application/epson.ssf", + ssml = "application/ssml+xml", + st = "application/sailingtracker.track", + stc = "application/sun.xml.calc.template", + std = "application/sun.xml.draw.template", + stf = "application/wt.stf", + sti = "application/sun.xml.impress.template", + stk = "application/hyperstudio", + stl = "application/ms-pki.stl", + str = "application/pg.format", + stw = "application/sun.xml.writer.template", + sub = "text/dvb.subtitle", + sus = "application/sus-calendar", + susp = "application/sus-calendar", + sv4cpio = "application/sv4cpio", + sv4crc = "application/sv4crc", + svc = "application/dvb.service", + svd = "application/svd", + svg = "image/svg+xml", + svgz = "image/svg+xml", + swa = "application/director", + swf = "application/shockwave-flash", + swi = "application/aristanetworks.swi", + sxc = "application/sun.xml.calc", + sxd = "application/sun.xml.draw", + sxg = "application/sun.xml.writer.global", + sxi = "application/sun.xml.impress", + sxm = "application/sun.xml.math", + sxw = "application/sun.xml.writer", + t = "text/troff", + t3 = "application/t3vm-image", + taglet = "application/mynfc", + tao = "application/tao.intent-module-archive", + tar = "application/tar", + tcap = "application/3gpp2.tcap", + tcl = "application/tcl", + teacher = "application/smart.teacher", + tei = "application/tei+xml", + teicorpus = "application/tei+xml", + tex = "application/tex", + texi = "application/texinfo", + texinfo = "application/texinfo", + text = "text/plain", + tf = "text/hcl", + tfi = "application/thraud+xml", + tfm = "application/tex-tfm", + tfrc = "text/hcl", + tfstate = "application/json", + tfvars = "text/hcl", + tga = "image/tga", + thmx = "application/ms-officetheme", + tif = "image/tiff", + tiff = "image/tiff", + tmo = "application/tmobile-livetv", + toml = "text/toml", + torrent = "application/bittorrent", + tpl = "application/groove-tool-template", + tpt = "application/trid.tpt", + tr = "text/troff", + tra = "application/trueapp", + trm = "application/msterminal", + ts = "text/typescript", + tsd = "application/timestamped-data", + tsv = "text/tab-separated-values", + tsx = "text/tsx", + ttc = "font/collection", + ttf = "font/ttf", + ttl = "text/turtle", + twd = "application/simtech-mindmapper", + twds = "application/simtech-mindmapper", + txd = "application/genomatix.tuxedo", + txf = "application/mobius.txf", + txt = "text/plain", + u32 = "application/authorware-bin", + udeb = "application/debian-package", + ufd = "application/ufdl", + ufdl = "application/ufdl", + ulx = "application/glulx", + umj = "application/umajin", + unityweb = "application/unity", + uoml = "application/uoml+xml", + uri = "text/uri-list", + uris = "text/uri-list", + urls = "text/uri-list", + ustar = "application/ustar", + utz = "application/uiq.theme", + uu = "text/uuencode", + uva = "audio/dece.audio", + uvd = "application/dece.data", + uvf = "application/dece.data", + uvg = "image/dece.graphic", + uvh = "video/dece.hd", + uvi = "image/dece.graphic", + uvm = "video/dece.mobile", + uvp = "video/dece.pd", + uvs = "video/dece.sd", + uvt = "application/dece.ttml+xml", + uvu = "video/uvvu.mp4", + uvv = "video/dece.video", + uvva = "audio/dece.audio", + uvvd = "application/dece.data", + uvvf = "application/dece.data", + uvvg = "image/dece.graphic", + uvvh = "video/dece.hd", + uvvi = "image/dece.graphic", + uvvm = "video/dece.mobile", + uvvp = "video/dece.pd", + uvvs = "video/dece.sd", + uvvt = "application/dece.ttml+xml", + uvvu = "video/uvvu.mp4", + uvvv = "video/dece.video", + uvvx = "application/dece.unspecified", + uvvz = "application/dece.zip", + uvx = "application/dece.unspecified", + uvz = "application/dece.zip", + vcard = "text/vcard", + vcd = "application/cdlink", + vcf = "text/vcard", + vcg = "application/groove-vcard", + vcs = "text/vcalendar", + vcx = "application/vcx", + vis = "application/visionary", + viv = "video/vivo", + vob = "video/ms-vob", + vor = "application/stardivision.writer", + vox = "application/authorware-bin", + vrml = "model/vrml", + vsd = "application/visio", + vsf = "application/vsf", + vss = "application/visio", + vst = "application/visio", + vsw = "application/visio", + vtu = "model/vtu", + vxml = "application/voicexml+xml", + w3d = "application/director", + wad = "application/doom", + wasm = "application/wasm", + wav = "audio/wav", + wax = "audio/ms-wax", + wbmp = "image/wap.wbmp", + wbs = "application/criticaltools.wbs+xml", + wbxml = "application/wap.wbxml", + wcm = "application/ms-works", + wdb = "application/ms-works", + wdp = "image/ms-photo", + weba = "audio/webm", + webm = "video/webm", + webp = "image/webp", + wg = "application/pmi.widget", + wgt = "application/widget", + wks = "application/ms-works", + wm = "video/ms-wm", + wma = "audio/ms-wma", + wmd = "application/ms-wmd", + wmf = "application/msmetafile", + wml = "text/wap.wml", + wmlc = "application/wap.wmlc", + wmls = "text/wap.wmlscript", + wmlsc = "application/wap.wmlscriptc", + wmv = "video/ms-wmv", + wmx = "video/ms-wmx", + wmz = "application/ms-wmz", + woff = "font/woff", + woff2 = "font/woff2", + wpd = "application/wordperfect", + wpl = "application/ms-wpl", + wps = "application/ms-works", + wqd = "application/wqd", + wri = "application/mswrite", + wrl = "model/vrml", + wsdl = "application/wsdl+xml", + wspolicy = "application/wspolicy+xml", + wtb = "application/webturbo", + wvx = "video/ms-wvx", + x32 = "application/authorware-bin", + x3d = "model/x3d+xml", + x3db = "model/x3d+binary", + x3dbz = "model/x3d+binary", + x3dv = "model/x3d+vrml", + x3dvz = "model/x3d+vrml", + x3dz = "model/x3d+xml", + xaml = "application/xaml+xml", + xap = "application/silverlight-app", + xar = "application/xara", + xbap = "application/ms-xbap", + xbd = "application/fujixerox.docuworks.binder", + xbm = "image/xbitmap", + xdf = "application/xcap-diff+xml", + xdm = "application/syncml.dm+xml", + xdp = "application/adobe.xdp+xml", + xdssc = "application/dssc+xml", + xdw = "application/fujixerox.docuworks", + xenc = "application/xenc+xml", + xer = "application/patch-ops-error+xml", + xfdf = "application/adobe.xfdf", + xfdl = "application/xfdl", + xht = "application/xhtml+xml", + xhtml = "application/xhtml+xml", + xhvml = "application/xv+xml", + xif = "image/xiff", + xla = "application/ms-excel", + xlam = "application/ms-excel.addin.macroenabled.12", + xlc = "application/ms-excel", + xlf = "application/xliff+xml", + xlm = "application/ms-excel", + xls = "application/ms-excel", + xlsb = "application/ms-excel.sheet.binary.macroenabled.12", + xlsm = "application/ms-excel.sheet.macroenabled.12", + xlsx = "application/openxmlformats-officedocument.spreadsheetml.sheet", + xlt = "application/ms-excel", + xltm = "application/ms-excel.template.macroenabled.12", + xltx = "application/openxmlformats-officedocument.spreadsheetml.template", + xlw = "application/ms-excel", + xm = "audio/xm", + xml = "application/xml", + xo = "application/olpc-sugar", + xop = "application/xop+xml", + xpak = "application/gentoo.xpak", + xpi = "application/xpinstall", + xpl = "application/xproc+xml", + xpm = "image/xpixmap", + xpr = "application/is-xpr", + xps = "application/ms-xpsdocument", + xpw = "application/intercon.formnet", + xpx = "application/intercon.formnet", + xsl = "application/xml", + xslt = "application/xslt+xml", + xsm = "application/syncml+xml", + xspf = "application/xspf+xml", + xul = "application/mozilla.xul+xml", + xvm = "application/xv+xml", + xvml = "application/xv+xml", + xwd = "image/xwindowdump", + xyz = "chemical/xyz", + xz = "application/xz", + yaml = "text/yaml", + yang = "application/yang", + yin = "application/yin+xml", + yml = "text/yaml", + z1 = "application/zmachine", + z2 = "application/zmachine", + z3 = "application/zmachine", + z4 = "application/zmachine", + z5 = "application/zmachine", + z6 = "application/zmachine", + z7 = "application/zmachine", + z8 = "application/zmachine", + zaz = "application/zzazz.deck+xml", + zip = "application/zip", + zir = "application/zul", + zirz = "application/zul", + zmm = "application/handheld-entertainment+xml", + zsh = "text/shellscript", +} + +local options = ya.sync( + function(st) + return { + with_files = st.with_files, + with_exts = st.with_exts, + fallback_file1 = st.fallback_file1, + } + end +) + +local M = {} + +function M:setup(opts) + opts = opts or {} + + self.with_files = opts.with_files + self.with_exts = opts.with_exts + self.fallback_file1 = opts.fallback_file1 +end + +function M:fetch(job) + local opts = options() + local merged_files = ya.dict_merge(FILES, opts.with_files or {}) + local merged_exts = ya.dict_merge(EXTS, opts.with_exts or {}) + + local updates, unknown, state = {}, {}, {} + for i, file in ipairs(job.files) do + if file.cha.is_dummy then + state[i] = false + goto continue + end + + local mime + if file.cha.len == 0 then + mime = "inode/empty" + else + mime = merged_files[(file.url.name or ""):lower()] + mime = mime or merged_exts[(file.url.ext or ""):lower()] + end + + if mime then + updates[tostring(file.url)], state[i] = mime, true + elseif opts.fallback_file1 then + unknown[#unknown + 1] = file + else + updates[tostring(file.url)], state[i] = "application/octet-stream", true + end + ::continue:: + end + + if next(updates) then + ya.mgr_emit("update_mimes", { updates = updates }) + end + + if #unknown > 0 then + return self.fallback_builtin(job, unknown, state) + end + + return state +end + +function M.fallback_builtin(job, unknown, state) + local indices = {} + for i, f in ipairs(job.files) do + indices[f:hash()] = i + end + + local result = require("mime"):fetch(ya.dict_merge(job, { files = unknown })) + for i, f in ipairs(unknown) do + if type(result) == "table" then + state[indices[f:hash()]] = result[i] + else + state[indices[f:hash()]] = result + end + end + return state +end + +return M diff --git a/config/yazi/plugins/mount.yazi/LICENSE b/config/yazi/plugins/mount.yazi/LICENSE new file mode 100644 index 00000000..fb5b1d62 --- /dev/null +++ b/config/yazi/plugins/mount.yazi/LICENSE @@ -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. diff --git a/config/yazi/plugins/mount.yazi/README.md b/config/yazi/plugins/mount.yazi/README.md new file mode 100644 index 00000000..6853be77 --- /dev/null +++ b/config/yazi/plugins/mount.yazi/README.md @@ -0,0 +1,51 @@ +# mount.yazi + +> [!NOTE] +> Yazi v25.2.7 or later is required for this plugin to work. + +A mount manager for Yazi, providing disk mount, unmount, and eject functionality. + +Supported platforms: + +- Linux with [`udisksctl`](https://github.com/storaged-project/udisks) and [`lsblk`](https://github.com/util-linux/util-linux) +- macOS with `diskutil` + +https://github.com/user-attachments/assets/c6f780ab-458b-420f-85cf-2fc45fcfe3a2 + +## Installation + +```sh +ya pack -a yazi-rs/plugins:mount +``` + +## Usage + +Add this to your `~/.config/yazi/keymap.toml`: + +```toml +[[manager.prepend_keymap]] +on = "M" +run = "plugin mount" +``` + +Available keybindings: + +| Key binding | Alternate key | Action | +| ------------ | ------------- | --------------------- | +| q | - | Quit the plugin | +| k | | Move up | +| j | | Move down | +| l | | Enter the mount point | +| m | - | Mount the partition | +| u | - | Unmount the partition | +| e | - | Eject the disk | + +## TODO + +- Custom keybindings +- Windows support (I don't have an Windows machine for testing, PRs welcome!) +- Support mount, unmount, and eject the entire disk + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/config/yazi/plugins/mount.yazi/main.lua b/config/yazi/plugins/mount.yazi/main.lua new file mode 100644 index 00000000..962eeefd --- /dev/null +++ b/config/yazi/plugins/mount.yazi/main.lua @@ -0,0 +1,285 @@ +--- @since 25.2.26 + +local toggle_ui = ya.sync(function(self) + if self.children then + Modal:children_remove(self.children) + self.children = nil + else + self.children = Modal:children_add(self, 10) + end + ya.render() +end) + +local subscribe = ya.sync(function(self) + ps.unsub("mount") + ps.sub("mount", function() ya.mgr_emit("plugin", { self._id, "refresh" }) end) +end) + +local update_partitions = ya.sync(function(self, partitions) + self.partitions = partitions + self.cursor = math.max(0, math.min(self.cursor or 0, #self.partitions - 1)) + ya.render() +end) + +local active_partition = ya.sync(function(self) return self.partitions[self.cursor + 1] end) + +local update_cursor = ya.sync(function(self, cursor) + if #self.partitions == 0 then + self.cursor = 0 + else + self.cursor = ya.clamp(0, self.cursor + cursor, #self.partitions - 1) + end + ya.render() +end) + +local M = { + keys = { + { on = "q", run = "quit" }, + + { on = "k", run = "up" }, + { on = "j", run = "down" }, + { on = "l", run = { "enter", "quit" } }, + + { on = "", run = "up" }, + { on = "", run = "down" }, + { on = "", run = { "enter", "quit" } }, + + { on = "m", run = "mount" }, + { on = "u", run = "unmount" }, + { on = "e", run = "eject" }, + }, +} + +function M:new(area) + self:layout(area) + return self +end + +function M:layout(area) + local chunks = ui.Layout() + :constraints({ + ui.Constraint.Percentage(10), + ui.Constraint.Percentage(80), + ui.Constraint.Percentage(10), + }) + :split(area) + + local chunks = ui.Layout() + :direction(ui.Layout.HORIZONTAL) + :constraints({ + ui.Constraint.Percentage(10), + ui.Constraint.Percentage(80), + ui.Constraint.Percentage(10), + }) + :split(chunks[2]) + + self._area = chunks[2] +end + +function M:entry(job) + if job.args[1] == "refresh" then + return update_partitions(self.obtain()) + end + + toggle_ui() + update_partitions(self.obtain()) + subscribe() + + local tx1, rx1 = ya.chan("mpsc") + local tx2, rx2 = ya.chan("mpsc") + function producer() + while true do + local cand = self.keys[ya.which { cands = self.keys, silent = true }] or { run = {} } + for _, r in ipairs(type(cand.run) == "table" and cand.run or { cand.run }) do + tx1:send(r) + if r == "quit" then + toggle_ui() + return + end + end + end + end + + function consumer1() + repeat + local run = rx1:recv() + if run == "quit" then + tx2:send(run) + break + elseif run == "up" then + update_cursor(-1) + elseif run == "down" then + update_cursor(1) + elseif run == "enter" then + local active = active_partition() + if active and active.dist then + ya.mgr_emit("cd", { active.dist }) + end + else + tx2:send(run) + end + until not run + end + + function consumer2() + repeat + local run = rx2:recv() + if run == "quit" then + break + elseif run == "mount" then + self.operate("mount") + elseif run == "unmount" then + self.operate("unmount") + elseif run == "eject" then + self.operate("eject") + end + until not run + end + + ya.join(producer, consumer1, consumer2) +end + +function M:reflow() return { self } end + +function M:redraw() + local rows = {} + for _, p in ipairs(self.partitions or {}) do + if not p.sub then + rows[#rows + 1] = ui.Row { p.main } + elseif p.sub == "" then + rows[#rows + 1] = ui.Row { p.main, p.label or "", p.dist or "", p.fstype or "" } + else + rows[#rows + 1] = ui.Row { " " .. p.sub, p.label or "", p.dist or "", p.fstype or "" } + end + end + + return { + ui.Clear(self._area), + ui.Border(ui.Border.ALL) + :area(self._area) + :type(ui.Border.ROUNDED) + :style(ui.Style():fg("blue")) + :title(ui.Line("Mount"):align(ui.Line.CENTER)), + ui.Table(rows) + :area(self._area:pad(ui.Pad(1, 2, 1, 2))) + :header(ui.Row({ "Src", "Label", "Dist", "FSType" }):style(ui.Style():bold())) + :row(self.cursor) + :row_style(ui.Style():fg("blue"):underline()) + :widths { + ui.Constraint.Length(20), + ui.Constraint.Length(20), + ui.Constraint.Percentage(70), + ui.Constraint.Length(10), + }, + } +end + +function M.obtain() + local tbl = {} + local last + for _, p in ipairs(fs.partitions()) do + local main, sub = M.split(p.src) + if main and last ~= main then + if p.src == main then + last, p.main, p.sub, tbl[#tbl + 1] = p.src, p.src, "", p + else + last, tbl[#tbl + 1] = main, { src = main, main = main, sub = "" } + end + end + if sub then + if tbl[#tbl].sub == "" and tbl[#tbl].main == main then + tbl[#tbl].sub = nil + end + p.main, p.sub, tbl[#tbl + 1] = main, sub, p + end + end + table.sort(M.fillin(tbl), function(a, b) + if a.main == b.main then + return (a.sub or "") < (b.sub or "") + else + return a.main > b.main + end + end) + return tbl +end + +function M.split(src) + local pats = { + { "^/dev/sd[a-z]", "%d+$" }, -- /dev/sda1 + { "^/dev/nvme%d+n%d+", "p%d+$" }, -- /dev/nvme0n1p1 + { "^/dev/mmcblk%d+", "p%d+$" }, -- /dev/mmcblk0p1 + { "^/dev/disk%d+", ".+$" }, -- /dev/disk1s1 + } + for _, p in ipairs(pats) do + local main = src:match(p[1]) + if main then + return main, src:sub(#main + 1):match(p[2]) + end + end +end + +function M.fillin(tbl) + if ya.target_os() ~= "linux" then + return tbl + end + + local sources, indices = {}, {} + for i, p in ipairs(tbl) do + if p.sub and not p.fstype then + sources[#sources + 1], indices[p.src] = p.src, i + end + end + if #sources == 0 then + return tbl + end + + local output, err = Command("lsblk"):args({ "-p", "-o", "name,fstype", "-J" }):args(sources):output() + if err then + ya.dbg("Failed to fetch filesystem types for unmounted partitions: " .. err) + return tbl + end + + local t = ya.json_decode(output and output.stdout or "") + for _, p in ipairs(t and t.blockdevices or {}) do + tbl[indices[p.name]].fstype = p.fstype + end + return tbl +end + +function M.operate(type) + local active = active_partition() + if not active then + return + elseif not active.sub then + return -- TODO: mount/unmount main disk + end + + local output, err + if ya.target_os() == "macos" then + output, err = Command("diskutil"):args({ type, active.src }):output() + end + if ya.target_os() == "linux" then + if type == "eject" then + Command("udisksctl"):args({ "unmount", "-b", active.src }):status() + output, err = Command("udisksctl"):args({ "power-off", "-b", active.src }):output() + else + output, err = Command("udisksctl"):args({ type, "-b", active.src }):output() + end + end + + if not output then + M.fail("Failed to %s `%s`: %s", type, active.src, err) + elseif not output.status.success then + M.fail("Failed to %s `%s`: %s", type, active.src, output.stderr) + end +end + +function M.fail(s, ...) ya.notify { title = "Mount", content = string.format(s, ...), timeout = 10, level = "error" } end + +function M:click() end + +function M:scroll() end + +function M:touch() end + +return M diff --git a/config/yazi/plugins/nbpreview.yazi/README.md b/config/yazi/plugins/nbpreview.yazi/README.md deleted file mode 100644 index d1b65640..00000000 --- a/config/yazi/plugins/nbpreview.yazi/README.md +++ /dev/null @@ -1,91 +0,0 @@ -# nbpreview.yazi - -View your Jupyter notebooks beautifully in the preview in Yazi. - -## Requirements - -- [Yazi](https://github.com/sxyazi/yazi) version >=25.4.8 -- [nbpreview](https://github.com/paw-lu/nbpreview) - -## Previews - -image - -## Installation - -```bash -ya pack -a AnirudhG07/nbpreview - -## 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. -image - -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 - -## Using piper.yazi - -[piper.yazi](https://github.com/yazi-rs/plugins/tree/main/piper.yazi) is a general-purpose previewer - you can pass any shell command to piper and it will use the command's output as the preview content. - -To use `nbpreview` with piper, you can add this in your `yazi.toml` file: - -```toml -[[plugin.prepend_previewers]] -name = "*.ipynb" -run = 'piper -- nbpreview --no-paging --nerd-font --decorated --no-files --unicode --color --images --color-system=standard --theme=ansi_dark "$1"' -``` - -## Explore Yazi - -Yazi is an amazing, blazing fast terminal file manager, with a variety of plugins, flavors and themes. Check them out at [awesome-yazi](https://github.com/AnirudhG07/awesome-yazi) and the official [yazi webpage](https://yazi-rs.github.io/). diff --git a/config/yazi/plugins/office.yazi/LICENSE b/config/yazi/plugins/office.yazi/LICENSE new file mode 100644 index 00000000..fb5b1d62 --- /dev/null +++ b/config/yazi/plugins/office.yazi/LICENSE @@ -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. diff --git a/config/yazi/plugins/office.yazi/README.md b/config/yazi/plugins/office.yazi/README.md new file mode 100644 index 00000000..b6893cd5 --- /dev/null +++ b/config/yazi/plugins/office.yazi/README.md @@ -0,0 +1,76 @@ +
+ +# office.yazi +### A plugin to preview office documents in Yazi a duck + +preview test + +## + +
+ +## Installation +> [!TIP] +> Installing this plugin with `ya` will conveniently clone the plugin from GitHub, +> copy it to your plugins directory, and update the `package.toml` to lock its version [^1]. +> +> To install it with `ya` run: +> ```sh +> ya pack -a macydnah/office +> ``` + +> Or if you prefer a manual approach: +> ```sh +> ## For linux and MacOS +> git clone https://github.com/macydnah/office.yazi.git ~/.config/yazi/plugins/office.yazi +> +> ## For Windows +> git clone https://github.com/macydnah/office.yazi.git %AppData%\yazi\config\plugins\office.yazi +> ``` + +## Usage +In your `yazi.toml` add rules to preloaders[^2] and previewers[^3] to run `office` plugin with office documents. + +> [!NOTE] +> Your config may be different depending if you're *appending*, *prepending* or *overriding* default rules. +> If unsure, take a look at [Configuration](https://yazi-rs.github.io/docs/configuration/overview)[^4] +> and [Configuration mixing](https://yazi-rs.github.io/docs/configuration/overview#mixing)[^5] + +For a general usecase, you may use the following rules +```toml +[plugin] + +prepend_preloaders = [ + # Office Documents + { mime = "application/openxmlformats-officedocument.*", run = "office" }, + { mime = "application/oasis.opendocument.*", run = "office" }, + { mime = "application/ms-*", run = "office" }, + { mime = "application/msword", run = "office" }, + { name = "*.docx", run = "office" }, +] + +prepend_previewers = [ + # Office Documents + { mime = "application/openxmlformats-officedocument.*", run = "office" }, + { mime = "application/oasis.opendocument.*", run = "office" }, + { mime = "application/ms-*", run = "office" }, + { mime = "application/msword", run = "office" }, + { name = "*.docx", run = "office" }, +] +``` + +## Dependencies +> [!IMPORTANT] +> Make sure that these commands are installed in your system and can be found in `PATH`: +> +> - `libreoffice` +> - `pdftoppm` + +## License +office.yazi is licensed under the terms of the [MIT License](LICENSE) + +[^1]: [The official package manager for Yazi](https://yazi-rs.github.io/docs/cli) +[^2]: [Preloaders rules](https://yazi-rs.github.io/docs/configuration/yazi#plugin.preloaders) +[^3]: [Previewers rules](https://yazi-rs.github.io/docs/configuration/yazi#plugin.previewers) +[^4]: [Configuration](https://yazi-rs.github.io/docs/configuration/overview) +[^5]: [Configuration mixing](https://yazi-rs.github.io/docs/configuration/overview#mixing) diff --git a/config/yazi/plugins/office.yazi/main.lua b/config/yazi/plugins/office.yazi/main.lua new file mode 100644 index 00000000..2fa02249 --- /dev/null +++ b/config/yazi/plugins/office.yazi/main.lua @@ -0,0 +1,114 @@ +--- @since 25.2.7 + +local M = {} + +function M:peek(job) + local start, cache = os.clock(), ya.file_cache(job) + if not cache then + return + end + + local ok, err = self:preload(job) + if not ok or err then + return + end + + ya.sleep(math.max(0, rt.preview.image_delay / 1000 + start - os.clock())) + ya.image_show(cache, job.area) + ya.preview_widgets(job, {}) +end + +function M:seek(job) + local h = cx.active.current.hovered + if h and h.url == job.file.url then + local step = ya.clamp(-1, job.units, 1) + ya.manager_emit("peek", { math.max(0, cx.active.preview.skip + step), only_if = job.file.url }) + end +end + +function M:doc2pdf(job) + local tmp = "/tmp/yazi-" .. ya.uid() .. "/" .. ya.hash("office.yazi") .. "/" + +--[[ For Future Reference: Regarding `libreoffice` as preconverter + 1. It prints errors to stdout (always, doesn't matter if it succeeded or it failed) + 2. Always writes the converted files to the filesystem, so no "Mario|Bros|Piping|Magic" for the data stream (https://ask.libreoffice.org/t/using-convert-to-output-to-stdout/38753) + 3. The `pdf:draw_pdf_Export` filter needs literal double quotes when defining its options (https://help.libreoffice.org/latest/en-US/text/shared/guide/pdf_params.html?&DbPAR=SHARED&System=UNIX#generaltext/shared/guide/pdf_params.xhp) + 3.1 Regarding double quotes and Lua strings, see https://www.lua.org/manual/5.1/manual.html#2.1 --]] + local libreoffice = Command("libreoffice") + :args({ + "--headless", + "--convert-to", + "pdf:draw_pdf_Export:{" .. + "\"PageRange\":{" .. + "\"type\":\"string\"," .. + "\"value\":" .. "\"" .. job.skip + 1 .. "\"" .. + "}" .. + "}", + "--outdir", + tmp, + tostring(job.file.url) + }) + :stdin(Command.NULL) + :stdout(Command.PIPED) + :stderr(Command.NULL) + :output() + + if not libreoffice.status.success then + ya.err(libreoffice.stdout:match("LibreOffice .+"):gsub("%\n.*", "") .. " " .. libreoffice.stdout:match("Error .+"):gsub("%\n.*", "")) + return nil, Err("Failed to preconvert `%s` to a temporary PDF", job.file.name) + end + + local tmp = tmp .. job.file.name:gsub("%.[^%.]+$", ".pdf") + local read_permission = io.open(tmp, "r") + if not read_permission then + return nil, Err("Failed to read `%s`: make sure file exists and have read access", tmp) + end + read_permission:close() + + return tmp +end + +function M:preload(job) + local cache = ya.file_cache(job) + if not cache or fs.cha(cache) then + return true + end + + local tmp_pdf, err = self:doc2pdf(job) + if not tmp_pdf then + return true, Err(" " .. "%s", err) + end + + local output, err = Command("pdftoppm") + :args({ + "-singlefile", + "-jpeg", + "-jpegopt", + "quality=" .. rt.preview.image_quality, + "-f", + 1, + tostring(tmp_pdf), + }) + :stdout(Command.PIPED) + :stderr(Command.PIPED) + :output() + + local rm_tmp_pdf, rm_err = fs.remove("file", Url(tmp_pdf)) + if not rm_tmp_pdf then + return true, Err("Failed to remove %s, error: %s", tmp_pdf, rm_err) + end + + if not output then + return true, Err("Failed to start `pdftoppm`, error: %s", err) + elseif not output.status.success then + local pages = tonumber(output.stderr:match("the last page %((%d+)%)")) or 0 + if job.skip > 0 and pages > 0 then + ya.mgr_emit("peek", { math.max(0, pages - 1), only_if = job.file.url, upper_bound = true }) + end + return true, Err("Failed to convert %s to image, stderr: %s", tmp_pdf, output.stderr) + end + + return fs.write(cache, output.stdout) +end + +return M diff --git a/config/yazi/plugins/nbpreview.yazi/LICENSE b/config/yazi/plugins/rich-preview.yazi/LICENSE similarity index 100% rename from config/yazi/plugins/nbpreview.yazi/LICENSE rename to config/yazi/plugins/rich-preview.yazi/LICENSE diff --git a/config/yazi/plugins/rich-preview.yazi/README.md b/config/yazi/plugins/rich-preview.yazi/README.md new file mode 100644 index 00000000..afacc0b6 --- /dev/null +++ b/config/yazi/plugins/rich-preview.yazi/README.md @@ -0,0 +1,89 @@ +# rich-preview.yazi + +Preview file types using `rich` command in Yazi. This plugin allows preview for various filetypes including - + +- Markdown +- Jupyter notebook +- JSON +- CSV +- RestructuredText + +## Previews/Screenshots + +[rich-preview1.webm](https://github.com/user-attachments/assets/580e36a8-249f-48a8-95fc-8c3d60e6a7d7) + +## Requirements + +- [Yazi](https://github.com/sxyazi/yazi) v0.4 or higher. +- [rich-cli](https://github.com/Textualize/rich) v13.7.1 or higher. + +## Installation + +To install this plugin, simply run- + +```bash +ya pack -a AnirudhG07/rich-preview +## For linux and MacOS +git clone https://github.com/AnirudhG07/rich-preview.yazi.git ~/.config/yazi/plugins/rich-preview.yazi + +## For Windows +git clone https://github.com/AnirudhG07/rich-preview.yazi.git %AppData%\yazi\config\plugins\rich-preview.yazi +``` + +## Usages + +The `rich` commands automatically detects if the file is markdown, csv, json, etc. files and accordingly the preview is viewed. + +Add the below to your `yazi.toml` file to allow the respective file to previewed using `rich`. + +```toml +[plugin] + +prepend_previewers = [ + { name = "*.csv", run = "rich-preview"}, # for csv files + { name = "*.md", run = "rich-preview" }, # for markdown (.md) files + { name = "*.rst", run = "rich-preview"}, # for restructured text (.rst) files + { name = "*.ipynb", run = "rich-preview"}, # for jupyter notebooks (.ipynb) + { name = "*.json", run = "rich-preview"}, # for json (.json) files +# { name = "*.lang_type", run = "rich-preview"} # for particular language files eg. .py, .go., .lua, etc. +] +``` + +## Configurations + +If you would like to use `rich` with more configurations, you can go to `init.lua` and edit the arguments in the code with your preferences. You can view the options using `rich --help`. + +```lua +-- init.lua +"-j", +"--left", +"--line-numbers", +"--force-terminal", +"--panel=rounded", +"--guides", +"--max-width" -- to area of preview +``` + +You can add more, remove and choose themes as you wish. You can set styles or Themes(as mentioned in `rich --help`) by `--theme=your_theme` and similarly for style. + +## Notes + +Currently the colors maynot be uniformly present, along with weird lines here and there. This is due to `"--force-terminal"` option. You can disable it if you find it annoying. Work is in progress to possibly fix the issue. + +## Using piper.yazi + +[piper.yazi](https://github.com/yazi-rs/plugins/tree/main/piper.yazi) is a general-purpose previewer - you can pass any shell command to piper and it will use the command's output as the preview content. + +To use `rich` with piper, you can add this in your `yazi.toml` file: + +```toml +[[plugin.prepend_previewers]] +name = "*.md" +run = 'piper -- rich -j --left --panel=rounded --guides --line-numbers --force-terminal "$1"' +``` + +Note you can also add other filetypes as mentioned above in the same format. + +# Explore Yazi + +Yazi is an amazing, blazing fast terminal file manager, with a variety of plugins, flavors and themes. Check them out at [awesome-yazi](https://github.com/AnirudhG07/awesome-yazi) and the official [yazi webpage](https://yazi-rs.github.io/). diff --git a/config/yazi/plugins/nbpreview.yazi/main.lua b/config/yazi/plugins/rich-preview.yazi/main.lua similarity index 76% rename from config/yazi/plugins/nbpreview.yazi/main.lua rename to config/yazi/plugins/rich-preview.yazi/main.lua index 79b9b3b5..7c621d08 100644 --- a/config/yazi/plugins/nbpreview.yazi/main.lua +++ b/config/yazi/plugins/rich-preview.yazi/main.lua @@ -1,22 +1,16 @@ local M = {} function M:peek(job) - local child = Command("nbpreview") + local child = Command("rich") :args({ - -- DO NOT CHANGE -- - "--no-paging", - "--nerd-font", - "--decorated", - - -- OPTIONAL CHANGES -- - "--no-files", - "--unicode", - "--color", - "--images", - - -- SPECIAL CUSTOMIZATIONS -- - "--color-system=standard", - "--theme=ansi_dark", + "-j", + "--left", + "--line-numbers", + "--force-terminal", + "--panel=rounded", + "--guides", + "--max-width", + tostring(job.area.w), tostring(job.file.url), }) :stdout(Command.PIPED) diff --git a/config/yazi/plugins/smart-filter.yazi/LICENSE b/config/yazi/plugins/smart-filter.yazi/LICENSE new file mode 100644 index 00000000..fb5b1d62 --- /dev/null +++ b/config/yazi/plugins/smart-filter.yazi/LICENSE @@ -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. diff --git a/config/yazi/plugins/smart-filter.yazi/README.md b/config/yazi/plugins/smart-filter.yazi/README.md new file mode 100644 index 00000000..8ac4c095 --- /dev/null +++ b/config/yazi/plugins/smart-filter.yazi/README.md @@ -0,0 +1,28 @@ +# smart-filter.yazi + +A Yazi plugin that makes filters smarter: continuous filtering, automatically enter unique directory, open file on submitting. + +https://github.com/yazi-rs/plugins/assets/17523360/72aaf117-1378-4f7e-93ba-d425a79deac5 + +## Installation + +```sh +ya pack -a yazi-rs/plugins:smart-filter +``` + +## Usage + +Add this to your `~/.config/yazi/keymap.toml`: + +```toml +[[manager.prepend_keymap]] +on = "F" +run = "plugin smart-filter" +desc = "Smart filter" +``` + +Make sure the F key is not used elsewhere. + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/config/yazi/plugins/smart-filter.yazi/main.lua b/config/yazi/plugins/smart-filter.yazi/main.lua new file mode 100644 index 00000000..a47acffb --- /dev/null +++ b/config/yazi/plugins/smart-filter.yazi/main.lua @@ -0,0 +1,49 @@ +--- @since 25.2.26 + +local hovered = ya.sync(function() + local h = cx.active.current.hovered + if not h then + return {} + end + + return { + url = h.url, + is_dir = h.cha.is_dir, + unique = #cx.active.current.files == 1, + } +end) + +local function prompt() + return ya.input { + title = "Smart filter:", + position = { "center", w = 50 }, + realtime = true, + debounce = 0.1, + } +end + +local function entry() + local input = prompt() + + while true do + local value, event = input:recv() + if event ~= 1 and event ~= 3 then + ya.mgr_emit("escape", { filter = true }) + break + end + + ya.mgr_emit("filter_do", { value, smart = true }) + + local h = hovered() + if h.unique and h.is_dir then + ya.mgr_emit("escape", { filter = true }) + ya.mgr_emit("enter", {}) + input = prompt() + elseif event == 1 then + ya.mgr_emit("escape", { filter = true }) + ya.mgr_emit(h.is_dir and "enter" or "open", { h.url }) + end + end +end + +return { entry = entry } diff --git a/config/yazi/plugins/time-travel.yazi/LICENSE b/config/yazi/plugins/time-travel.yazi/LICENSE new file mode 100644 index 00000000..84d96d42 --- /dev/null +++ b/config/yazi/plugins/time-travel.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Xianyi Lin + +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. \ No newline at end of file diff --git a/config/yazi/plugins/time-travel.yazi/README.md b/config/yazi/plugins/time-travel.yazi/README.md new file mode 100644 index 00000000..37a519ef --- /dev/null +++ b/config/yazi/plugins/time-travel.yazi/README.md @@ -0,0 +1,41 @@ +# time-travel.yazi + +A Yazi plugin for browsing backwards and forwards in time via BTRFS / ZFS +snapshots. + +https://github.com/user-attachments/assets/6d2fc9e7-f86e-4444-aab6-4e11e51e8b34 + +## Installation + +```sh +ya pack -a iynaix/time-travel +``` + +> [!NOTE] +> The minimum required yazi version is 25.2.7. + +## Usage + +Add keymaps similar to the following to your `~/.config/yazi/keymap.toml`: + +```toml +[[manager.prepend_keymap]] +on = ["z", "h"] +run = "plugin time-travel --args=prev" +desc = "Go to previous snapshot" + +[[manager.prepend_keymap]] +on = ["z", "l"] +run = "plugin time-travel --args=next" +desc = "Go to next snapshot" + +[[manager.prepend_keymap]] +on = ["z", "e"] +run = "plugin time-travel --args=exit" +desc = "Exit browsing snapshots" +``` + +#### Note for BTRFS + +`sudo` is required to run btrfs commands such as `btrfs subvolume list`, the +plugin will drop into a terminal to prompt for the password. diff --git a/config/yazi/plugins/time-travel.yazi/main.lua b/config/yazi/plugins/time-travel.yazi/main.lua new file mode 100644 index 00000000..f19c261e --- /dev/null +++ b/config/yazi/plugins/time-travel.yazi/main.lua @@ -0,0 +1,386 @@ +---@param msg string +local notify_warn = function(msg) + ya.notify { title = "ZFS", content = msg, level = "warn", timeout = 5 } +end + +---@param msg string +local notify_error = function(msg) + ya.notify { title = "ZFS", content = msg, level = "error", timeout = 5 } +end + +---@param arr table +---@param predicate fun(value: any): boolean +---@return number|nil # index if found, nil if not found +local find_index = function(arr, predicate) + for i, value in ipairs(arr) do + if predicate(value) then + return i + end + end + return nil +end + +--- Verify if `sudo` is already authenticated +--- @return boolean +local function sudo_already() + local status = Command("sudo"):args({ "--validate", "--non-interactive" }):status() + assert(status, "Failed to run `sudo --validate --non-interactive`") + return status.success +end + +--- Run a program with `sudo` privilege +--- @param program string +--- @param args table +--- @return Output|nil output +--- @return integer|nil err +--- nil: no error +--- 1: sudo failed +local function run_with_sudo(program, args) + local cmd = Command("sudo"):args({ program, table.unpack(args) }):stdout(Command.PIPED):stderr(Command.PIPED) + if sudo_already() then + return cmd:output() + end + + local permit = ya.hide() + print(string.format("Sudo password required to run: `%s %s`", program, table.concat(args, " "))) + local output = cmd:output() + permit:drop() + + if output.status.success or sudo_already() then + return output + end + return nil, 1 +end + + +---@return string +local get_cwd = ya.sync(function() + return tostring(cx.active.current.cwd) +end) + +---@param s string +---@return string +local trim = function(s) + return s:match("^%s*(.-)%s*$") +end + +---@param cwd string +---@return string|nil +local get_filesystem_type = function(cwd) + local stat, _ = Command("stat"):args({ "-f", "-c", "%T", cwd }):output() + if not stat.status.success then + return nil + end + return trim(stat.stdout) +end + +---@param cwd string +---@return string|nil +local zfs_dataset = function(cwd) + local df, _ = Command("df"):args({ "--output=source", cwd }):output() + local dataset = nil + for line in df.stdout:gmatch("[^\r\n]+") do + -- dataset is last line in output + dataset = line + end + return dataset +end + +---@param dataset string +---@return string|nil +local zfs_mountpoint = function(dataset) + local zfs, _ = Command("zfs"):args({ "get", "-H", "-o", "value", "mountpoint", dataset }):output() + + -- not a dataset! + if not zfs.status.success then + return nil + end + + -- legacy mountpoint, search for actual mountpoint using df + if zfs.stdout == "legacy\n" then + local df, _ = Command("df"):output() + if not df.status.success then + return nil + end + + for line in df.stdout:gmatch("[^\r\n]+") do + -- match start of line + if string.sub(line, 1, #dataset) == dataset then + local mountpoint = nil + for field in line:gmatch("%S+") do + -- mountpoint is last field in df output + mountpoint = field + end + return mountpoint + end + end + else + return zfs.stdout:gsub("\n$", "") + end + + -- shouldn't be here + return nil +end + +-- returns the path relative to the mountpoint / snapshot +---@param cwd string +---@param mountpoint string +local zfs_relative = function(cwd, mountpoint) + -- relative path to get mountpoint + local relative = (cwd:sub(0, #mountpoint) == mountpoint) and cwd:sub(#mountpoint + 1) or cwd + + -- is a snapshot dir, strip everything after "/snapshot" + if cwd:find(".zfs/snapshot") ~= nil then + local snapshot_pos = cwd:find("/snapshot") + + -- everything after the "/snapshot/" + local after = cwd:sub(snapshot_pos + #"/snapshot" + 1) + local first_slash = after:find("/") + -- root of snapshot? + if first_slash == nil then + return "/" + else + return after:sub(first_slash) + end + end + + return relative +end + +---@class Snapshot +---@field name string +---@field path string + +---@param dataset string +---@param mountpoint string +---@param relative string +---@return Snapshot[] +local zfs_snapshots = function(dataset, mountpoint, relative) + -- -S is for reverse order + local zfs_snapshots, _ = Command("zfs"):args({ "list", "-H", "-t", "snapshot", "-o", "name", "-S", "creation", + dataset }) + :output() + + if not zfs_snapshots.status.success then + return {} + end + + ---@type Snapshot[] + local snapshots = {} + for snapshot in zfs_snapshots.stdout:gmatch("[^\r\n]+") do + -- in the format dataset@snapshot + local sep = snapshot:find("@") + local id = snapshot:sub(sep + 1) + + table.insert(snapshots, { + id = id, + path = mountpoint .. "/.zfs/snapshot/" .. id .. relative, + }) + end + return snapshots +end + +---@param cwd string +---@return string|nil +local function btrfs_mountpoint(cwd) + local cmd, _ = Command("findmnt"):args({ "-no", "TARGET", "-T", cwd }):output() + if not cmd.status.success then + return nil + end + return trim(cmd.stdout) +end + +---Returns the current uuid and the parent uuid +---@param cwd string +---@return string|nil, string|nil +local function btrfs_uuids(cwd) + local cmd, _ = run_with_sudo("btrfs", { "subvolume", "show", cwd }) + if not cmd then + return nil + end + + local parent_uuid = nil + local uuid = nil + for line in cmd.stdout:gmatch("[^\r\n]+") do + local parent_uuid_re = line:match("^%s*Parent UUID:%s*(%S+)") + if parent_uuid_re then + parent_uuid = trim(parent_uuid_re) + end + + local uuid_re = line:match("^%s*UUID:%s*(%S+)") + if uuid_re then + uuid = trim(uuid_re) + end + end + return parent_uuid, uuid +end + +---@param mountpoint string +---@param current_uuid string +---@param current_parent_uuid string|nil +---@return { snapshots: Snapshot[], latest_path: string, current_snapshot_id: string } +local function btrfs_snapshots(mountpoint, current_uuid, current_parent_uuid) + local snapshots_cmd, _ = run_with_sudo("btrfs", { "subvolume", "list", "-q", "-u", mountpoint }) + if not snapshots_cmd then + return {} + end + + local snapshots = {} + local latest_path = "" + local current_snapshot_id = "" + + for line in snapshots_cmd.stdout:gmatch("[^\r\n]+") do + local pattern = "ID (%d+) gen %d+ top level %d+ parent_uuid ([%w-]+)%s+uuid ([%w-]+) path (%S+)" + -- Extract the fields + local subvol_id, parent_uuid, uuid, name = line:match(pattern) + parent_uuid = trim(parent_uuid) + + local path = mountpoint .. "/" .. name + local is_parent = false + + if current_parent_uuid == "-" then + if parent_uuid == "-" and uuid == current_uuid then + is_parent = true + end + else + if uuid == current_parent_uuid then + is_parent = true + end + end + + if is_parent then + latest_path = path + end + + if uuid == current_uuid and not is_parent then + current_snapshot_id = name + end + + if not is_parent then + table.insert(snapshots, { + id = name, + subvol_id = subvol_id, -- used only for sorting + path = path, + }) + end + end + + -- Sort snapshots by time descending + table.sort(snapshots, function(a, b) + return a.subvol_id > b.subvol_id + end) + + return { snapshots = snapshots, latest_path = latest_path, current_snapshot_id = current_snapshot_id } +end + +return { + entry = function(_, job) + local action = job.args[1] + local cwd = get_cwd() + + if action ~= "exit" and action ~= "prev" and action ~= "next" then + return notify_error("Invalid action: " .. action) + end + + local fs_type = get_filesystem_type(cwd) + if fs_type ~= "zfs" and fs_type ~= "btrfs" then + return notify_error("Current directory is not on a BTRFS / ZFS filesystem.") + end + + local current_snapshot_id = "" + local latest_path = "" + local snapshots = {} + + if fs_type == "zfs" then + local dataset = zfs_dataset(cwd) + if dataset == nil then + return notify_error("Current directory is not within a ZFS dataset.") + end + + if cwd:find(".zfs/snapshot") ~= nil then + -- in the format dataset@snapshot + local sep = dataset:find("@") + current_snapshot_id = dataset:sub(sep + 1) + dataset = dataset:sub(1, sep - 1) + end + + local mountpoint = zfs_mountpoint(dataset) + if mountpoint == nil then + return notify_error("Current directory is not within a ZFS dataset.") + end + + -- NOTE: relative already has leading "/" + local relative = zfs_relative(cwd, mountpoint) + + latest_path = mountpoint .. relative + snapshots = zfs_snapshots(dataset, mountpoint, relative) + elseif fs_type == "btrfs" then + local mountpoint = btrfs_mountpoint(cwd) + local parent_uuid, uuid = btrfs_uuids(cwd) + + if mountpoint == nil or uuid == nil then + return notify_error("Current directory is not within a BTRFS subvolume.") + end + + local ret = btrfs_snapshots(mountpoint, uuid, parent_uuid) + snapshots = ret.snapshots + latest_path = ret.latest_path + current_snapshot_id = ret.current_snapshot_id + end + + if action == "exit" then + ya.manager_emit("cd", { latest_path }) + return + end + + if #snapshots == 0 then + return notify_warn("No snapshots found.") + end + + ---@param start_idx integer + ---@param end_idx integer + ---@param step integer + local find_and_goto_snapshot = function(start_idx, end_idx, step) + if start_idx == 0 then + -- going from newest snapshot to current state + return ya.manager_emit("cd", { latest_path }) + elseif start_idx < 0 then + return notify_warn("No earlier snapshots found.") + elseif start_idx > #snapshots then + return notify_warn("No earlier snapshots found.") + end + + for i = start_idx, end_idx, step do + local snapshot_dir = snapshots[i].path + if io.open(snapshot_dir, "r") then + return ya.manager_emit("cd", { snapshot_dir }) + end + end + + local direction = action == "prev" and "earlier" or "later" + return notify_warn("No " .. direction .. " snapshots found.") + end + + -- NOTE: latest snapshot is first in list + if current_snapshot_id == "" then + if action == "prev" then + -- go to latest snapshot + return find_and_goto_snapshot(1, #snapshots, 1) + elseif action == "next" then + return notify_warn("No later snapshots found.") + end + end + + -- has current snapshot + local idx = find_index(snapshots, function(snapshot) return snapshot.id == current_snapshot_id end) + if idx == nil then + return notify_error("Snapshot not found.") + end + + if action == "prev" then + find_and_goto_snapshot(idx + 1, #snapshots, 1) + elseif action == "next" then + find_and_goto_snapshot(idx - 1, 1, -1) + end + end, +} diff --git a/config/yazi/plugins/vidir.yazi/LICENSE b/config/yazi/plugins/vidir.yazi/LICENSE new file mode 100644 index 00000000..34034b42 --- /dev/null +++ b/config/yazi/plugins/vidir.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Kristofers Solo + +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. diff --git a/config/yazi/plugins/vidir.yazi/README.md b/config/yazi/plugins/vidir.yazi/README.md new file mode 100644 index 00000000..e59778b1 --- /dev/null +++ b/config/yazi/plugins/vidir.yazi/README.md @@ -0,0 +1,29 @@ +# vidir.yazi + +This plugin is a bulk-rename plugin using [vidir](https://linux.die.net/man/1/vidir). + +## Requirements + +- [yazi >= v25.2.7](https://github.com/sxyazi/yazi) +- [vidir](https://linux.die.net/man/1/vidir) (sometimes included in [moreutils](https://man.archlinux.org/listing/extra/moreutils/) package) + +## Installation + +```bash +ya pack -a kristoferssolo/vidir +``` + +## Usage + +Add this to your `~/.config/yazi/keymap.toml`: + +```toml +[[manager.prepend_keymap]] +on = "B" +run = [ "escape --visual", "plugin --sync vidir" ] +desc = "Bulk rename with vidir" +``` + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/config/yazi/plugins/vidir.yazi/main.lua b/config/yazi/plugins/vidir.yazi/main.lua new file mode 100644 index 00000000..90ff69c9 --- /dev/null +++ b/config/yazi/plugins/vidir.yazi/main.lua @@ -0,0 +1,9 @@ +--- @sync entry +--- @since 25.2.7 + +return { + entry = function() + -- If no selection, use current directory (.) + ya.manager_emit("shell", { "vidir .", block = true, confirm = true }) + end, +} diff --git a/config/yazi/yazi.toml b/config/yazi/yazi.toml index bfeff9ba..4c2a531b 100644 --- a/config/yazi/yazi.toml +++ b/config/yazi/yazi.toml @@ -56,7 +56,7 @@ play = [ rules = [ {name = "*/", use = [ "edit", "open", "reveal" ]}, {mime = "text/*", use = [ "edit", "reveal" ]}, - {mime = "image/*", use = [ "open", "reveal" ]}, + {mime = "image/*", use = [ "reveal" ]}, {mime = "{audio,video}/*", use = [ "play", "reveal" ]}, {mime = "inode/x-empty", use = [ "edit", "reveal" ]}, {mime = "application/*zip", use = [ "extract", "reveal" ]}, @@ -77,47 +77,65 @@ suppress_preload = false [plugin] preloaders = [ - # Image {mime = "image/*", run = "image"}, - # Video {mime = "video/*", run = "video"}, - # PDF {mime = "application/pdf", run = "pdf"}, ] +prepend_preloaders = [ + # Office Documents + {mime = "application/openxmlformats-officedocument.*", run = "office"}, + {mime = "application/oasis.opendocument.*", run = "office"}, + {mime = "application/ms-*", run = "office"}, + {mime = "application/msword", run = "office"}, + {name = "*.docx", run = "office"}, + {mime = "{audio,video,image}/*", run = "mediainfo"}, + {mime = "application/subrip", run = "mediainfo"}, +] previewers = [ {name = "*/", run = "folder", sync = true}, - # Code {mime = "text/*", run = "code"}, {mime = "*/{xml,javascript,x-wine-extension-ini}", run = "code"}, - # JSON {mime = "application/json", run = "code"}, - # Image {mime = "image/vnd.djvu", run = "noop"}, - # {mime = "image/*", run = "image"}, - # Video - # {mime = "video/*", run = "video"}, - # PDF - # {mime = "application/pdf", run = "pdf"}, + {mime = "application/pdf", run = "pdf"}, # Fallback {name = "*", run = "file"}, ] -prepend_previewers = [ ] - -append_previewers = [ - {name = "*.ipynb", run = "nbpreview"}, - {mime = "application/x-bittorrent", run = "torrent-preview"}, - {mime = "audio/*", run = "exifaudio"}, +prepend_previewers = [ {mime = "text/csv", run = "miller"}, - {name = "*.{md,mdx,markdown}", run = "glow"}, + # mediainfo + {mime = "{audio,video,image}/*", run = "mediainfo"}, + {mime = "application/subrip", run = "mediainfo"}, + # rich preview + {name = "*.csv", run = "rich-preview"}, # for csv files + {name = "*.{md,mdx,markdown}", run = "rich-preview"}, # for markdown (.md) files + {name = "*.rst", run = "rich-preview"}, # for restructured text (.rst) files + {name = "*.ipynb", run = "rich-preview"}, # for jupyter notebooks (.ipynb) + {name = "*.json", run = "rich-preview"}, # for json (.json) files + {mime = "application/bittorrent", run = "torrent-preview"}, # Archive previewer {mime = "application/*zip", run = "ouch"}, - {mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", run = "ouch"}, + {mime = "application/tar", run = "ouch"}, + {mime = "application/bzip2", run = "ouch"}, + {mime = "application/7z-compressed", run = "ouch"}, + {mime = "application/rar", run = "ouch"}, + {mime = "application/xz", run = "ouch"}, + # Office Documents + {mime = "application/openxmlformats-officedocument.*", run = "office"}, + {mime = "application/oasis.opendocument.*", run = "office"}, + {mime = "application/ms-*", run = "office"}, + {mime = "application/msword", run = "office"}, + {name = "*.docx", run = "office"}, +] + +append_previewers = [ {name = "*", run = "hexyl"}, ] prepend_fetchers = [ {id = "git", name = "*", run = "git"}, {id = "git", name = "*/", run = "git"}, + {id = "mime", name = "*", run = "mime-ext", prio = "high"}, ] [input] diff --git a/local/share/applications/file.desktop b/local/share/applications/file.desktop index f96213fd..9d017f5c 100644 --- a/local/share/applications/file.desktop +++ b/local/share/applications/file.desktop @@ -1,4 +1,4 @@ [Desktop Entry] Type=Application Name=File Manager -Exec=/usr/bin/alacritty -e yazi %u +Exec=/usr/bin/{{terminal}} -e yazi %u diff --git a/local/share/applications/text.desktop b/local/share/applications/text.desktop index 812da785..0aff33d9 100644 --- a/local/share/applications/text.desktop +++ b/local/share/applications/text.desktop @@ -1,4 +1,4 @@ [Desktop Entry] Type=Application Name=Text editor -Exec=/usr/bin/alacritty -e nvim %u +Exec=/usr/bin/{{terminal}} -e nvim %u