Skip to content

Conversation

Ethsan
Copy link

@Ethsan Ethsan commented Jun 1, 2023

Fix image display with tmux + kitty

ISSUE TYPE

  • Improvement/feature implementation

RUNTIME ENVIRONMENT

  • Operating system and version: Arch Linux 6.3.3
  • Terminal emulator and version: kitty 0.28.1
  • ranger version: ranger-master v1.9.3-678-g1a007158
  • Python version: 3.11.3 (main, Apr 5 2023, 15:52:25) [GCC 12.2.1 20230201]
  • Locale: fr_FR.UTF-8

CHECKLIST

  • The CONTRIBUTING document has been read [REQUIRED]
  • All changes follow the code style [REQUIRED]
  • All new and existing tests pass [REQUIRED]
  • Changes require config files to be updated
    • Config files have been updated

DESCRIPTION

Fix escape sequence for tmux passthrough
Add the possibility to render images wiith placehoder ( necessary with tmux )

MOTIVATION AND CONTEXT

Could not view image with tmux+kitty but work in icat #2846

TESTING

Tested with

  • kitty without tmux
  • kitty with tmux and allow-passthrough not set
  • kitty with tmux and allow-passthrough set

i ran make test

Copy link
Member

@toonn toonn left a comment

Choose a reason for hiding this comment

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

I still need to test this but if it fixes image previews in Tmux in Kitty that's awesome!

@BigBrotherJu
Copy link

@Ethsan Can I patch ranger on my own using this PR? Would things work as expected? Can't wait for this PR to go into the next release.

@Ethsan
Copy link
Author

Ethsan commented Jul 7, 2023

Feel free, remember to allow passthrough in tmux and it should work like a charm. I only tested it on my machine, if there is a problem don't hesitate to tell me.

@thenbe
Copy link

thenbe commented Aug 1, 2023

This issue was happening to me as well, even though I don't use tmux. While using kitty to preview images, ranger would freeze after opening any image file. This PR fixed it for me. Thank you.

For anyone wanting to patch this on nix, you need to add a couple of extra deps. As an overlay:

(self: super: {
  # Use ranger PR, fixes freeze after opening image in kitty: https://github.com/ranger/ranger/pull/2856
  ranger = super.ranger.overrideAttrs (old: {
    version = "1.9.3";
    src = super.fetchFromGitHub {
      owner = "Ethsan";
      repo = "ranger";
      rev = "71a06f28551611d192d3e644d95ad04023e10801";
      sha256 = "sha256-Yjdn1oE5VtJMGnmQ2VC764UXKm1PrkIPXXQ8MzQ8u1U=";
    };
    propagatedBuildInputs = old.propagatedBuildInputs ++ (with super.python3Packages; [ astroid pylint ]);
  });
})

@Ethsan
Copy link
Author

Ethsan commented Aug 1, 2023

@thenbe I think I see why it work but I am not sure. Do you use a terminal multiplexer ? What is your TERM variable ?

@thenbe
Copy link

thenbe commented Aug 1, 2023

Whatever is set by kitty by default, I haven't changed it.

$ echo $TERM
xterm-kitty

@Ethsan
Copy link
Author

Ethsan commented Aug 1, 2023

Lmao I don’t know why it work but good for you.

@thenbe
Copy link

thenbe commented Aug 1, 2023

@Ethsan I think I was affected by this bug: #1603 (comment). Originally, I was on latest stable release. I only got the fix for my freezing issue when I patched ranger to point to your PR, since the fix for my issue has only been merged to master but not released yet. Still, thank you for contributing.

@kohane27
Copy link

kohane27 commented Aug 5, 2023

Not sure if this is the appropriate thread but hopefully it's still useful to some.

I've been waiting for tmux+kitty+ranger+wayland support for a long time. Then I just realized ueberzugpp supports tmux on sway. It just works out of the box: https://github.com/ranger/ranger/wiki/Image-Previews#with-ueberzug

@toonn toonn added this to the v1.9.4 milestone Aug 17, 2023
Add support for image with tmux + kitty, by using unicode placeholder
characters of the kitty protocol and tmux passthrough sequence.
To work, allow-passthrough need to be activated in tmux and kitty >=
v0.28.0.
Copy link

@foobarops foobarops left a comment

Choose a reason for hiding this comment

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

  • it works
  • mergeable with current master

@Ethsan
Copy link
Author

Ethsan commented May 19, 2025

New PR: #3086

@Ethsan Ethsan closed this May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants