Progress towards universal Copy/Paste shortcuts on Linux

uncircle | 138 points

The universality of copy/paste is overrated. It's literally just adding shift in terminal emulators, no biggie.

A bigger UX problem (on Linux) imo is the multitude of clipboards, we have x11, vim... Those can be synchronized or not, they manifest different behaviors...

And btw while apple is often offered as some golden standard for key bindings, I think the situation there is much (MUCH) worse: apps often intercept and handle common combinations on their own, with unclear precedence, which leads to non-deterministic behavior and a complete mess if you want to override any standard combination.

koiueo | a day ago

I use ctrl-Ins/shift-Ins and it works in my terminals and in the browser. I've not checked if it works in other apps because ctrl-c/ctrl-v always work in other apps. I'd be happy if ctrl-Ins/shift-Ins just always worked; I don't need innovation here.

cryptonector | a day ago

I think Apple did the right thing by keeping GUI shortcuts separate from terminal control codes.

I never understood why the Linux GUI world ran blindly after Windows and emulated every pattern, good or bad. And yes, I know that Ctrl-C/Ctrl-P for Copy/Paste are much older and came out of IBM's CUA and SAA initiatives. What matters is that with the Mac we had a clear role model how to handle this aspect of GUI cleanly but me missed it.

While we’re at it, I’m still on the lookout for IBM’s original SAA and CUA documentation. If anyone has these lying around, I’d be interested

weinzierl | a day ago

While we're talking keyboards, what about emoji? Every messaging app has a different interface for them, some like Discord and Whatsapp allow you to use :smile: shortcuts, but the enumerated names are different across apps. I've occasionally gotten a dedicated OS emoji picker to show up on my Mac, but I don't know how.

On Ubuntu Cinnamon, I managed to create keyboard shortcuts for the 8 or so emoji I use the most by binding something called a "compose" key and modifying a .XCompose file, but it still took other config file gymnastics to make it persist between X sessions.

audiodude | a day ago

For those running Sway on a MacBook, here you go:

``` # Copy-Paste re-implementation for Mac Keyboard

set $mod Mod4 bindsym --to-code $mod+z exec wtype -P XF86Undo bindsym --to-code $mod+Shift+z exec wtype -P XF86Redo bindsym --to-code $mod+x exec wtype -P XF86Cut bindsym --to-code $mod+c exec wtype -P XF86Copy bindsym --to-code $mod+v exec wtype -P XF86Paste ```

Where mod is the cmd key. It works well in most apps. At least in those I care about (terminal, browser, vim). Took me a very long time to find this solution, as a macOS refugee.

Not necessarily a MacBook, by the way. I have an Apple Keyboard with my PC (just a great keyboard I enjoy), so it works there too.

wltr | 3 hours ago

I like how Apple introduced the CMD key, with copy/paste linked to it in the terminal, leaving CTRL to work as intended. Even outside the terminal basic emacs key binding work as intended, such as c-k c-u etc

meitham | a day ago

Ctrl-Ins for copy, Shift-Ins for paste, is something that works everywhere in a graphical desktop, including my (KDE Plasma 6 Konsolepart) terminal. AFAICT the clipboard is the same.

sombragris | 7 hours ago

I used stty to make interrupt ktrl-k, then configured the terminal app to make copy/paste ctrl-c/ctrl-v.

I use copy/paste more than I use interrupt.

I hated MacOS keyboard shortcuts at first, but cmd-c/cmd-v do work around this problem.

dajtxx | a day ago

It's ancillary to this post, but I don't understand this obsession with "programmable" keyboards, at least for plain remapping of keys. There's entirely no point in doing it; the keymap / layout (not application key bindings, before that) is what gives keys meaning to begin with. Why would you care about what keycode a keyboard sends for some key? The only thing that matters is NKRO, if you want to remap modifiers; on non-NKRO keyboards the modifier keys are different in that they don't clash with other keys.

If the keyboard has some macro function, okay, I can see that being useful, in rare circumstances (in most cases you could also just do that in software.)

Meanwhile, the only way to get a keyboard that has 2 physical keys in the space where the wide caps lock key is on a "normal" keyboard is to build it myself. That key is the one completely useless key in the "core" of a regular layout, and I'd really like to be able to put 2 custom functions there (rather than just 1).

eqvinox | 21 hours ago

One thing I like is to set CapsLock to "switch to English". No need to think what language I'm at, just click it idempotently.

Besides, CapsLock is the most useless key anyway.

deepsun | 6 hours ago

The best way to solve this is to use win+c for copy and win+v as paste, as it's Mac doing. However making this ubiquitous in the system is impossible, that's why when I moved to Mac in my work, I have trouble using Linux in my laptop

