• how to purge the x selection/clipboard?

    From Javier@21:1/5 to All on Mon Mar 25 07:04:57 2019
    Why this is not purging the x selection/clipboard?

    xsel -dp; xsel -db; xsel -ds; # This doesn't work
    xsel -cp; xsel -cb; xsel -cs; # This doesn't work either

    echo | xsel -ip # works, but there's a newline in the selection
    printf '' | xsel -ip # This has no effect the selection

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to javier@invalid.invalid on Mon Mar 25 13:43:54 2019
    In article <osedncYOkqF0XgXBnZ2dnUU78SnNnZ2d@brightview.co.uk>,
    Javier <javier@invalid.invalid> wrote:
    Why this is not purging the x selection/clipboard?

    xsel -dp; xsel -db; xsel -ds; # This doesn't work
    xsel -cp; xsel -cb; xsel -cs; # This doesn't work either

    echo | xsel -ip # works, but there's a newline in the selection
    printf '' | xsel -ip # This has no effect the selection

    I've been bitten by this one, too.

    But note:
    1) I think it has to do with the fact that -d is ambiguous between being
    the usual XToolkit option for DISPLAY and being a tool-specific option for delete.
    2) --delete works

    --
    The randomly chosen signature file that would have appeared here is more than 4 lines long. As such, it violates one or more Usenet RFCs. In order to remain in compliance with said RFCs, the actual sig can be found at the following URL:
    http://user.xmission.com/~gazelle/Sigs/ThePublicGood

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Javier@21:1/5 to All on Mon Mar 25 09:32:33 2019
    1) I think it has to do with the fact that -d is ambiguous between being
    the usual XToolkit option for DISPLAY and being a tool-specific option for delete.
    2) --delete works

    You are right that -d is a bad option name for an X program.

    In any case, I am testing --delete and it doesn't do anything at all.

    xsel --delete --primary
    xsel --delete --clipboard

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to javier@invalid.invalid on Mon Mar 25 15:01:32 2019
    In article <wsCdnYfuroAcewXBnZ2dnUU78K_NnZ2d@brightview.co.uk>,
    Javier <javier@invalid.invalid> wrote:
    1) I think it has to do with the fact that -d is ambiguous between being
    the usual XToolkit option for DISPLAY and being a tool-specific option for >> delete.
    2) --delete works

    You are right that -d is a bad option name for an X program.

    In any case, I am testing --delete and it doesn't do anything at all.

    xsel --delete --primary
    xsel --delete --clipboard

    It works for me:

    $ xsel -ip <<< "THis is a test"
    $ xsel -p
    THis is a test
    $ xsel -p --delete
    $ xsel -p
    $

    (That's how I tested it. I doubt the option order matters.)

    --
    "They say if you play a Microsoft CD backwards, you hear satanic messages.
    Thats nothing, cause if you play it forwards, it installs Windows."

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Javier@21:1/5 to All on Mon Mar 25 11:50:02 2019
    It works for me:

    $ xsel -ip <<< "THis is a test"
    $ xsel -p
    THis is a test
    $ xsel -p --delete
    $ xsel -p
    $

    'xsel --delete --primary' doesn't clear the primary selection in xterm,
    the highlighted text is still there. However, if I type 'echo | xsel -ip'
    the highlighted text goes away.

    My guess is that Xterm is making things more complex using CUT_BUFFER0
    in addition to the PRIMARY selection. Sometimes I even get text selected
    long time ago in some other xterm window when clearing the selection.

    From xterm(1):

    ~Meta <Btn1Down>:select-start()
    <BtnUp>:select-end(SELECT, CUT_BUFFER0) \n
    ~Ctrl ~Meta <Btn2Up>:insert-selection(SELECT, CUT_BUFFER0)

    I don't understand the difference between SELECT, CUT_BUFFER0 and
    PRIMARY.

    The workaround I'm using now is

    echo | xsel --input --primary # puts a newline in the primary selection
    # and clears the XTerm highlighted text

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kenny McCormack@21:1/5 to javier@invalid.invalid on Mon Apr 1 13:00:13 2019
    In article <wsCdnYfuroAcewXBnZ2dnUU78K_NnZ2d@brightview.co.uk>,
    Javier <javier@invalid.invalid> wrote:
    1) I think it has to do with the fact that -d is ambiguous between being
    the usual XToolkit option for DISPLAY and being a tool-specific option for >> delete.
    2) --delete works

    You are right that -d is a bad option name for an X program.

    In any case, I am testing --delete and it doesn't do anything at all.

    xsel --delete --primary
    xsel --delete --clipboard

    Update: I just had an instance where --delete didn't work for me (as well).

    It does seem to be a little murky. The clipboard implementation in X is
    kinda weird/primitive, although elegant in a certain way.

    As you say in a later followup, it seems to be dependent on which
    "xterm-like" terminal program you're running. I just had an instance
    running in LXterminal where:

    xsel --delete -b

    didn't do anything. The contents of the -b clipboard stayed intact.

    However, the following worked in this instance, and I *think* that it will always work:

    xsel -ib < /dev/null

    P.S. There is some functionality of xsel where it "backgrounds" itself.
    That is, you do a "ps" listing and it shows "xsel" processes running in the background. The "man page" explains this, but it never made any sense to
    me. In any case, you might try killing these processes; that may cause the clipboard contents to vanish. Worth a try...

    --

    "This ain't my first time at the rodeo"

    is a line from the movie, Mommie Dearest, said by Joan Crawford at a board meeting.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)