All the apps you've mentioned are gtk+
apps so it's quite easy to answer Why... Because in all gtk+
apps (except one), Shift+Insert pastes from CLIPBOARD - i.e. it's equivalent to Ctrl+V. The shortcut is hardcoded in gtkentry.c
(line 2022) and gtktextview.c
(line 1506):
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Insert, GDK_SHIFT_MASK,
"paste-clipboard", 0);
It is also documented in the GTK+ 3 Reference Manual under GtkEntry
:
The “paste-clipboard” signal
void
user_function (GtkEntry *entry,
gpointer user_data)
The ::paste-clipboard signal is a keybinding signal which gets emitted
to paste the contents of the clipboard into the text view.
The default bindings for this signal are Ctrl-v and Shift-Insert.
As far as I know this was done for consistency with other DE's (see KDE
's Qt
key bindings in QTextEdit Class
) and Windows OS1.
The only exception is gnome-terminal
. After long debates, the devs have decided (for consistency with other terminals) that, in gnome-terminal
, Shift+Insert should paste from PRIMARY and Ctrl+Shift+V should paste from CLIPBOARD (although you have the options to customize some shortcuts).
As to How do you paste selection with a keyboard shortcut... there's no straightforward way.
The easiest way is to assign a shortcut to a script that runs xdotool click 2
(simulates clicking the middle-mouse button). While this works (and it should work with all or most DE's and toolkits), it only works if the mouse cursor is actually over the text entry box, otherwise it fails.
Another relatively easy way is via Gnome Accessibility, if it's available on your system. It also requires the presence of a numpad. Go to Universal Access
>> Pointing & Clicking
and enable Mouse Keys
. Make sure NumLock
is off. You can then use the numpad keys to move the cursor and click. To simulate a middle-mouse button click, press (and release) * (asterisk) then press 5 (here's a short guide). This solution seems to always work in a gtk+
environment. The downside is that it requires Gnome Accessibility
and a numpad. Also, you cannot customize the shortcut.
An interesting solution was proposed on gnome-bugzilla (bug 643391). (Update 2018: issue has now been moved here.) It requires patching some source files and setting configuration options in ~/.config/gtk-3.0/gtk.css
(or ~/.gtkrc-2.0
for gtk+
2 apps). I haven't tried it personally but the feedback is positive.
Ideally, you would patch the source files and define a "paste-selection"
signal then bind Shift+Insert to "paste-selection"
instead of "paste-clipboard"
. Andy's code (attached in the bug report linked above) could serve as a guide on how to do that. Even then, it would only affect gtk+
apps (I'm not a KDE/Qt
guy so I have no idea how to alter Qt
apps behavior).
1: (not to mention IBM's CUA)
If using xterm
or a derivative you can setup key bindings to start and end a text selection, and save it as the X11 primary selection or a cutbuffer. See man xterm
. For example, add to your ~/.Xdefaults
:
XTerm*VT100.Translations: #override\n\
<Key>KP_1: select-cursor-start() \
select-cursor-end(PRIMARY, CUT_BUFFER0)\n\
<Key>KP_2: start-cursor-extend() \
select-cursor-end(PRIMARY, CUT_BUFFER0)\n
You can only have one XTerm*VT100.Translations
entry. Update the X11 server with the new file contents with xrdb -merge ~/.Xdefaults
. Start a new xterm
.
Now when you have some input at the command prompt, typing 1 on the numeric keypad will start selecting text at the current text cursor position, much like button 1 down on the mouse does. Move the cursor with the arrow keys then hit 2 on the numeric keypad and the intervening text is highlighted and copied to the primary selection and cutbuffer0. Obviously other more suitable keys and actions can be chosen. You can similarly paste the selection with bindings like insert-selection(PRIMARY)
.
Best Answer
I don't think there's a single-step way to do it with Klipper alone. If you look at its shortcut settings, there are only a limited amount of commands available to bind to keys. Conceivably you could configure something in "Actions", but you'd still need one keystroke to "Manually Invoke Action on Current Clipboard", and another to actually paste. I think your only single-step solution is creating a independent command yourself.
For example, you could install
xvkbd
, then bind the following to a shortcut key:This reads from the clipboard (in plain text), pipes it back into the clipboard, then invokes Ctrl+v to paste it.
A couple of caveats: