Fix using primary selection with the extended protocol

This commit is contained in:
Kovid Goyal
2022-12-06 08:41:15 +05:30
parent 23b3b171fa
commit f35ee1bb40
2 changed files with 22 additions and 6 deletions

View File

@@ -308,8 +308,13 @@ func run_get_loop(opts *Options, args []string) (err error) {
}
}()
basic_metadata := map[string]string{"type": "read"}
if opts.UsePrimary {
basic_metadata["loc"] = "primary"
}
lp.OnInitialize = func() (string, error) {
lp.QueueWriteString(encode(map[string]string{"type": "read"}, "."))
lp.QueueWriteString(encode(basic_metadata, "."))
return "", nil
}
@@ -345,7 +350,7 @@ func run_get_loop(opts *Options, args []string) (err error) {
}
}
if len(requested_mimes) > 0 {
lp.QueueWriteString(encode(map[string]string{"type": "read"}, strings.Join(utils.Keys(requested_mimes), " ")))
lp.QueueWriteString(encode(basic_metadata, strings.Join(utils.Keys(requested_mimes), " ")))
} else {
lp.Quit(0)
}