Support for XF86Copy and XF86Paste keycodes
Copy and pasting on Unix systems has been a long-standing pain point for me... especially when dealing with Emacs, other applications, and the terminal, I successfully do what I intended to do on a shockingly small percentage of my first tries.
I am finally getting somewhat serious about doing something about it, especially as I've been experimenting with a ZSA moonlander keyboard, which supports the open-source QMK keyboard firmware. Honestly I think probably a good solution is to simply start using the USB HID usage codes from the old Sun workstation keyboards, which have explicit undo, cut, copy, and paste keys.
I've adjusted the mapping of my keyboard so that the key that's located where Caps Lock normally is, shifts me into a layer where the Z, X, C, and V keys are mapped to the sun-style keys (thus, I don't have to relearn those keystrokes, with a little work they should work more consistently across applications, and I still have ^C and ^V available as distinct keystrokes.)
Many modern applications support XF86Copy and XF86Paste correctly out-of-box, at least on my Ubuntu 20.04 desktop. This includes Visual Studio Code, and Chrome. And, with just 4 lines of emacs configuration, these keystrokes can also be made to work in Emacs.
I was able to go into gnome-terminal's preferences and rebind Copy and Paste to "Copy" and "Paste", and it works as I expect. This is great for my desktop where I will almost always be using a fancy, customizable keyboard. However this doesn't work so well with my laptop... sometimes I might have a nicer keyboard attached to it, but I am likely going to have to fall back to Ctrl-Shift-C and Ctrl-Shift-V when I am using the laptop's built-in keyboard.
However, the GUI configurator makes it appear as though it's only possible to have one keybinding or the other in use in gnome-terminal at the present time... I'm assuming that this is true unless there's a way to configure this via the command line, which I did not investigate carefully.
So, what would be nice would be to:
- allow for multiple keybindings for keyboard shortcuts, and
- have XF86Copy and XF86Paste be configured by default.
Here's the output from xev:
KeyPress event, serial 37, synthetic NO, window 0x4800001,
root 0x6c3, subw 0x0, time 354873208, (295,512), root:(520,721),
state 0x10, keycode 141 (keysym 0x1008ff57, XF86Copy), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 37, synthetic NO, window 0x4800001,
root 0x6c3, subw 0x0, time 354873328, (295,512), root:(520,721),
state 0x10, keycode 141 (keysym 0x1008ff57, XF86Copy), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 37, synthetic NO, window 0x4800001,
root 0x6c3, subw 0x0, time 354873912, (295,512), root:(520,721),
state 0x10, keycode 143 (keysym 0x1008ff6d, XF86Paste), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 37, synthetic NO, window 0x4800001,
root 0x6c3, subw 0x0, time 354874016, (295,512), root:(520,721),
state 0x10, keycode 143 (keysym 0x1008ff6d, XF86Paste), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
Finally, I did find a few related issues in the Gimp project, if anybody is curious: gimp#3834 (closed) gimp#637 (closed) gimp#3891