@@ -123,6 +123,7 @@ struct PresentationOptions {
123
123
// Rendering
124
124
Pixelation pixelation = Pixelation::kNotChosen ;
125
125
bool sixel_cursor_workaround = false ;
126
+ bool tmux_workaround = false ;
126
127
bool terminal_use_upper_block = false ;
127
128
bool use_256_color = false ; // For terminals that don't do 24 bit color
128
129
@@ -306,6 +307,7 @@ static void PresentImages(LoadedImageSources *loaded_sources,
306
307
case Pixelation::kKittyGraphics :
307
308
compression_pool.reset (new ThreadPool (sequencer->max_queue_len () + 1 ));
308
309
canvas.reset (new KittyGraphicsCanvas (sequencer, compression_pool.get (),
310
+ present.tmux_workaround ,
309
311
display_opts));
310
312
break ;
311
313
case Pixelation::kiTerm2Graphics:
@@ -728,7 +730,8 @@ int main(int argc, char *argv[]) {
728
730
present.pixelation = Pixelation::kQuarterBlock ; // Good default.
729
731
#ifdef WITH_TIMG_TERMINAL_QUERY
730
732
if (term.font_width_px > 0 && term.font_height_px > 0 ) {
731
- auto graphics_info = timg::QuerySupportedGraphicsProtocol ();
733
+ auto graphics_info = timg::QuerySupportedGraphicsProtocol ();
734
+ present.tmux_workaround = graphics_info.in_tmux ;
732
735
switch (graphics_info.preferred_graphics ) {
733
736
case timg::GraphicsProtocol::kIterm2 :
734
737
present.pixelation = Pixelation::kiTerm2Graphics;
@@ -750,6 +753,11 @@ int main(int argc, char *argv[]) {
750
753
}
751
754
#endif
752
755
}
756
+ else if (present.pixelation == Pixelation::kKittyGraphics ) {
757
+ // If the user manually chooses kitty, we still need to know if in tmux
758
+ auto graphics_info = timg::QuerySupportedGraphicsProtocol ();
759
+ present.tmux_workaround = graphics_info.in_tmux ;
760
+ }
753
761
#if defined(WITH_TIMG_SIXEL) && defined(WITH_TIMG_TERMINAL_QUERY)
754
762
// If the user manually choose sixel, we still can't avoid a terminal
755
763
// query, as we have to figure out if it has a broken cursor implementation.
@@ -760,6 +768,17 @@ int main(int argc, char *argv[]) {
760
768
}
761
769
#endif
762
770
771
+ // If we are in tmux and use the kitty protocol, we need to tell it to
772
+ // allow pass-through.
773
+ // Somewhat broken abstraction here, should move to some
774
+ // TerminalCanvas::Prepare().
775
+ if (present.pixelation == Pixelation::kKittyGraphics &&
776
+ present.tmux_workaround ) {
777
+ if (system (" tmux set -p allow-passthrough on" ) != 0 ) {
778
+ fprintf (stderr, " Could not set tmux passthrough for graphics\n " );
779
+ }
780
+ }
781
+
763
782
// If 'none' is chosen for background color, then using the
764
783
// PNG compression with alpha channels gives us compositing on client side
765
784
if (is_pixel_direct_p (present.pixelation ) &&
0 commit comments