How to copy text to the clipboard when using Wayland?











up vote
10
down vote

favorite
4












Is there a Wayland cli utility that copies text to clipboard?



I want to be able to do something like this:



echo "some" > clipboard


Something equivalent to xclip.










share|improve this question




















  • 1




    I'd be really interested to see the answer to this question too. From my usage of gnome-wayland, it seems to have many restrictions on clipboard access. For example, if you copy something in program A and you close it, the clipboard will automatically get flushed. There is no restriction on copy to clipboard for xclip but it seems pasting will only work if you've copied something while in terminal but not anywhere else. on the other hand, ctrl-v/shift-ctrl-v has no restriction as long as original app is opened...
    – thebunnyrules
    Feb 22 at 6:22










  • Discussion regarding wayland + clipboard - wiki.gnome.org/Initiatives/Wayland/PrimarySelection. According to this ticket it sounds like it's been implemented - github.com/swaywm/sway/issues/1012.
    – slm
    Jun 12 at 2:38












  • thanks for the links however that did not help me. maybe i missed something
    – mh-cbon
    Jun 12 at 17:14















up vote
10
down vote

favorite
4












Is there a Wayland cli utility that copies text to clipboard?



I want to be able to do something like this:



echo "some" > clipboard


Something equivalent to xclip.










share|improve this question




















  • 1




    I'd be really interested to see the answer to this question too. From my usage of gnome-wayland, it seems to have many restrictions on clipboard access. For example, if you copy something in program A and you close it, the clipboard will automatically get flushed. There is no restriction on copy to clipboard for xclip but it seems pasting will only work if you've copied something while in terminal but not anywhere else. on the other hand, ctrl-v/shift-ctrl-v has no restriction as long as original app is opened...
    – thebunnyrules
    Feb 22 at 6:22










  • Discussion regarding wayland + clipboard - wiki.gnome.org/Initiatives/Wayland/PrimarySelection. According to this ticket it sounds like it's been implemented - github.com/swaywm/sway/issues/1012.
    – slm
    Jun 12 at 2:38












  • thanks for the links however that did not help me. maybe i missed something
    – mh-cbon
    Jun 12 at 17:14













up vote
10
down vote

favorite
4









up vote
10
down vote

favorite
4






4





Is there a Wayland cli utility that copies text to clipboard?



I want to be able to do something like this:



echo "some" > clipboard


Something equivalent to xclip.










share|improve this question















Is there a Wayland cli utility that copies text to clipboard?



I want to be able to do something like this:



echo "some" > clipboard


Something equivalent to xclip.







clipboard wayland






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 13 at 20:35









MMM

11311




11311










asked Mar 16 '17 at 21:43









mh-cbon

868




868








  • 1




    I'd be really interested to see the answer to this question too. From my usage of gnome-wayland, it seems to have many restrictions on clipboard access. For example, if you copy something in program A and you close it, the clipboard will automatically get flushed. There is no restriction on copy to clipboard for xclip but it seems pasting will only work if you've copied something while in terminal but not anywhere else. on the other hand, ctrl-v/shift-ctrl-v has no restriction as long as original app is opened...
    – thebunnyrules
    Feb 22 at 6:22










  • Discussion regarding wayland + clipboard - wiki.gnome.org/Initiatives/Wayland/PrimarySelection. According to this ticket it sounds like it's been implemented - github.com/swaywm/sway/issues/1012.
    – slm
    Jun 12 at 2:38












  • thanks for the links however that did not help me. maybe i missed something
    – mh-cbon
    Jun 12 at 17:14














  • 1




    I'd be really interested to see the answer to this question too. From my usage of gnome-wayland, it seems to have many restrictions on clipboard access. For example, if you copy something in program A and you close it, the clipboard will automatically get flushed. There is no restriction on copy to clipboard for xclip but it seems pasting will only work if you've copied something while in terminal but not anywhere else. on the other hand, ctrl-v/shift-ctrl-v has no restriction as long as original app is opened...
    – thebunnyrules
    Feb 22 at 6:22










  • Discussion regarding wayland + clipboard - wiki.gnome.org/Initiatives/Wayland/PrimarySelection. According to this ticket it sounds like it's been implemented - github.com/swaywm/sway/issues/1012.
    – slm
    Jun 12 at 2:38












  • thanks for the links however that did not help me. maybe i missed something
    – mh-cbon
    Jun 12 at 17:14








1




1




I'd be really interested to see the answer to this question too. From my usage of gnome-wayland, it seems to have many restrictions on clipboard access. For example, if you copy something in program A and you close it, the clipboard will automatically get flushed. There is no restriction on copy to clipboard for xclip but it seems pasting will only work if you've copied something while in terminal but not anywhere else. on the other hand, ctrl-v/shift-ctrl-v has no restriction as long as original app is opened...
– thebunnyrules
Feb 22 at 6:22