p0w3n3d | 10 hours ago

We gonna get support for keys that don't exist on any modern keyboards, don't worry though you can remap them or bind them to change mplicated macro layers in your expensive mechanical keyboards.

Do all that and you won't need those two lines of xinit.rc

cncjchsue7 | a day ago

Much easier would be to have all apps treat C-S-C as copy and C-S-V as paste like the terminal does. In Chrome this starts the inspector. I changed jobs and went from a Mac to Linux and muscle memory keeps tripping me.

fmajid | a day ago

ctrl/shift-insert?

saurik | a day ago

In Emacs if CUA mode is on, C-c behaves as copy if any text is selected (and if no other keys have been pressed within a short time). To send a C-c when text is selected you do a C-S-c instead. Similarly in Windows Terminal I remember C-c works as copy without any issue (it deselects the text with the first C-c IIRC, so if you do two C-c's with text selected you copy and then send an interrupt).

Do any linux terminals implement anything like this? Why resort to adding new keys to keyboards?

v9v | a day ago

I have a mouse with an interesting number of buttons. (Elecom EX-G Pro; I recommend it if you have large hands and like thumb trackballs.)

So I ran xev to see what buttons they mapped to, and chose:

"xvkbd -text "\[XF86Copy]"" m:0x0 + b:8 "xvkbd -text "\[XF86Paste]"" m:0x0 + b:9

which my fingers have learned work everywhere except Chrome. Thanks, Google.

dsr_ | a day ago

Been a linux user since 2016 when I found an Ubuntu 16 installation CD in a drawer wirh old books. The thing for me is having ctrl+v paste without formatting. (If I need to retain formatting, I will gladly do ctrl+shift+v)

Maybe it's just me but, I'd gladly scroll endlessly looking at pictures of old keyboards / HID devices. (I use a Fellows KU-9938 Split Keyboard and a Kensignton)

mockingloris | a day ago

Linux already has (or had) a universal copy paste: selection and middle click.

account42 | a day ago

> To trigger the copy or paste keyboard actions, software has to bind these key codes to actions. Software toolkits or apps themselves are responsible for this.

If only the universal subset of communication maintained by the OS were actual actions

eviks | a day ago

instead of some universal shortcuts, i would prefer to have another meta key, that we finally can do another-meta+ctrl+alt+ascii for more combinations :D

universal shortcuts are overrated and get in your way anyway :D

deknos | a day ago

With the author's Corne keymap, wouldn't holding down the backspace key to access the "raise" layer start deleting text?

voidUpdate | a day ago

I thought "finally, Linux is adopting CUA", then realized this was a stealthy ad selling me remappable keyboards.

sugarpimpdorsey | a day ago

Not enough people know that you can just select text then middle click somewhere to paste it. No keys required and yes it works with all terminal emulators I've tried. This has been default behaviour on Linux desktops for as long as I've used it (decades).

globular-toast | a day ago

I just remap my terminal to have Ctrl-X to send SIGHUP, and Ctrl-C to copy. X looks more like a kill to me anyways.

enricozb | a day ago

So what ARE the key codes for dedicated copy and paste keys?

atmanactive | a day ago

We already had a universal copy/paste in Linux: Mark with left mouse button, paste with middle button. This used to work for just about everything. However, lately browsers started to ignore this when I mark the URL and try to paste it elsewhere, for example. Instead I get the old clipboard. I have to use the left button multiple times - and it works. Falling back to Windows-style copy/paste, either with keys or pull-down menus with "copy" and later "paste" is, to me, a huge, inefficient step backwards and it's frustrating me every day.

Addon: For purely non-mouse work, think serial terminal, I for one want Emacs bindings. Though that's typically configurable for the shell anyway, so everyone can choose what they prefer.

Tor3 | a day ago

Double-click then middle-click

How much more universal could it get?

The mark/splat functionality is one of the things that drew me to early linux...

johnea | 15 hours ago

What about cut?

kid64 | a day ago

Wouldn't it be darn nice, though, if there was a universal mechanism for apps to announce which shortcut they have available and a centralized way to configure them all?

For example, I was able to assign copy/paste keys to the corresponding actions in the GTK keybindings, and it worked like charm, except in Chrome. That is, in Chrome, web content respected these keybindings, but the browser UI didn't. So I could use the keys on textareas and inputs all I wanted, but paste into the address bar? Nooooo, BECAUSE FUCKING CHROME HAS THEM HARDCODED per platform!

(However, in Firefox it worked just fine across the whole UI.)

WesolyKubeczek | a day ago

[dead]

TacticalCoder | a day ago

“The Year of the Linux Desktop” will be when copy/pasted is solved.

antonvs | a day ago