You are not logged in.

#1 2017-01-05 07:29:49

Steve
Member
Registered: 2017-01-03
Posts: 642

Shortcut keybind to clear clipboard

is it possible?

Im only a newb but would like to find out if this is possible. My google fu is weak on this one.

Cheers
Steve

Offline

#2 2017-01-05 07:35:57

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Shortcut keybind to clear clipboard

If you do actually mean CLIPBOARD, then try:

touch blank
xclip -selection clipboard blank

This could be scripted and the script called from a keybind in ~/.config/openbox/rc.xml

EDIT: actually, just use this in the "Execute" box in the GUI menu editor:
Sorry, it's very early in the morning big_smile

This can be added to rc.xml, but the quotes and stuff need to be handled specially in that file, I hope somebody else can help with this:

bash -c 'touch blank && xclip -selection clipboard blank ; rm blank'

To clear the PRIMARY buffer as well, use:

xclip -i /dev/null

http://unix.stackexchange.com/questions … ddle-wheel

https://packages.debian.org/jessie/xclip

Last edited by Head_on_a_Stick (2017-01-05 07:49:40)


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#3 2017-01-05 08:02:33

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: Shortcut keybind to clear clipboard

Thanks Hoas,do you think this would work if i just add this to the rc.xml file under "keybindings for running application"?

Use keybind superkey plus lower case c

<keybind key="W-c">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>xclip</name>
        </startupnotify>
        <command>bash -c 'touch blank && xclip -selection clipboard blank ; rm blank'</command>
      </action>
    </keybind>

Offline

#4 2017-01-05 08:17:18

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Shortcut keybind to clear clipboard

Steve wrote:

do you think this would work

I think that the quotes and commas need to be treated specially and "escaped" in that file but I may be wrong.

I'm in OpenBSD & dwm at the moment so you are in a better position to check these things than me smile

Anyway, good luck, I have to go to $DAY_JOB


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#5 2017-01-05 08:22:59

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: Shortcut keybind to clear clipboard

Ok i give it a try.

Offline

#6 2017-01-05 21:54:49

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Shortcut keybind to clear clipboard

Right, I'm back in BunsenLabs now and I can't be bothered figuring out the escape codes but a simple script does work.

We have no time to load up text editors so create the script with the tee(1) command and a here document, just enter these lines in order in a terminal window:

tee ~/bin/wipe <<"!"
touch blank
xclip -selection clipboard blank
rm blank
!

Now make the "wipe" script executable:

chmod +x ~/bin/wipe

Then this can be added to ~/.config/openbox/rc.xml:

    <keybind key="W-c">
      <action name="Execute">
        <command>wipe</command>
      </action>
    </keybind>

This works in my BunsenLabs system smile


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#7 2017-01-06 06:14:35

ohnonot
...again
Registered: 2015-09-29
Posts: 3,911
Website

Re: Shortcut keybind to clear clipboard

if that works for you, Steve, i'm pretty sure that you want this as well (or else tell us WHY you feelthe need to wipe only your secondary clipboard):

Head_on_a_Stick wrote:

To clear the PRIMARY buffer as well, use:

xclip -i /dev/null

just add that line to the ~/bin/wipe script (which could, btw, have been created with a regular text editor, but HoaS is being inventive again!).

Offline

#8 2017-01-06 06:56:41

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,731
Website

Re: Shortcut keybind to clear clipboard

If you're using Clipit (default with BunsenLabs) simply clearing the clipboard may not be enough for you. Clipit keeps its own history.
Check the popup list after various xclip commands.

Last edited by johnraff (2017-01-06 07:04:25)


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#9 2017-01-06 08:02:26

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: Shortcut keybind to clear clipboard

^ Also, I think if Clipit is running then it syncs the PRIMARY and the CLIPBOARD, which is incredibly annoying.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#10 2017-01-06 08:26:36

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,731
Website

Re: Shortcut keybind to clear clipboard

^indeed it would be, but that's an option, not enabled by default IIRC.
Anyway "Use Primary" is definitely switched off here. neutral


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#11 2017-01-07 03:25:25

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: Shortcut keybind to clear clipboard

Thanks for the help on this but its a bit over my head technically. Ill just use clipit.

Offline

#12 2017-01-07 07:31:03

damo
....moderator....
Registered: 2015-08-20
Posts: 5,059

Re: Shortcut keybind to clear clipboard

What about Ctrl-C, with nothing selected - doesn't that effectively clear the clipboard?


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#13 2017-01-07 09:20:40

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: Shortcut keybind to clear clipboard

damo wrote:

What about Ctrl-C, with nothing selected - doesn't that effectively clear the clipboard?

Didnt work for me in geany or on a web browser search box.

Ctrl C + Ctrl V + Ctrl C. Still holds the data.

Offline

#14 2017-01-07 09:40:28

ohnonot
...again
Registered: 2015-09-29
Posts: 3,911
Website

Re: Shortcut keybind to clear clipboard

Head_on_a_Stick wrote:

^ Also, I think if Clipit is running then it syncs the PRIMARY and the CLIPBOARD, which is incredibly annoying.

configurable, and configured right, extremely helpful (i can move clipboard content at will between primary & secondary).

but...

Steve wrote:

Thanks for the help on this but its a bit over my head technically. Ill just use clipit.

...this will do the exact opposite of what you originally requested?
i.e., it will store more, not less.

granted, the differences between primary & secondary clipboard are a little confusing at first.
another of those legacy things that the designers of desktop environments deemed necessary to hide under an extra layer.
roll

maybe if you would tell us what are your actual concerns and reasons for asking the question in the first place?

Offline

#15 2017-01-07 10:29:36

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: Shortcut keybind to clear clipboard

@ohnonot

Maybe security (passwords) or maybe my understanding of the clipboard is wrong?

So if i use clipit that would be the opposite of clearing the clipboard but it has a function within it to clear the clipboard? What is the difference between primary and secondary clipboard?

Offline

#16 2017-01-07 11:02:10

damo
....moderator....
Registered: 2015-08-20
Posts: 5,059

Re: Shortcut keybind to clear clipboard

Steve wrote:

... What is the difference between primary and secondary clipboard?

https://wiki.archlinux.org/index.php/clipboard


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#17 2017-01-07 11:23:10

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: Shortcut keybind to clear clipboard

Thanks damo, 

Funny that something rudimentary such as this brings up some complicated programming, or atleast that is how i see it.

https://www.jwz.org/doc/x-cut-and-paste.html

Offline

Board footer

Powered by FluxBB