I'd be really interested to see the answer to this question too. From my usage of gnome-wayland, it seems to have many restrictions on clipboard access. For example, if you copy something in program A and you close it, the clipboard will automatically get flushed. There is no restriction on copy to clipboard for xclip but it seems pasting will only work if you've copied something while in terminal but not anywhere else. on the other hand, ctrl-v/shift-ctrl-v has no restriction as long as original app is opened...
– thebunnyrules
Feb 22 at 6:22












Discussion regarding wayland + clipboard - wiki.gnome.org/Initiatives/Wayland/PrimarySelection. According to this ticket it sounds like it's been implemented - github.com/swaywm/sway/issues/1012.
– slm
Jun 12 at 2:38






Discussion regarding wayland + clipboard - wiki.gnome.org/Initiatives/Wayland/PrimarySelection. According to this ticket it sounds like it's been implemented - github.com/swaywm/sway/issues/1012.
– slm
Jun 12 at 2:38














thanks for the links however that did not help me. maybe i missed something
– mh-cbon
Jun 12 at 17:14




thanks for the links however that did not help me. maybe i missed something
– mh-cbon
Jun 12 at 17:14










2 Answers
2






active

oldest

votes

















up vote
3
down vote



accepted










bugaevc's wl-clipboard are copy/paste utilities for Wayland:




This project implements two little Wayland clipboard utilities,
wl-copy and wl-paste, that let you easily copy data between the
clipboard and Unix pipes, sockets, files and so on.



Usage is as simple as:



# copy a simple text message
$ wl-copy Hello world!

# copy the list of files in Downloads
$ ls ~/Downloads | wl-copy

# copy an image file
$ wl-copy < ~/Pictures/photo.png

# paste to a file
$ wl-paste > clipboard.txt

# grep each pasted word in file source.c
$ for word in $(wl-paste); do grep $word source.c; done

# copy the previous command
$ wl-copy "!!"

# replace the current selection with the list of types it's offered in
$ wl-paste --list-types | wl-copy


Although wl-copy and wl-paste are particularly optimized for plain
text and other textual content formats, they fully support content of
arbitrary MIME types. wl-copy automatically infers the type of the
copied content by running xdg-mime(1) on it. wl-paste tries its best
to pick a type to paste based on the list of offered MIME types and
the extension of the file it's pasting into. If you're not satisfied
with the type they pick or don't want to rely on this implicit type
inference, you can explicitly specify the type to use with the --type
option.







