Xclip realtime clipboard backup?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












As is known to all of us, clipboard is managed by the program itself in most Linux distribution, which means that the content in clipboard will disappear when the hosting program halts.



However, clipboard managers like xclip seems to be exceptions. Even we got return value from these programs, we still can paste contents from the clipboard. So, I wonder if it possible to make xclip a daemon service which realtime backups content in clipboard. In this way, we can still available to paste contents from clipboard even if the original program halts for every process.



If so, I believe it will save a lot efforts, especially you don't need to re-open your closed libreoffice to re-copy in order to paste some sentences.







share|improve this question
























    up vote
    1
    down vote

    favorite












    As is known to all of us, clipboard is managed by the program itself in most Linux distribution, which means that the content in clipboard will disappear when the hosting program halts.



    However, clipboard managers like xclip seems to be exceptions. Even we got return value from these programs, we still can paste contents from the clipboard. So, I wonder if it possible to make xclip a daemon service which realtime backups content in clipboard. In this way, we can still available to paste contents from clipboard even if the original program halts for every process.



    If so, I believe it will save a lot efforts, especially you don't need to re-open your closed libreoffice to re-copy in order to paste some sentences.







    share|improve this question






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      As is known to all of us, clipboard is managed by the program itself in most Linux distribution, which means that the content in clipboard will disappear when the hosting program halts.



      However, clipboard managers like xclip seems to be exceptions. Even we got return value from these programs, we still can paste contents from the clipboard. So, I wonder if it possible to make xclip a daemon service which realtime backups content in clipboard. In this way, we can still available to paste contents from clipboard even if the original program halts for every process.



      If so, I believe it will save a lot efforts, especially you don't need to re-open your closed libreoffice to re-copy in order to paste some sentences.







      share|improve this question












      As is known to all of us, clipboard is managed by the program itself in most Linux distribution, which means that the content in clipboard will disappear when the hosting program halts.



      However, clipboard managers like xclip seems to be exceptions. Even we got return value from these programs, we still can paste contents from the clipboard. So, I wonder if it possible to make xclip a daemon service which realtime backups content in clipboard. In this way, we can still available to paste contents from clipboard even if the original program halts for every process.



      If so, I believe it will save a lot efforts, especially you don't need to re-open your closed libreoffice to re-copy in order to paste some sentences.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 11 '17 at 23:31









      TJM

      18010




      18010




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote













          If you are planning to write your own clipboard manager, you might look at this python example which uses the gtk library to do most of the work. You might want to change SELECTION_CLIPBOARD to SELECTION_PRIMARY. The class is documented here.



          Selections can be rich text, or images, but if you only want to handle text it can be simpler.
          This much shorter example just prints the selection every time it changes, and might be enough for you to keep a history of text selections.



          parcellite claims to do what you want, keeping a history of selections, but I cannot test it as I don't use a suitable desktop environment.



          If you use gnome, you can try gpaste, which should be available as a package. It is a clipboard manager, but seems to use dbus rather than the X11 selection mechanism, so it may not work with pure X11 clients, but only gnome applications.



          autocutsel could also be a starting point if you program in C. It copies the PRIMARY selection to cutbuffer 0 whenever it changes, to provide compatibility with some other systems when using VNC.






          share|improve this answer





























            up vote
            0
            down vote













            Have a look at xclipboard. Unfortunately, it only stores CLIPBOARD selections, while most modern X applications only use PRIMARY selections ...



            But the source is available, you can change it as you like.






            share|improve this answer




















            • It's true that most modern X applications only use PRIMARY. However, when you close the application, content that you manually copied by Ctrl-c will also lose. I want a clipboard manager who can solve this problem. However xclip can't. I'm now reading Freedesktop documents. And I hope in one day I can write a xclipboard daemon. But anyway, thanks.
              – TJM
              Nov 13 '17 at 4:02










            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            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: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f403966%2fxclip-realtime-clipboard-backup%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote













            If you are planning to write your own clipboard manager, you might look at this python example which uses the gtk library to do most of the work. You might want to change SELECTION_CLIPBOARD to SELECTION_PRIMARY. The class is documented here.



            Selections can be rich text, or images, but if you only want to handle text it can be simpler.
            This much shorter example just prints the selection every time it changes, and might be enough for you to keep a history of text selections.



            parcellite claims to do what you want, keeping a history of selections, but I cannot test it as I don't use a suitable desktop environment.



            If you use gnome, you can try gpaste, which should be available as a package. It is a clipboard manager, but seems to use dbus rather than the X11 selection mechanism, so it may not work with pure X11 clients, but only gnome applications.



            autocutsel could also be a starting point if you program in C. It copies the PRIMARY selection to cutbuffer 0 whenever it changes, to provide compatibility with some other systems when using VNC.






            share|improve this answer


























              up vote
              2
              down vote













              If you are planning to write your own clipboard manager, you might look at this python example which uses the gtk library to do most of the work. You might want to change SELECTION_CLIPBOARD to SELECTION_PRIMARY. The class is documented here.



              Selections can be rich text, or images, but if you only want to handle text it can be simpler.
              This much shorter example just prints the selection every time it changes, and might be enough for you to keep a history of text selections.



              parcellite claims to do what you want, keeping a history of selections, but I cannot test it as I don't use a suitable desktop environment.



              If you use gnome, you can try gpaste, which should be available as a package. It is a clipboard manager, but seems to use dbus rather than the X11 selection mechanism, so it may not work with pure X11 clients, but only gnome applications.



              autocutsel could also be a starting point if you program in C. It copies the PRIMARY selection to cutbuffer 0 whenever it changes, to provide compatibility with some other systems when using VNC.






              share|improve this answer
























                up vote
                2
                down vote










                up vote
                2
                down vote









                If you are planning to write your own clipboard manager, you might look at this python example which uses the gtk library to do most of the work. You might want to change SELECTION_CLIPBOARD to SELECTION_PRIMARY. The class is documented here.



                Selections can be rich text, or images, but if you only want to handle text it can be simpler.
                This much shorter example just prints the selection every time it changes, and might be enough for you to keep a history of text selections.



                parcellite claims to do what you want, keeping a history of selections, but I cannot test it as I don't use a suitable desktop environment.



                If you use gnome, you can try gpaste, which should be available as a package. It is a clipboard manager, but seems to use dbus rather than the X11 selection mechanism, so it may not work with pure X11 clients, but only gnome applications.



                autocutsel could also be a starting point if you program in C. It copies the PRIMARY selection to cutbuffer 0 whenever it changes, to provide compatibility with some other systems when using VNC.






                share|improve this answer














                If you are planning to write your own clipboard manager, you might look at this python example which uses the gtk library to do most of the work. You might want to change SELECTION_CLIPBOARD to SELECTION_PRIMARY. The class is documented here.



                Selections can be rich text, or images, but if you only want to handle text it can be simpler.
                This much shorter example just prints the selection every time it changes, and might be enough for you to keep a history of text selections.



                parcellite claims to do what you want, keeping a history of selections, but I cannot test it as I don't use a suitable desktop environment.



                If you use gnome, you can try gpaste, which should be available as a package. It is a clipboard manager, but seems to use dbus rather than the X11 selection mechanism, so it may not work with pure X11 clients, but only gnome applications.



                autocutsel could also be a starting point if you program in C. It copies the PRIMARY selection to cutbuffer 0 whenever it changes, to provide compatibility with some other systems when using VNC.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 18 '17 at 0:53









                Jeff Schaller

                32k849109




                32k849109










                answered Nov 13 '17 at 9:43









                meuh

                29.6k11751




                29.6k11751






















                    up vote
                    0
                    down vote













                    Have a look at xclipboard. Unfortunately, it only stores CLIPBOARD selections, while most modern X applications only use PRIMARY selections ...



                    But the source is available, you can change it as you like.






                    share|improve this answer




















                    • It's true that most modern X applications only use PRIMARY. However, when you close the application, content that you manually copied by Ctrl-c will also lose. I want a clipboard manager who can solve this problem. However xclip can't. I'm now reading Freedesktop documents. And I hope in one day I can write a xclipboard daemon. But anyway, thanks.
                      – TJM
                      Nov 13 '17 at 4:02














                    up vote
                    0
                    down vote













                    Have a look at xclipboard. Unfortunately, it only stores CLIPBOARD selections, while most modern X applications only use PRIMARY selections ...



                    But the source is available, you can change it as you like.






                    share|improve this answer




















                    • It's true that most modern X applications only use PRIMARY. However, when you close the application, content that you manually copied by Ctrl-c will also lose. I want a clipboard manager who can solve this problem. However xclip can't. I'm now reading Freedesktop documents. And I hope in one day I can write a xclipboard daemon. But anyway, thanks.
                      – TJM
                      Nov 13 '17 at 4:02












                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    Have a look at xclipboard. Unfortunately, it only stores CLIPBOARD selections, while most modern X applications only use PRIMARY selections ...



                    But the source is available, you can change it as you like.






                    share|improve this answer












                    Have a look at xclipboard. Unfortunately, it only stores CLIPBOARD selections, while most modern X applications only use PRIMARY selections ...



                    But the source is available, you can change it as you like.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 12 '17 at 7:59









                    dirkt

                    14.2k2931




                    14.2k2931











                    • It's true that most modern X applications only use PRIMARY. However, when you close the application, content that you manually copied by Ctrl-c will also lose. I want a clipboard manager who can solve this problem. However xclip can't. I'm now reading Freedesktop documents. And I hope in one day I can write a xclipboard daemon. But anyway, thanks.
                      – TJM
                      Nov 13 '17 at 4:02
















                    • It's true that most modern X applications only use PRIMARY. However, when you close the application, content that you manually copied by Ctrl-c will also lose. I want a clipboard manager who can solve this problem. However xclip can't. I'm now reading Freedesktop documents. And I hope in one day I can write a xclipboard daemon. But anyway, thanks.
                      – TJM
                      Nov 13 '17 at 4:02















                    It's true that most modern X applications only use PRIMARY. However, when you close the application, content that you manually copied by Ctrl-c will also lose. I want a clipboard manager who can solve this problem. However xclip can't. I'm now reading Freedesktop documents. And I hope in one day I can write a xclipboard daemon. But anyway, thanks.
                    – TJM
                    Nov 13 '17 at 4:02




                    It's true that most modern X applications only use PRIMARY. However, when you close the application, content that you manually copied by Ctrl-c will also lose. I want a clipboard manager who can solve this problem. However xclip can't. I'm now reading Freedesktop documents. And I hope in one day I can write a xclipboard daemon. But anyway, thanks.
                    – TJM
                    Nov 13 '17 at 4:02

















                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f403966%2fxclip-realtime-clipboard-backup%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?