You are not logged in.

#1 2009-12-25 19:00:03

ccc1
Member
Registered: 2009-04-16
Posts: 111

[SOLVED] remapping keyboard shortcut to paste primary X selection

i recently found out that the keyboard shortcut shift+ins can be used to paste the primary X selection. Where can i set a different shortcut to paste the selection? or do i have remap the desired combination to shift+ins?

ccc1

Last edited by ccc1 (2013-03-25 17:20:30)

Offline

#2 2009-12-25 19:47:33

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [SOLVED] remapping keyboard shortcut to paste primary X selection

You have to remap. If you take the other route you end up having an application "type" the contents which hardly ever does what you want.
.xbindkeysrc example:

"xdotool click 2"
     control+F1
"xsel -x; xsel -b | xsel -i; xdotool click 2; xsel -x"
     control+F2

The second one is for control+v replacement (in terminals for example)

Offline

#3 2009-12-26 09:20:17

ccc1
Member
Registered: 2009-04-16
Posts: 111

Re: [SOLVED] remapping keyboard shortcut to paste primary X selection

cheers smile

Edit: the xbindkeys solution works fine in the terminal, but not in firefox for example.

Last edited by ccc1 (2009-12-26 09:39:46)

Offline

#4 2009-12-26 19:15:43

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [SOLVED] remapping keyboard shortcut to paste primary X selection

Yeah it's not very solid, you could try xdotool key --clearmodifiers Shift+Insert, but I find that works less well, and also note that when the mouse is out of the text field, middle clicking doesn't paste either (same for pressing shift+insert when the mouse isn't over the terminal).

Offline

#5 2009-12-26 21:50:35

ccc1
Member
Registered: 2009-04-16
Posts: 111

Re: [SOLVED] remapping keyboard shortcut to paste primary X selection

Procyon wrote:

Yeah it's not very solid, you could try xdotool key --clearmodifiers Shift+Insert, but I find that works less well, and also note that when the mouse is out of the text field, middle clicking doesn't paste either (same for pressing shift+insert when the mouse isn't over the terminal).

i already tried the "xdotool key Shift+Insert" variant and it is, as you said, pretty unreliable. one has to press the keyboard shortcut 5 times to paste. the most elegant solution would be of course to hack the X source code, but i have no idea where the shortcut is defined and if i want to recompile X everytime the version is bumped wink

Offline

#6 2009-12-27 09:17:20

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [SOLVED] remapping keyboard shortcut to paste primary X selection

You could try the paste character-by-character approach. It won't work with unicode, but I just read some people really like it:

"sleep 0.1; xdotool type --delay 2 --clearmodifiers "$(xsel -o -p)""
    Control + F1
"sleep 0.1; xdotool type --delay 2 --clearmodifiers "$(xsel -o -b)""
    Control + F2

You need a --delay that isn't 0, --clearmodifiers and a sleep (because --clearmodifiers doesn't really work that well, you have to release the Control key in the 0.1 seconds)

And changing the binding actually needs a hack for GTK / QT / and all applications that use xlib raw, so it's quite impossible and shows how rooted in these shortcuts are.

Offline

#7 2012-10-19 16:01:46

drrossum
Member
From: Chicago
Registered: 2009-02-24
Posts: 83

Re: [SOLVED] remapping keyboard shortcut to paste primary X selection

This is an old thread, but does this perhaps work for you?  It seems to be solid for me.

Offline

#8 2013-03-25 17:19:15

ccc1
Member
Registered: 2009-04-16
Posts: 111

Re: [SOLVED] remapping keyboard shortcut to paste primary X selection

drrossum wrote:

This is an old thread, but does this perhaps work for you?  It seems to be solid for me.

Thanks, just read your answer! This works great smile
The new link to the solution: https://wiki.archlinux.org/index.php/Ke … tion-Paste

clcl

Offline

Board footer

Powered by FluxBB