Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support image preview in Windows Terminal #1588

Merged
merged 2 commits into from
Sep 2, 2024

Conversation

e82eric
Copy link
Contributor

@e82eric e82eric commented Sep 1, 2024

⚠️ Note: The DA1 response in Windows Terminal Preview 1.22.2362.0 is currently broken, which can cause Yazi to timeout on startup. It's recommended to use this patch from microsoft/terminal#17833 to experience the image preview feature.


Hi! The latest version of windows terminal supports Sixel (https://github.com/microsoft/terminal/releases/tag/v1.22.2362.0) microsoft/terminal#17421.

I wanted to make an attempt at updating Yazi to add support. This looked like it would work for both images and video. This may cause a regression for older versions of windows terminal since it won't fallback to chafa.

terminal-sixel

@sxyazi
Copy link
Owner

sxyazi commented Sep 2, 2024

Yazi already supports Sixel through the standard DA1 request. This means that as long as MS Terminal correctly sends the response indicating Sixel support, Yazi can recognize it without needing any additional detection.

But the DA1 response in Windows Terminal Preview 1.22.2362.0 is currently broken, so I can accept this PR as a temporary workaround until they fix it.

@e82eric
Copy link
Contributor Author

e82eric commented Sep 2, 2024

Ahh, I was wondering about that exact part of the code, it was taking 10s to load and I saw that it was waiting for that da1 and timing out. I will try and pull down that windows terminal branch and give it a try.

@sxyazi sxyazi changed the title Use sixel for Windows Terminal image previews feat: support image preview in Windows Terminal Sep 2, 2024
Copy link
Owner

@sxyazi sxyazi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sxyazi sxyazi merged commit e940d81 into sxyazi:main Sep 2, 2024
6 checks passed
@sxyazi
Copy link
Owner

sxyazi commented Sep 2, 2024

Hi @e82eric, could you send me an mp4 version of the PR gif demo? If possible, it would be great if you could make the window a bit smaller.

I want to use it as the demo video for the upcoming version 0.3.3 release - Yazi is probably the first terminal file manager to support image preview in MS Terminal, especially when the standard DA1 isn't available now hah😄

@e82eric
Copy link
Contributor Author

e82eric commented Sep 2, 2024

yep, working on the mp4 now.

Quick update on the MS fix, I tried that branch without my changes, and the first attempt still tried to use chafa, I commented out this if statement and it correctly detected Sixel

protocols.retain(|p| *p == Self::Sixel);
. Maybe when the MS fix is merged that can be updated to just check for Tmux?

By the way, your project is awesome!

@sxyazi
Copy link
Owner

sxyazi commented Sep 2, 2024

That's weird, this statement will only be entered if the ZELLIJ_SESSION_NAME env variable is detected:

if env_exists("ZELLIJ_SESSION_NAME") {
protocols.retain(|p| *p == Self::Sixel);
} else if *TMUX {

Are you running Yazi in Zellij?

@e82eric
Copy link
Contributor Author

e82eric commented Sep 2, 2024

Not running it in Zellij, will try to step through it to see what was happening. I was thinking it removed Sixel from everything that wasn't Zellij.

How does this look?

terminal-sixel2.mp4

@sxyazi
Copy link
Owner

sxyazi commented Sep 2, 2024

Looks great, thanks a lot!

@e82eric
Copy link
Contributor Author

e82eric commented Sep 2, 2024

Quick update. it looks like it was just this line that needed to commented out. I think it is removing everything that isn't iterm2.

protocols.retain(|p| *p == Self::Iterm2);

@sxyazi
Copy link
Owner

sxyazi commented Sep 2, 2024

Ah that makes sense, this is to ensure compatibility with third-party terminals that rely on the older version of ConPTY (like WezTerm and Mintty) for displaying images, so it still needs to be kept for now, and as time goes on and with OS updates, we can remove it in the future.

@e82eric
Copy link
Contributor Author

e82eric commented Sep 2, 2024

That makes sense, side note, start time was back to 0 on the branch with the MS fix.

@sxyazi
Copy link
Owner

sxyazi commented Sep 2, 2024

Thanks for testing, I've edited the content of this PR and added some notes about it

scottames referenced this pull request in scottames/dots Sep 6, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [eza-community/eza](https://redirect.github.com/eza-community/eza) |
patch | `v0.19.1` -> `v0.19.2` |
| [fujiwara/awslim](https://redirect.github.com/fujiwara/awslim) | patch
| `v0.3.4` -> `v0.3.5` |
|
[kevincobain2000/gobrew](https://redirect.github.com/kevincobain2000/gobrew)
| patch | `v1.10.10` -> `v1.10.11` |
| [sxyazi/yazi](https://redirect.github.com/sxyazi/yazi) | patch |
`v0.3.2` -> `v0.3.3` |
| [weaveworks/eksctl](https://redirect.github.com/weaveworks/eksctl) |
minor | `v0.189.0` -> `v0.190.0` |

---

### Release Notes

<details>
<summary>eza-community/eza (eza-community/eza)</summary>

###
[`v0.19.2`](https://redirect.github.com/eza-community/eza/releases/tag/v0.19.2):
eza v0.19.2 (the one with the theme.yml)

[Compare
Source](https://redirect.github.com/eza-community/eza/compare/v0.19.1...v0.19.2)

### Changelog

And we are back from vacation, with a packed eza release.

One highlight to take note of this release is custom theme files!

###### Custom Themes

**Eza** has recently added support for a `theme.yml` file, where you can
specify all of the existing theme-ing options
available for the `LS_COLORS` and `EXA_COLORS` environment variables, as
well as the option to specify different icons
for different file types and extensions. Any existing environment
variables set will continue to work and will take
precedence for backwards compatibility.

An example theme file is available in `docs/theme.yml`, and needs to
either be placed in a directory specified by the
environment variable `EZA_CONFIG_DIR`, or will looked for by default in
`$XDG_CONFIG_HOME/eza`.

Full details are available on the [man
page](https://redirect.github.com/eza-community/eza/tree/main/man/eza_colors-explanation.5.md)
and an example theme file is included
[here](https://redirect.github.com/eza-community/eza/tree/main/docs/theme.yml)

***

##### Bug Fixes

-   Remove unnecessary map and make clippy happy
-   Adjust grid details for CI tests
-   Imports and merge conflicts
-   Rustfmt issues
-   Clippy issues
-   Revise UiStyles::plain to have no style at all
-   Pr reviews fixes for theme file
- Selectively filter files when recursing
[#&#8203;1101](https://redirect.github.com/eza-community/eza/issues/1101)
-   Fix typo in FromOverride<FileKinds> impl
-   Add serde(default) to StyleOverride.foreground/background fields

##### Documentation

-   Add Flox to INSTALL.md
-   Add ic for icon color to colors man page
-   Add further documentation about theme file

##### Features

-   Add c++ module interfaces as source file types
-   Add icon field to UiStyles
-   Add ic key for UiStyles icon in set_exa
-   Add None as icon value in UiStyles.default_theme
-   Add icon function to FileNameColours trait
-   Implement FileNameColours.icon for Theme
-   Adjust FileName.paint to consider possible icon color
-   Begin implementation of config file
- Allow writing default theme.yml file for eventual config file
implementation
-   Theme file configuration base
-   Add IconOverrides struct and UiStyles.icon_overrides
-   Add icon_override function to FileNameColours trait
-   Implement FileNameColours.icon_override for Theme
-   Handle icon overrides in FileName.paint
-   Add example config for icon_overrides
-   Rename UiStyles.icon_override to icons and add Style field
-   Add shorthand aliases to StyleOverride variables
-   Add custom deserialize_color and use in StyleOverride
-   Outsource color_from_str function to make it testable

##### Miscellaneous Tasks

-   Release eza v0.19.2

##### Refactor

-   Simplify icon style setting in FileName.paint
-   Make every setting optional with override layer
-   Simplify sample theme.yml
-   Formatting for rustfmt macro

##### Styling

-   Fix clippy issue in FileName.paint
-   Apply rustfmt
-   Simplify from_str_radix calls to please clippy

##### Testing

-   Add unit tests for color_from_str function

##### Build

-   Bump windows-sys from 0.52.0 to 0.59.0

##### Ci

-   Allow MPL-2.0

### Checksums

#### sha256sum

0de75a2e2a1b53181e9ddc307595f5b21cfe3897301f570a3570ab3f0281b0c8
./target/bin-0.19.2/eza_aarch64-unknown-linux-gnu.tar.gz
aa979f0a8609976344fa54b7dc99472532cd65af66c037076a78fc63be4b0747
./target/bin-0.19.2/eza_aarch64-unknown-linux-gnu.zip
ec8b904da98c2cc675e4d2d790cb71369bbb4dc0d736ebdc96a46a104a908e01
./target/bin-0.19.2/eza_arm-unknown-linux-gnueabihf.tar.gz
cda9699c2a209949c8d8a4b29bf31837ce7aaba8fb14989d765e41be828d1cc3
./target/bin-0.19.2/eza_arm-unknown-linux-gnueabihf.zip
b396295fce6a7f9d2d0285ed4fadc2e27f4f7cf5d4abe45b2bdd27a5303e862b
./target/bin-0.19.2/eza.exe_x86_64-pc-windows-gnu.tar.gz
ba631e9317165836a30ed3cf154f0c48f8c105c314f72dd55f720e3fed503c22
./target/bin-0.19.2/eza.exe_x86_64-pc-windows-gnu.zip
2198529bf8fbabf069dc232f106c2c474e29b9d7571611f64e04299e0899b33b
./target/bin-0.19.2/eza_x86_64-unknown-linux-gnu.tar.gz
91b282fc6d456554fe1b4e7420ac9809d7381ba5a59dd1f5f56cbfcc17cd7b52
./target/bin-0.19.2/eza_x86_64-unknown-linux-gnu.zip
df3253d6215087b3b614ee1ffc5b951af53236ba887cbe7e548b14c50cd755d3
./target/bin-0.19.2/eza_x86_64-unknown-linux-musl.tar.gz
a90cce4ca7ae6ec296fa6da7eb4aecc94153a7cfb54267303d197dec335703ec
./target/bin-0.19.2/eza_x86_64-unknown-linux-musl.zip

#### md5sum

b536c0d6d7c6b4303d620a6b703a721a
./target/bin-0.19.2/eza_aarch64-unknown-linux-gnu.tar.gz
6aa9b1dcb9f96daed27dd74585aa16ee
./target/bin-0.19.2/eza_aarch64-unknown-linux-gnu.zip
b4508e45412f871f362416770d756369
./target/bin-0.19.2/eza_arm-unknown-linux-gnueabihf.tar.gz
0e72b99f6f6a7336f40c38c754a80f35
./target/bin-0.19.2/eza_arm-unknown-linux-gnueabihf.zip
e1f7c7eda0c95083d6c82f3ff92a8bad
./target/bin-0.19.2/eza.exe_x86_64-pc-windows-gnu.tar.gz
5aa2e0affd95bbc7d65f8e3ab086f8fc
./target/bin-0.19.2/eza.exe_x86_64-pc-windows-gnu.zip
bf6442dc45a5f39bb7ea9bf7a954eaae
./target/bin-0.19.2/eza_x86_64-unknown-linux-gnu.tar.gz
b6c792e7cba6d2ad346548b3e8eaa000
./target/bin-0.19.2/eza_x86_64-unknown-linux-gnu.zip
1cb4f3cd02e6153d10e4cfe872811b90
./target/bin-0.19.2/eza_x86_64-unknown-linux-musl.tar.gz
06197e2af01367f0269d964177d22d5f
./target/bin-0.19.2/eza_x86_64-unknown-linux-musl.zip

#### blake3sum

2058e84613627f90a26f75ab09b749703836706115a04b69ade321d58d7f255a
./target/bin-0.19.2/eza_aarch64-unknown-linux-gnu.tar.gz
ec63581afdf96fa8411d1a2e522d21f0fa555b06595e44a3b458554261938231
./target/bin-0.19.2/eza_aarch64-unknown-linux-gnu.zip
5bc1912ae22d33de234b205abb6e2f4fe4587d780d7062e07ee0e878cdc84e32
./target/bin-0.19.2/eza_arm-unknown-linux-gnueabihf.tar.gz
299aa57b10c98b53aace17501a231a86b7125ccd86a812e39c016457a618e1a1
./target/bin-0.19.2/eza_arm-unknown-linux-gnueabihf.zip
5f6dc18d0e7f0047801f993f8ee63ece0937ade00c425c57eb384b9e88748e05
./target/bin-0.19.2/eza.exe_x86_64-pc-windows-gnu.tar.gz
291d2b831502d169845775a47eab9bcebb724aee3a85120f6d0a153583383b66
./target/bin-0.19.2/eza.exe_x86_64-pc-windows-gnu.zip
4c85dcd40d45b9778e02b9276e25ecccc4cc2ab2362f021a52ed33ed3ad96a45
./target/bin-0.19.2/eza_x86_64-unknown-linux-gnu.tar.gz
b9b82a0046fec737112dac6414966662c15c5b4c0e4f1d3232f98cdc2a25fe45
./target/bin-0.19.2/eza_x86_64-unknown-linux-gnu.zip
3283503c9a70bdd7dc3c887e411fcb0a0065dc3a71a6cd63ad1b43b6a42372a5
./target/bin-0.19.2/eza_x86_64-unknown-linux-musl.tar.gz
a0da7357813842e64cdd67298ebfe62ae38627a0210ac0b49ba9754b9bfa063d
./target/bin-0.19.2/eza_x86_64-unknown-linux-musl.zip

</details>

<details>
<summary>fujiwara/awslim (fujiwara/awslim)</summary>

###
[`v0.3.5`](https://redirect.github.com/fujiwara/awslim/blob/HEAD/CHANGELOG.md#v035---2024-09-02)

[Compare
Source](https://redirect.github.com/fujiwara/awslim/compare/v0.3.4...v0.3.5)

- Bump the aws-sdk-go-v2 group with 2 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/fujiwara/awslim/pull/49](https://redirect.github.com/fujiwara/awslim/pull/49)

</details>

<details>
<summary>kevincobain2000/gobrew (kevincobain2000/gobrew)</summary>

###
[`v1.10.11`](https://redirect.github.com/kevincobain2000/gobrew/releases/tag/v1.10.11)

[Compare
Source](https://redirect.github.com/kevincobain2000/gobrew/compare/v1.10.10...v1.10.11)

#### Changelog

-
[`5e8a165`](https://redirect.github.com/kevincobain2000/gobrew/commit/5e8a165b25bf6d7c46cd888c329d09d934223729)
(docs) CHANGE LOG
-
[`edeeff9`](https://redirect.github.com/kevincobain2000/gobrew/commit/edeeff9fe1a9e012300c4c5e8a66102520b1296d)
(docs) fixes CHANGE LOG and only keep major changes to the CHANGE LOG
-
[`b13d6ae`](https://redirect.github.com/kevincobain2000/gobrew/commit/b13d6ae5c2ee0b52861418fce922b4a94beae661)
Fix: Handle unset GOBREW_ROOT variable safely
([#&#8203;208](https://redirect.github.com/kevincobain2000/gobrew/issues/208))
-
[`186c1c2`](https://redirect.github.com/kevincobain2000/gobrew/commit/186c1c2f7c68abb5efeba75dc80d57c82b23bfca)
Update README.md
([#&#8203;209](https://redirect.github.com/kevincobain2000/gobrew/issues/209))
-
[`7ffc9d7`](https://redirect.github.com/kevincobain2000/gobrew/commit/7ffc9d7b7c88fa8026e1626cd2ea89d179734c1d)
feat: new flag options for cache
([#&#8203;204](https://redirect.github.com/kevincobain2000/gobrew/issues/204))
-
[`bbb18aa`](https://redirect.github.com/kevincobain2000/gobrew/commit/bbb18aa179bbd1680a89de5659c0003694d63c8b)
fix: fail script process on errors
([#&#8203;206](https://redirect.github.com/kevincobain2000/gobrew/issues/206))

</details>

<details>
<summary>sxyazi/yazi (sxyazi/yazi)</summary>

###
[`v0.3.3`](https://redirect.github.com/sxyazi/yazi/releases/tag/v0.3.3)

[Compare
Source](https://redirect.github.com/sxyazi/yazi/compare/v0.3.2...v0.3.3)

This version fixes a regression from the previous release that caused
some keys to stop working. And it resolves a long-standing issue where
the file list couldn't refresh automatically in Windows WSL.

This version also introduces the following three new features:

#### Git integration

Show the status of Git file changes as a linemode in the file list.

Feel free to use it and report any issues! For now, you need to manually
install it (pretty easy to do) from
https://github.com/yazi-rs/plugins/tree/main/git.yazi. In the future, it
will be included as one of Yazi's built-in plugins.


https://github.com/user-attachments/assets/eea1c665-0755-4a79-82ef-9846c4cac0df

#### `size` linemode supports displaying the number of files in a
directory


[https://github.com/sxyazi/yazi/pull/1591](https://redirect.github.com/sxyazi/yazi/pull/1591)
updates the `size` linemode for directories to support displaying the
number of files within the directory instead of leaving it blank as
before.

If size information is available for the directory (triggered when
sorting by size), that information will be shown as a priority.


https://github.com/user-attachments/assets/d725e9fa-9605-4be3-bb05-6b21c7bbbca5

#### Windows Terminal support for image previews

[Windows Terminal Preview
v1.22.2362.0](https://redirect.github.com/microsoft/terminal/releases/tag/v1.22.2362.0)
now supports the Sixel image format. Yazi provided an adaptation for
this in
[https://github.com/sxyazi/yazi/pull/1588](https://redirect.github.com/sxyazi/yazi/pull/1588)
(Thanks [@&#8203;e82eric](https://redirect.github.com/e82eric)).

Note that Windows Terminal Preview v1.22.2362.0 [has a
bug](https://redirect.github.com/sxyazi/yazi/issues/1570#issuecomment-2319625368)
that can cause Yazi to time out at startup. If you want to try this
feature, make sure to apply the patch from
[https://github.com/microsoft/terminal/pull/17833](https://redirect.github.com/microsoft/terminal/pull/17833).


https://github.com/user-attachments/assets/8a1f1e5c-51dd-4281-8575-c5c5de3ef3ad

#### What's Changed

- fix: keybindings disappear when mixing presets with a wrong filter
condition by [@&#8203;sxyazi](https://redirect.github.com/sxyazi) in
[https://github.com/sxyazi/yazi/pull/1568](https://redirect.github.com/sxyazi/yazi/pull/1568)
- fix: check compositor support status before using ueberzug wayland
output by [@&#8203;taoky](https://redirect.github.com/taoky) in
[https://github.com/sxyazi/yazi/pull/1566](https://redirect.github.com/sxyazi/yazi/pull/1566)
- fix: fallback to `PollWatcher` on WSL by
[@&#8203;sxyazi](https://redirect.github.com/sxyazi) in
[https://github.com/sxyazi/yazi/pull/1574](https://redirect.github.com/sxyazi/yazi/pull/1574)
- fix: continuous fetcher was not scheduled consecutively by
[@&#8203;sxyazi](https://redirect.github.com/sxyazi) in
[https://github.com/sxyazi/yazi/pull/1575](https://redirect.github.com/sxyazi/yazi/pull/1575)
- fix: `Rail` component should have a higher rendering priority by
[@&#8203;sxyazi](https://redirect.github.com/sxyazi) in
[https://github.com/sxyazi/yazi/pull/1585](https://redirect.github.com/sxyazi/yazi/pull/1585)
- perf: truncate long lists in confirm dialogs by
[@&#8203;sxyazi](https://redirect.github.com/sxyazi) in
[https://github.com/sxyazi/yazi/pull/1590](https://redirect.github.com/sxyazi/yazi/pull/1590)
- feat: `size` linemode supports showing the file count for directories
by [@&#8203;sxyazi](https://redirect.github.com/sxyazi) in
[https://github.com/sxyazi/yazi/pull/1591](https://redirect.github.com/sxyazi/yazi/pull/1591)
- feat: support image preview in Windows Terminal by
[@&#8203;e82eric](https://redirect.github.com/e82eric) in
[https://github.com/sxyazi/yazi/pull/1588](https://redirect.github.com/sxyazi/yazi/pull/1588)
- chore: upgrade `ratatui` to 0.28.1 by
[@&#8203;sxyazi](https://redirect.github.com/sxyazi) in
[https://github.com/sxyazi/yazi/pull/1601](https://redirect.github.com/sxyazi/yazi/pull/1601)
- feat: add `is_absolute`, `has_root`, `starts_with`, `ends_with`,
`strip_prefix` to `Url` Userdata by
[@&#8203;sxyazi](https://redirect.github.com/sxyazi) in
[https://github.com/sxyazi/yazi/pull/1605](https://redirect.github.com/sxyazi/yazi/pull/1605)
- feat: add `dict_merge()` function by
[@&#8203;sxyazi](https://redirect.github.com/sxyazi) in
[https://github.com/sxyazi/yazi/pull/1609](https://redirect.github.com/sxyazi/yazi/pull/1609)

#### New Contributors

- [@&#8203;taoky](https://redirect.github.com/taoky) made their first
contribution in
[https://github.com/sxyazi/yazi/pull/1566](https://redirect.github.com/sxyazi/yazi/pull/1566)
- [@&#8203;e82eric](https://redirect.github.com/e82eric) made their
first contribution in
[https://github.com/sxyazi/yazi/pull/1588](https://redirect.github.com/sxyazi/yazi/pull/1588)

**Full Changelog**:
sxyazi/yazi@v0.3.2...v0.3.3

</details>

<details>
<summary>weaveworks/eksctl (weaveworks/eksctl)</summary>

###
[`v0.190.0`](https://redirect.github.com/eksctl-io/eksctl/releases/tag/v0.190.0):
eksctl 0.190.0

[Compare
Source](https://redirect.github.com/weaveworks/eksctl/compare/0.189.0...0.190.0-rc.0)

### Release v0.190.0

#### 🧰 Maintenance

- Bump github.com/docker/docker from 26.1.4+incompatible to
26.1.5+incompatible
([#&#8203;7936](https://redirect.github.com/weaveworks/eksctl/issues/7936))
- Bump jinja2 from 3.1.3 to 3.1.4 in /userdocs
([#&#8203;7748](https://redirect.github.com/weaveworks/eksctl/issues/7748))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 4pm on thursday" in timezone
America/Los_Angeles, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/scottames/dots).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41OS4yIiwidXBkYXRlZEluVmVyIjoiMzguNTkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: scottames-github-bot[bot] <162828115+scottames-github-bot[bot]@users.noreply.github.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants