How to change the default shortcuts for copy/paste in urxvt?

Timur Fayzrakhmanov picture Timur Fayzrakhmanov · Apr 9, 2017 · Viewed 7.1k times · Source

I'm trying to set up copy/paste actions using ctrl+shift+c/p like it is done in GNOME terminal but for urxvt. I didn't find any simple solution - it seems like it always requires scripts, hacks etc which gets me annoyed when it comes to such a basic things. That's why I'm wondering if it is possible to just change/add some entries in ~/.Xresource to move the default behavior from ctrl+alt+c/p to ctrl+shift+c/p - since the former already works as expected.

Also, there is a lot of notions regarding clipboard itself: X calls them "selections" rather than "clipboards"; there are PRIMARY and CLIPBOARD selections; etc. I don't really understand all these subtleties - so feel free to be verbose!

I use Xorg server with i3 WM if it makes sense and rxvt-unicode v9.22 - released: 2016-01-23

Answer

stites picture stites · Apr 28, 2017

Contrary to Thomas' answer, it looks like you can. In the same question he referenced Spencer and Enno both mention that you can bind the native eval extensions in your .Xresources file. This would look like the following:

URxvt.keysym.Shift-Control-V: eval:paste_clipboard
URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard

To disable the previous keybindings, you'll also need:

URxvt.keysym.Control-Meta-c: builtin-string:
URxvt.keysym.Control-Meta-v: builtin-string:

You can reload the file with:

xrdb -load .Xresources

You'll need to restart rxvt for the changes to take effect.