v0.4.0
sxyazi/yaziv0.4.0Dec 8, 2024by github-actions[bot]
AI Summary
A major release stabilizing the plugin system (BETA to stable) and introducing the 'Spotter' feature for metadata display. It also adds support for transparent image previews and CLI commands to control Yazi instances from external shells.
Key Highlights
- Spotter feature for displaying file metadata (images, videos, code) in popups
- Transparent image preview support across all 4 image backends
- Automatic dark/light mode switching for icons and flavors based on terminal background
- New CLI commands `ya emit` and `ya emit-to` to send commands to Yazi instances
Breaking Changes
- Requires migration due to plugin system API adjustments
- Breaking changes to support future extensibility
New Features
- Transparent image preview
- Dark/Light flavor support in theme.toml
- Arguments passing for previewers, preloaders, spotters, and fetchers
- Smart conflict resolution during bulk renaming
- Fallback to CSI 16 t for terminals lacking TIOCGWINSZ
- Fallback to default settings if user config cannot be parsed
Full Release Notes
This is the biggest release ever, with 53 new features, 41 fixes, and 12 performance optimizations.
The main focus of this release is improving the plugin system, and we’ve made some adjustments to certain APIs based on real-world usage to better support future extensibility. This release is a key step in moving the plugin system from BETA to stable!
**This is a breaking change release, so please make sure to read: [Migrating to Yazi v0.4.0](https://github.com/sxyazi/yazi/issues/1772)**
## Spotter
https://github.com/sxyazi/yazi/pull/1802 introduces the concept of "spotter". When you "spot" a file, a popup will show up with metadata about that file.
For example, it can display the mime type and size of a regular file, the dimensions and color space of an image, the duration and resolution of a video, or the line count of a code file, etc.
You can easily copy this info with a simple keystroke or quickly swipe through files in the spot window.
What's even cooler is that users can set custom spotters for different file types, and plugin developers can use Lua APIs to build various spotters, just like with previewers!
https://github.com/user-attachments/assets/0e034f6b-f1ec-4e53-8701-57c6f8a218e3
## Support for Transparent Image Preview
Transparent image previews are now supported in https://github.com/sxyazi/yazi/pull/1556 (Thanks to @diegodorado), and it works across all 4 image backends Yazi supports (kitty graphics-protocol, Inline images protocol, Sixel graphics format, Überzug++).

## Auto Switch Between Dark and Light Icons/Flavors Based on Terminal Background
https://github.com/sxyazi/yazi/pull/1946 adds dark/light mode support — Yazi will automatically detect your terminal's color scheme and choose the appropriate icon color and flavor.
In `theme.toml`, the `[flavor]` section now includes two new attributes, `dark` and `light`, to allow setting different flavors for light and dark modes:
```toml
# theme.toml
[flavor]
dark = "dracula"
light = "one-light"
```
## New `ya emit` and `ya emit-to` Subcommands to Emit Commands to a Specific Instance
Two new subcommands, `ya emit` and `ya emit-to`, have been added to the `ya` CLI tool in https://github.com/sxyazi/yazi/pull/1946.
They allow you to send commands from outside Yazi (e.g., from your shell) to run on a specific Yazi instance for better interactivity.
The new `ya emit` subcommand allows users to send a [command](https://yazi-rs.github.io/docs/configuration/keymap#manager) to the current Yazi instance. The format is:
```sh
ya emit <command> <args>
```
For example:
```sh
ya emit cd /tmp
ya emit reveal /tmp/foo
```
Just like you would write them in your `keymap.toml` file! You can also send commands to a specific remote instance using `ya emit-to`:
```sh
ya emit-to <receiver> <command> <args>
```
For example:
```sh
ya emit-to "$YAZI_ID" cd /tmp
```
## Support Passing Arguments to Previewer/Preloader/Spotter/Fetcher
With https://github.com/sxyazi/yazi/pull/1979, you can now pass arguments to previewers, preloaders, spotters, and fetchers when configuring them:
```toml
# yazi.toml
[plugin]
prepend_previewers = [
{ mime = "image/*", run = 'my-plugin test --foo --bar=baz' }
]
prepend_preloaders = [
{ mime = "image/*", run = 'my-plugin test --foo --bar=baz' }
]
prepend_spotters = [
{ mime = "image/*", run = 'my-plugin test --foo --bar=baz' }
]
prepend_fetchers = [
{ id = "test", mime = "image/*", run = 'my-plugin test --foo --bar=baz' }
]
```
This makes them much more flexible, meaning the same plugin can behave differently based on different arguments, tailored to the user's preferences!
## Suggest Keywords in the Header When a Finder Is Active
A new keyword indicator has been added to the header, in https://github.com/sxyazi/yazi/pull/1847, letting users know the current finding state with real-time feedback:
https://github.com/user-attachments/assets/3a1c5ada-db21-458f-996c-ebb8f6dba583
## Allow Disabling Certain Preset Keybinds with the New `noop` Virtual Command
A new `noop` command has been introduced in https://github.com/sxyazi/yazi/pull/1882:
```toml
[[manager.prepend_keymap]]
on = [ "g", "c" ]
run = "noop"
```
This allows users to disable specific default keybindings, and the disabled keys won’t appear in the "which key" component or the help menu.
## Make the Built-in `extract` Plugin Support Compressed Tarballs (`*.tar.gz`, `*.tar.bz2`, etc.)
The built-in extract plugin now has experimental support for extracting compressed tarballs, making it more convenient for users who frequently work with `.tar` files.
Thanks to @DirkFi for his excellent work on https://github.com/sxyazi/yazi/pull/1583
## Prioritize Paths That Need to Be Processed First During Bulk Renaming
The bulk renaming feature now has smart conflict resolution, done in https://github.com/sxyazi/yazi/pull/1801 (thanks to @yw1ee).
For example, if you’re renaming a list of files:
```sh
1
2
3
```
And renaming them to:
```sh
1 -> 2
2 -> 3
3 -> 4
```
Previously, Yazi would stop with an error when trying to rename `1 -> 2` because `2` already exists.
Now, it will intelligently pick files that won’t conflict and process them in order, so in this case, it will rename them like this:
```sh
3 -> 4
2 -> 3
1 -> 2
```
## Fallback to `CSI 16 t` for Terminals That Don’t Support `TIOCGWINSZ`
All terminals on Windows (MS Terminal, WezTerm for Windows) do not support `TIOCGWINSZ` because [Windows doesn't have `ioctl`](https://github.com/microsoft/terminal/issues/8581).
Some terminals based on `node-pty` also don't support it (like Tabby, VSCode, Hyper, etc.).
https://github.com/sxyazi/yazi/pull/2004 falls back to `CSI 16 t` when `TIOCGWINSZ` is unavailable to provide better image size calculation for previews.
https://github.com/user-attachments/assets/50af66ef-40a8-46f0-b1c7-f09d2dd9fb9d
## Launch From Preset Settings If the User’s Config Cannot Be Parsed
Now, if Yazi can’t parse your config file because of invalid values, it will ask if you want to launch with the default settings instead of failing to start.
This improves the user experience. Done in https://github.com/sxyazi/yazi/pull/1832
## Other improvements
These are a few of my favorite features. For a complete list of improvements in Yazi 0.4, check out the full changelog below.
## What's Changed
* fix: match icon by extension case-insensitive by @sxyazi in https://github.com/sxyazi/yazi/pull/1614
* refactor: privatize `url` of the `File` by @sxyazi in https://github.com/sxyazi/yazi/pull/1619
* perf: introduce URN to speed up large directory file sorting by @sxyazi in https://github.com/sxyazi/yazi/pull/1622
* fix: set `allow-passthrough` always to `all` instead of `on` to prevent overriding a user setting with a higher priority `all` by @sxyazi in https://github.com/sxyazi/yazi/pull/1626
* fix: set a dedicated `Mimetype` agency to reconcile regular files and search results by @sxyazi in https://github.com/sxyazi/yazi/pull/1627
* feat: make the builtin `extract` plugin support compressed tarballs (`*.tar.gz`, `*.tar.bz2`, etc.) by @DirkFi in https://github.com/sxyazi/yazi/pull/1583
* feat: support transparent image preview by @diegodorado in https://github.com/sxyazi/yazi/pull/1556
* perf: avoid unnecessary allocations in base64 encoding of IIP by @sxyazi in https://github.com/sxyazi/yazi/pull/1639
* perf: introduce URN to speed up large directory locating by @sxyazi in https://github.com/sxyazi/yazi/pull/1648
* feat: support setting different input titles for `create --dir` by @Tyarel8 in https://github.com/sxyazi/yazi/pull/1650
* perf: introduce URN to speed up large directory file updates by @sxyazi in https://github.com/sxyazi/yazi/pull/1652
* refactor: ensure that each `Url` contains the full location information by @sxyazi in https://github.com/sxyazi/yazi/pull/1659
* feat: support calling methods in builtin plugins with arbitrary types of arguments (`self` can now be omitted) by @sxyazi in https://github.com/sxyazi/yazi/pull/1666
* feat: add the `area()` API for renderable elements by @sxyazi in https://github.com/sxyazi/yazi/pull/1667
* fix: one file's mime-type changed multiple times without triggering a preview again by @sxyazi in https://github.com/sxyazi/yazi/pull/1682
* fix: `enter` and `leave` commands should treat the search results as regular entities by @sxyazi in https://github.com/sxyazi/yazi/pull/1687
* fix: `magick` previewer for multi-layered image files with `-flatten` argument by @v3natio in https://github.com/sxyazi/yazi/pull/1684
* feat: improve jemalloc memory efficiency by @dm9pZCAq in https://github.com/sxyazi/yazi/pull/1689
* feat: adapt for image preview in the Rio terminal by @raphamorim in https://github.com/sxyazi/yazi/pull/1690
* fix: increase the revision when there is a change in `Urn` on updating by @sxyazi in https://github.com/sxyazi/yazi/pull/1691
* feat: allow overriding and rewriting the sync methods of builtin plugins by @sxyazi in https://github.com/sxyazi/yazi/pull/1695
* feat: add more context to error messages by @sxyazi in https://github.com/sxyazi/yazi/pull/1701
* fix: replace control characters to printable characters in plain text preview by @sxyazi in https://github.com/sxyazi/yazi/pull/1704
* feat: async micro task initialization error handling by @sxyazi in https://github.com/sxyazi/yazi/pull/1710
* feat!: make `backspace` command not close the input even when value is empty by @XYenon in https://github.com/sxyazi/yazi/pull/1680
* feat: reuse the `code` previewer seeking behavior for `json`, `archive`, and `empty` by @sxyazi in https://github.com/sxyazi/yazi/pull/1721
* fix: temporarily disable TIFF decoding by @sxyazi in https://github.com/sxyazi/yazi/pull/1723
* refactor: turn `RectRef`, `PaddingRef`, `PositionRef` into `Rect`, `Padding`, `Position` by @sxyazi in https://github.com/sxyazi/yazi/pull/1730
* refactor: use `Kgp` instead of `Kitty` since "Kitty" is a terminal emulator not a protocol name by @sxyazi in https://github.com/sxyazi/yazi/pull/1732
* fix: compositors not supported by Überzug Wayland layer, or WSL not with WezTerm should fallback to Chafa by @sxyazi in https://github.com/sxyazi/yazi/pull/1735
* fix: clamp when seeking a non-zero unit between `-1` and `1` by @sxyazi in https://github.com/sxyazi/yazi/pull/1736
* fix: upserting operation should handle deleting in edge cases where the source and target URNs are different by @sxyazi in https://github.com/sxyazi/yazi/pull/1737
* refactor: derive the `Into<Opt>` trait with procedural macros to avoid bloat by @sxyazi in https://github.com/sxyazi/yazi/pull/1742
* perf: merge multiple file operations into one to greatly speed up updates in large directories by @sxyazi in https://github.com/sxyazi/yazi/pull/1745
* fix!: introduce a new `btime` term to align `ctime` with Unix by @sxyazi in https://github.com/sxyazi/yazi/pull/1761
* feat: `yazi --debug` supports detecting whether `tmux` is built with `--enable-sixel` by @sxyazi in https://github.com/sxyazi/yazi/pull/1762
* refactor: simplify module exports by @sxyazi in https://github.com/sxyazi/yazi/pull/1770
* refactor!: rename the term `select` to `toggle` to reserve `select` for future use by @sxyazi in https://github.com/sxyazi/yazi/pull/1773
* feat!: add `ui.Text`, `ui.Table`, remove `ui.Paragraph` and `ui.ListItem` by @sxyazi in https://github.com/sxyazi/yazi/pull/1776
* feat!: decouple `ui.List`, `ui.Bar`, `ui.Border`, and `ui.Gauge` from coordinates by @sxyazi in https://github.com/sxyazi/yazi/pull/1782
* feat: prevent paths from being treated as options in `file` command by @gaesa in https://github.com/sxyazi/yazi/pull/1783
* refactor: replace `Metadata` with `Cha` in the file scheduler to improve interoperability with `yazi-fs` by @sxyazi in https://github.com/sxyazi/yazi/pull/1785
* feat: append the suffix to the end when generating unique filenames for directories, i.e., after not before the extension by @Saru2003 in https://github.com/sxyazi/yazi/pull/1784
* fix: images were not cleared when closing a tab in front of the current tab by @sxyazi in https://github.com/sxyazi/yazi/pull/1792
* feat: add a compatibility layer for `ui.Paragraph` to help users transition more smoothly to the new `ui.Text` by @sxyazi in https://github.com/sxyazi/yazi/pull/1794
* refactor: remove migration code as it's no longer needed and causes errors by @sxyazi in https://github.com/sxyazi/yazi/pull/1795
* feat: custom styles for the `confirm` component by @GrzegorzKozub in https://github.com/sxyazi/yazi/pull/1789
* perf: apply rotate in place to images with orientation by @sxyazi in https://github.com/sxyazi/yazi/pull/1807
* feat: add ICC profile to images for better color accuracy by @sxyazi in https://github.com/sxyazi/yazi/pull/1808
* fix: use std copy function in a blocking thread by @sxyazi in https://github.com/sxyazi/yazi/pull/1817
* feat: allow customizing Zoxide's FZF options with `YAZI_ZOXIDE_OPTS` by @sxyazi in https://github.com/sxyazi/yazi/pull/1822
* fix: use a unique `Id` for each tab by @sxyazi in https://github.com/sxyazi/yazi/pull/1826
* feat: launch from preset settings if the user's config cannot be parsed by @sxyazi in https://github.com/sxyazi/yazi/pull/1832
* fix: reset image rendering and skip peeking if the TUI in the background by @sxyazi in https://github.com/sxyazi/yazi/pull/1833
* refactor: add tests for `Pattern::match_path` by @sxyazi in https://github.com/sxyazi/yazi/pull/1837
* perf: eliminate all memory reallocations during sorting by @sxyazi in https://github.com/sxyazi/yazi/pull/1846
* feat: suggest keywords in the header if a finder is active by @sxyazi in https://github.com/sxyazi/yazi/pull/1847
* fix: copy the CWD path regardless even if the directory is empty by @sxyazi in https://github.com/sxyazi/yazi/pull/1849
* perf: introduce reflow for the rendering engine by @sxyazi in https://github.com/sxyazi/yazi/pull/1863
* fix: wrong file list offset squeeze when `scrolloff = 0` by @aidancz in https://github.com/sxyazi/yazi/pull/1866
* refactor: use for loop to generate completions file by @Integral-Tech in https://github.com/sxyazi/yazi/pull/1869
* fix: use complete rendering instead of partial rendering for no task progress report by @sxyazi in https://github.com/sxyazi/yazi/pull/1876
* refactor: destructure tuples to enhance readability by @Integral-Tech in https://github.com/sxyazi/yazi/pull/1874
* feat: new `copy --separator` option to allow specifying the path separator by @alan910127 in https://github.com/sxyazi/yazi/pull/1877
* feat: allow disabling certain preset keybinds with the new `noop` virtual command by @sxyazi in https://github.com/sxyazi/yazi/pull/1882
* feat: include package revision hash in `ya pack --list` by @yudai0804 in https://github.com/sxyazi/yazi/pull/1884
* feat: add a new `tab` parameter for all tab-specific commands to specify which one by @sxyazi in https://github.com/sxyazi/yazi/pull/1885
* feat: support searching with the alias `fdfind` if `fd` cannot be found by @Integral-Tech in https://github.com/sxyazi/yazi/pull/1889
* feat!: deprecate `--sync` option for the `plugin` command by @sxyazi in https://github.com/sxyazi/yazi/pull/1891
* perf: lazy load `ui`, `ya`, `fs`, and `ps` by @sxyazi in https://github.com/sxyazi/yazi/pull/1903
* chore: add `CODE_OF_CONDUCT.md` by @Perfectio07 in https://github.com/sxyazi/yazi/pull/1911
* feat: spotter by @sxyazi in https://github.com/sxyazi/yazi/pull/1802
* feat: `noop` for spotters by @boydaihungst in https://github.com/sxyazi/yazi/pull/1924
* fix: show "0/0" instead of "1/0" in empty directories by @Integral-Tech in https://github.com/sxyazi/yazi/pull/1925
* fix!: eliminate the `x-` prefix in mime-types by @sxyazi in https://github.com/sxyazi/yazi/pull/1927
* refactor: make error messages more user-friendly by @Integral-Tech in https://github.com/sxyazi/yazi/pull/1935
* refactor: remove unnecessary UI element construction by @sxyazi in https://github.com/sxyazi/yazi/pull/1938
* feat!: use an `Error` userdata instead of a plain error code for I/O errors by @sxyazi in https://github.com/sxyazi/yazi/pull/1939
* feat: new log system by @sxyazi in https://github.com/sxyazi/yazi/pull/1945
* perf: introduce copy-on-write for event system to eliminate all memory reallocations by @sxyazi in https://github.com/sxyazi/yazi/pull/1962
* feat: true custom `mime` fetcher support - using user rules even during open or in watcher by @sxyazi in https://github.com/sxyazi/yazi/pull/1976
* feat: support `assets` installation for the `ya pack` subcommand by @zooeywm in https://github.com/sxyazi/yazi/pull/1973
* feat: new `ya emit` and `ya emit-to` subcommands to emit commands to a specified instance for execution by @sxyazi in https://github.com/sxyazi/yazi/pull/1979
* feat: new `load` DDS event by @sxyazi in https://github.com/sxyazi/yazi/pull/1980
* feat!: remove the meaningless `--confirm` option to simplify the `shell` command by @sxyazi in https://github.com/sxyazi/yazi/pull/1982
* feat: move notification from top-right to bottom-right corner to avoid covering content as much as possible by @sxyazi in https://github.com/sxyazi/yazi/pull/1984
* fix: propagate and update the directory node till its first parent when the files of a directory change by @sxyazi in https://github.com/sxyazi/yazi/pull/1987
* fix: missing a repeek on unyanking files in the hovered folder by @sxyazi in https://github.com/sxyazi/yazi/pull/1988
* fix: revise `revision` if the new file list is empty but the previous one was not by @sxyazi in https://github.com/sxyazi/yazi/pull/2003
* feat: fallback to `CSI 16 t` for certain terminals that do not support `TIOCGWINSZ` by @sxyazi in https://github.com/sxyazi/yazi/pull/2004
* docs: add README for default configuration files by @sxyazi in https://github.com/sxyazi/yazi/pull/2005
* fix: respect `PREVIEW.image_quality` for the default PDF previewer by @gaesa in https://github.com/sxyazi/yazi/pull/2006
* fix: introduce own `CWD` instead of `chdir` to avoid potential race conditions by @sxyazi in https://github.com/sxyazi/yazi/pull/2008
* fix: `backspace --under` didn't map UTF-8 character code points to byte indices by @sxyazi in https://github.com/sxyazi/yazi/pull/2010
* chore: bump version to 0.4.0 by @sxyazi in https://github.com/sxyazi/yazi/pull/2011
## New Contributors
* @DirkFi made their first contribution in https://github.com/sxyazi/yazi/pull/1583
* @diegodorado made their first contribution in https://github.com/sxyazi/yazi/pull/1556
* @Tyarel8 made their first contribution in https://github.com/sxyazi/yazi/pull/1650
* @v3natio made their first contribution in https://github.com/sxyazi/yazi/pull/1684
* @dm9pZCAq made their first contribution in https://github.com/sxyazi/yazi/pull/1689
* @raphamorim made their first contribution in https://github.com/sxyazi/yazi/pull/1690
* @Saru2003 made their first contribution in https://github.com/sxyazi/yazi/pull/1784
* @GrzegorzKozub made their first contribution in https://github.com/sxyazi/yazi/pull/1789
* @aidancz made their first contribution in https://github.com/sxyazi/yazi/pull/1866
* @alan910127 made their first contribution in https://github.com/sxyazi/yazi/pull/1877
* @yudai0804 made their first contribution in https://github.com/sxyazi/yazi/pull/1884
* @Perfectio07 made their first contribution in https://github.com/sxyazi/yazi/pull/1911
* @boydaihungst made their first contribution in https://github.com/sxyazi/yazi/pull/1924
**Full Changelog**: https://github.com/sxyazi/yazi/compare/v0.3.3...v0.4.0