share|improve this answer






























    up vote
    2
    down vote













    wclip is a clipboard tool for Wayland that is very similar to xclip.



    Usage is as follows:



    $ wclip i < my_text_file



    $ wclip o
    contents of my text file
    $



    Disclaimer: I am the author.






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1189467%2fhow-to-copy-text-to-the-clipboard-when-using-wayland%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      3
      down vote



      accepted










      bugaevc's wl-clipboard are copy/paste utilities for Wayland:




      This project implements two little Wayland clipboard utilities,
      wl-copy and wl-paste, that let you easily copy data between the
      clipboard and Unix pipes, sockets, files and so on.



      Usage is as simple as:



      # copy a simple text message
      $ wl-copy Hello world!

      # copy the list of files in Downloads
      $ ls ~/Downloads | wl-copy

      # copy an image file
      $ wl-copy < ~/Pictures/photo.png

      # paste to a file
      $ wl-paste > clipboard.txt

      # grep each pasted word in file source.c
      $ for word in $(wl-paste); do grep $word source.c; done

      # copy the previous command
      $ wl-copy "!!"

      # replace the current selection with the list of types it's offered in
      $ wl-paste --list-types | wl-copy


      Although wl-copy and wl-paste are particularly optimized for plain
      text and other textual content formats, they fully support content of
      arbitrary MIME types. wl-copy automatically infers the type of the
      copied content by running xdg-mime(1) on it. wl-paste tries its best
      to pick a type to paste based on the list of offered MIME types and
      the extension of the file it's pasting into. If you're not satisfied
      with the type they pick or don't want to rely on this implicit type
      inference, you can explicitly specify the type to use with the --type
      option.







      share|improve this answer



























        up vote
        3
        down vote



        accepted










        bugaevc's wl-clipboard are copy/paste utilities for Wayland:




        This project implements two little Wayland clipboard utilities,
        wl-copy and wl-paste, that let you easily copy data between the
        clipboard and Unix pipes, sockets, files and so on.



        Usage is as simple as:



        # copy a simple text message
        $ wl-copy Hello world!

        # copy the list of files in Downloads
        $ ls ~/Downloads | wl-copy

        # copy an image file
        $ wl-copy < ~/Pictures/photo.png

        # paste to a file
        $ wl-paste > clipboard.txt

        # grep each pasted word in file source.c
        $ for word in $(wl-paste); do grep $word source.c; done

        # copy the previous command
        $ wl-copy "!!"

        # replace the current selection with the list of types it's offered in
        $ wl-paste --list-types | wl-copy


        Although wl-copy and wl-paste are particularly optimized for plain
        text and other textual content formats, they fully support content of
        arbitrary MIME types. wl-copy automatically infers the type of the
        copied content by running xdg-mime(1) on it. wl-paste tries its best
        to pick a type to paste based on the list of offered MIME types and
        the extension of the file it's pasting into. If you're not satisfied
        with the type they pick or don't want to rely on this implicit type
        inference, you can explicitly specify the type to use with the --type
        option.







        share|improve this answer

























          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          bugaevc's wl-clipboard are copy/paste utilities for Wayland:




          This project implements two little Wayland clipboard utilities,
          wl-copy and wl-paste, that let you easily copy data between the
          clipboard and Unix pipes, sockets, files and so on.



          Usage is as simple as:



          # copy a simple text message
          $ wl-copy Hello world!

          # copy the list of files in Downloads
          $ ls ~/Downloads | wl-copy

          # copy an image file
          $ wl-copy < ~/Pictures/photo.png

          # paste to a file
          $ wl-paste > clipboard.txt

          # grep each pasted word in file source.c
          $ for word in $(wl-paste); do grep $word source.c; done

          # copy the previous command
          $ wl-copy "!!"

          # replace the current selection with the list of types it's offered in
          $ wl-paste --list-types | wl-copy


          Although wl-copy and wl-paste are particularly optimized for plain
          text and other textual content formats, they fully support content of
          arbitrary MIME types. wl-copy automatically infers the type of the
          copied content by running xdg-mime(1) on it. wl-paste tries its best
          to pick a type to paste based on the list of offered MIME types and
          the extension of the file it's pasting into. If you're not satisfied
          with the type they pick or don't want to rely on this implicit type
          inference, you can explicitly specify the type to use with the --type
          option.







          share|improve this answer














          bugaevc's wl-clipboard are copy/paste utilities for Wayland:




          This project implements two little Wayland clipboard utilities,
          wl-copy and wl-paste, that let you easily copy data between the
          clipboard and Unix pipes, sockets, files and so on.



          Usage is as simple as:



          # copy a simple text message
          $ wl-copy Hello world!

          # copy the list of files in Downloads
          $ ls ~/Downloads | wl-copy

          # copy an image file
          $ wl-copy < ~/Pictures/photo.png

          # paste to a file
          $ wl-paste > clipboard.txt

          # grep each pasted word in file source.c
          $ for word in $(wl-paste); do grep $word source.c; done

          # copy the previous command
          $ wl-copy "!!"

          # replace the current selection with the list of types it's offered in
          $ wl-paste --list-types | wl-copy


          Although wl-copy and wl-paste are particularly optimized for plain
          text and other textual content formats, they fully support content of
          arbitrary MIME types. wl-copy automatically infers the type of the
          copied content by running xdg-mime(1) on it. wl-paste tries its best
          to pick a type to paste based on the list of offered MIME types and
          the extension of the file it's pasting into. If you're not satisfied
          with the type they pick or don't want to rely on this implicit type
          inference, you can explicitly specify the type to use with the --type
          option.








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 22 at 21:57

























          answered Nov 22 at 11:56









          adabru

          463




          463
























              up vote
              2
              down vote













              wclip is a clipboard tool for Wayland that is very similar to xclip.



              Usage is as follows:



              $ wclip i < my_text_file



              $ wclip o
              contents of my text file
              $



              Disclaimer: I am the author.






              share|improve this answer

























                up vote
                2
                down vote













                wclip is a clipboard tool for Wayland that is very similar to xclip.



                Usage is as follows:



                $ wclip i < my_text_file



                $ wclip o
                contents of my text file
                $



                Disclaimer: I am the author.






                share|improve this answer























                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  wclip is a clipboard tool for Wayland that is very similar to xclip.



                  Usage is as follows:



                  $ wclip i < my_text_file



                  $ wclip o
                  contents of my text file
                  $



                  Disclaimer: I am the author.






                  share|improve this answer












                  wclip is a clipboard tool for Wayland that is very similar to xclip.



                  Usage is as follows:



                  $ wclip i < my_text_file



                  $ wclip o
                  contents of my text file
                  $



                  Disclaimer: I am the author.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 23 at 19:45









                  J. Wang

                  212




                  212






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1189467%2fhow-to-copy-text-to-the-clipboard-when-using-wayland%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Сан-Квентин

                      8-я гвардейская общевойсковая армия

                      Алькесар