diff --git a/kittens/clipboard/main.py b/kittens/clipboard/main.py index 9b0c49a44..536c3e936 100644 --- a/kittens/clipboard/main.py +++ b/kittens/clipboard/main.py @@ -35,7 +35,9 @@ When copying to clipboard both the original and alias are made available on the clipboard. When copying from clipboard if the original is not found, the alias is used, as a fallback. Can be specified multiple times to create multiple aliases. For example: :code:`--alias text/plain=text/x-rst` makes :code:`text/plain` an alias -of :code:`text/rst`. Aliases are not used in filter mode. +of :code:`text/rst`. Aliases are not used in filter mode. An alias for +:code:`text/plain` is automatically created if :code:`text/plain` is not present in the input data, but some +other :code:`text/*` MIME is present. --wait-for-completion diff --git a/tools/cmd/clipboard/read.go b/tools/cmd/clipboard/read.go index 881f79ced..a79e99351 100644 --- a/tools/cmd/clipboard/read.go +++ b/tools/cmd/clipboard/read.go @@ -171,6 +171,14 @@ func (self *Output) assign_mime_type(available_mimes []string, aliases map[strin } } } + if strings.HasPrefix(self.mime_type, "text/") { + for _, mt := range available_mimes { + if mt == "text/plain" { + self.remote_mime_type = mt + return + } + } + } return fmt.Errorf("The MIME type %s for %s not available on the clipboard", self.mime_type, self.arg) }