Fix spurious error message when setting image to none

This commit is contained in:
Kovid Goyal
2022-09-01 21:36:22 +05:30
parent 905c4d641c
commit 6672904e64
3 changed files with 5 additions and 3 deletions

View File

@@ -63,7 +63,7 @@ default=false
Don't wait for a response from kitty. This means that even if setting the background image
failed, the command will exit with a success code.
''' + '\n\n' + MATCH_WINDOW_OPTION
args = RemoteCommand.Args(spec='PATH_TO_PNG_IMAGE', count=1, json_field='data', special_parse='!read_window_logo(args[0])',
args = RemoteCommand.Args(spec='PATH_TO_PNG_IMAGE', count=1, json_field='data', special_parse='!read_window_logo(io_data, args[0])',
completion=ImageCompletion)
reads_streaming_data = True

View File

@@ -59,7 +59,8 @@ default=false
Don't wait for a response from kitty. This means that even if setting the image
failed, the command will exit with a success code.
'''
args = RemoteCommand.Args(spec='PATH_TO_PNG_IMAGE', count=1, json_field='data', special_parse='!read_window_logo(args[0])', completion=ImageCompletion)
args = RemoteCommand.Args(spec='PATH_TO_PNG_IMAGE', count=1, json_field='data', special_parse='!read_window_logo(io_data, args[0])',
completion=ImageCompletion)
reads_streaming_data = True
def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType:

View File

@@ -27,8 +27,9 @@ func set_payload_data(io_data *rc_io_data, data string) {
set_payload_string_field(io_data, "Data", data)
}
func read_window_logo(path string) (func(io_data *rc_io_data) (bool, error), error) {
func read_window_logo(io_data *rc_io_data, path string) (func(io_data *rc_io_data) (bool, error), error) {
if strings.ToLower(path) == "none" {
io_data.rc.Stream = false
return func(io_data *rc_io_data) (bool, error) {
set_payload_data(io_data, "-")
return true, nil