kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.79k stars 993 forks source link

Remote set-background-image prints never ending kitty-cmd{"ok":true} #3626

Closed electricjones closed 3 years ago

electricjones commented 3 years ago

Describe the bug background_image works like a dream, but when I try to remotely change the image using kitty @ set-background-image /path/to/file.png, the image changes, but the terminal scrolls and endless stream of

$ kitty @ set-background-image /path/to/file.png
"ok": true}^[\^[P@kitty-cmd{"ok": true}^[\^[P@kitty-cmd{"ok": true}

The same is true directly from the kitty terminal.

However, using kitty @ set-background-image none removed the background image and does not stream text.

To Reproduce Steps to reproduce the behavior:

  1. Set background_image in kitty config
  2. Open new kitty instance and see background image
  3. run kitty @ set-background-image /path/to/file.png
  4. See endless text stream until window eventually crashes from memory failure (many minutes later)

Expected behavior Image simply changes w/o text stream

Environment details OS: Chrome OS -- linux debian container

neofetch:

       _,met$$$$$gg.          mwilson@penguin 
    ,g$$$$$$$$$$$$$$$P.       --------------- 
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 10 (buster) on Chrome OS x86_64 
 ,$$P'              `$$$.     Host: crosvm 
',$$P       ,ggs.     `$$b:   Kernel: 5.4.99-12983-g8b7876ab9f5e 
`d$$'     ,$P"'   .    $$$    Uptime: 5 hours, 6 mins 
 $$P      d$'     ,    $$P    Packages: 1329 (dpkg), 5 (flatpak) 
 $$:      $$.   -    ,d$$'    Shell: zsh 5.7.1 
 $$;      Y$b._   _,d$P'      Resolution: 2256x1504 
 Y$$.    `.`"Y$$$$P"'         Theme: CrosAdapta [GTK2/3] 
 `$$b      "-.__              Icons: CrosAdapta [GTK2/3] 
  `Y$$                        Terminal: kitty 
   `Y$$.                      Terminal Font: kitty 0.20.2 (57b5e493a4) created by Kovid Goyal kitty 0.20.2 (57b5e493a4) created by Kovid Goyal 
     `$$b.                    CPU: 06/8e (8) @ 2.112GHz 
       `Y$$b.                 Memory: 11MiB / 6604MiB 
          `"Y$b._

kitty --debug-config

kitty 0.20.2 (57b5e493a4) created by Kovid Goyal
Linux penguin 5.4.99-12983-g8b7876ab9f5e #1 SMP PREEMPT Sun Feb 21 11:49:12 PST 2021 x86_64
Debian GNU/Linux 10 \n \l
Loaded config files: /home/mwilson/.config/kitty/kitty.conf
Running under: X11

Config options different from defaults:
allow_remote_control y
background           Color(red=12, green=17, blue=21)
background_image     < /path/to/file.png >
color0               Color(red=46, green=52, blue=60)
color1               Color(red=189, green=15, blue=47)
color10              Color(red=73, green=233, blue=152)
color11              Color(red=253, green=223, blue=110)
color12              Color(red=42, green=139, blue=193)
color13              Color(red=234, green=71, blue=39)
color14              Color(red=160, green=182, blue=211)
color2               Color(red=53, green=167, blue=112)
color3               Color(red=251, green=148, blue=53)
color4               Color(red=31, green=88, blue=114)
color5               Color(red=189, green=37, blue=35)
color6               Color(red=119, green=131, blue=151)
color7               Color(red=255, green=255, blue=255)
color8               Color(red=64, green=74, blue=85)
color9               Color(red=189, green=15, blue=47)
cursor               Color(red=108, green=108, blue=108)
foreground           Color(red=255, green=255, blue=255)
linux_display_server x11
selection_background Color(red=189, green=37, blue=35)
selection_foreground Color(red=12, green=17, blue=21)
tab_bar_edge         1
tab_bar_style        powerline
Added shortcuts:
    alt+ctrl+1 KeyAction(func='goto_tab', args=(1,))
    alt+ctrl+2 KeyAction(func='goto_tab', args=(2,))
    alt+ctrl+3 KeyAction(func='goto_tab', args=(3,))
    alt+ctrl+4 KeyAction(func='goto_tab', args=(4,))
Changed shortcuts:
    shift+ctrl+enter KeyAction(func='launch', args=['--cwd=current'])```

Additional context Reproduced with minimal config:

allow_remote_control y
linux_display_server x11
kovidgoyal commented 3 years ago

That is because whatever context you are running the command in, is not processing the response escape codes from kitty. Add --no-response the kitty @ command to silence the responses.

electricjones commented 3 years ago

Thank you for the quick reply. It appears that --no-response is not a valid option for set-background-image

❯ kitty @ set-background-image --no-response /home/mwilson/system/dotfiles/assets/backgrounds/testing2.png
Unknown option: --no-response

Also for grins:

❯ kitty --no-response @ set-background-image /home/mwilson/system/dotfiles/assets/backgrounds/testing2.png
Unknown option: --no-response

and

❯ kitty @ set-background-image /home/mwilson/system/dotfiles/assets/backgrounds/testing2.png --no-response
Must specify exactly 1 argument(s) for set-background-image
electricjones commented 3 years ago

And the context I'm using it from is directly in the kitty instance I'm wanting to change. Not over ssh or anything.

kovidgoyal commented 3 years ago

On Fri, May 14, 2021 at 09:05:11PM -0700, Michael Wilson wrote:

And the context I'm using it from is directly in the kitty instance I'm wanting to change. Not over ssh or anything.

You dont run things directly in kitty, you run things in a shell, which is itself running in kitty. And I cannot replicate your issue with either bash or zsh. And I have added --no-response to @ set-background-image in my latest commit

electricjones commented 3 years ago

You dont run things directly in kitty, you run things in a shell

Thank you for clarifying. My shell is zsh.

I will update my kitty version to grab that latest commit.

electricjones commented 3 years ago

Works like a charm with the latest commit. I appreciate it. Fantastic terminal emulator -- it has changed my daily workflow.