Progress towards universal Copy/Paste shortcuts on Linux
mark.stosberg.com/universal-copy-paste/
93 Comments
Comments from other communities
I don't understand why they mention programmable keyboards there. Buying a programmable keyboard to be able to rebind your keys is silly when it can be made entirely through software. On X11 for example you can load a .Xkeymap file and set your keyboard mappings this way. I use this to have a modified dvorak keymap with Altgr+auoeidhtns giving [{(|=+)]}] on the home row for instance, very convenient. Then I use my window manager i3 to rebind mod+p to send Ctrl+V using xdotool (because mod+p seems more vim-like) and I've set my terminal urxvt to treat Ctrl+V as paste. if all software supported the Sun copy paste keys then I could send those keys instead of Ctrl+V.
Interesting:
[{(|=+\)]}]
[{(|=+)]}]
So there is {<text1>|<text2>}
to get {<text1>|<text2>}.
What to do to get text2 under the mainline text1 instead?
And is this part of Markdown or some other parsing? How come I missed it?
it is nice to be able to plug your keyboard into a new computer and have all your shortcuts and layout set up though. I do that so I have the same layout and shortcuts on my personal and work computers regardless of os
I was just complaining about something like this just the other day.
edit: hold on, they want me to have dedicated keyboard keys for copy and pasta? No. I am not accepting that as a solution.
no, there are dedicated keycodes for copy and paste, and you can bind them to whatever
I got bored after reading 95%, including the end, and it does not mention what the "new" keyboard shortcut is.
I also miss the point why you bring up external programmable keyboards and not mentioning alternative layouts like neo.
Did you (or I?) miss something here? In the 3rd paragraph it's "revealed":
In a story of "what's old is new again", the solution dates back to ancient keyboards with physical keys for Copy and Paste.
Neo seems like a cool layout, reminds me of "unexpected keyboard" for android, but I fail to see the relevance since it doesn't have the copy/paste buttons (like the keyboard in the picture in the article) as far as I can see
Buying a new keyboard with an unusual key (combination) is not the solution to a universal copy paste shortcut. I didn't get why you'd write about adding a new universal shortcut by buying a new external keyboard that you can customize when you can customize what you already have. Yes, customizing the external keyboard is different but it is far far away from becoming universal.
ctrl v is convention for paste, but plenty of things (ex terminals) use that for something else. this is a universal (wrt the app receiving it) keycode that means paste. it lets you bind a key, or a keyboard shortcut, to the paste key and paste in any app. without this it isn't possible.
it doesn't even have to be a new programmable keyboard. there exist software key remappers for linux.
you could remap a mouse button to paste, you could remap ctrl v to always paste regardless of the app, etc., all in software, all not possible before.
It doesn't open with a summary or overview but dives right in to exploration, but I think the point comes across:
The copy and paste key codes, which have no physical keys anymore, are - to a degree - supported in software. Their claim is that those key codes are the tool for universal copy and paste, and then it's the input interpretations job (key and combination mapping) to offer bindings to those key codes.
GTK added support the copy and paste keyboards in January 2025. QT also added support for copy and paste key codes the same month. I'm not sure of the first released version of the GTK toolkit that will contain the fix. For QT, it will be QT 6.10, scheduled for release in September 2025. Together, this will cover many apps built for Gnome and KDE as well as others that use the same toolkits.
… followed by some more "current state of support for those key codes".
Is it really an whats old and is new again? I do this with QMK.
This is really cool, and clever, and it's neat they posted how they did this; but I think I would have just used kanata and done it in the host.
I almost used kanata instead of programming my QMK keyboard, because kanata can be used with any keyboard, which means if I need to use a different keyboard for some reason I don't have to change how I type. Plus, oddly, I seem to have fewer accidental layer/modifier triggers with kanata.
What keys to you use to activate custom layers with Katana?
A nice thing about custom keyboards is that they designed with easy to reach keys that can be used for layer switching.
The mechanical design is absolutely a huge improvement. I have a Piantor Pro, and once you get used to thumb keys it's hard to use keyboards without it. However, sometimes, you have no option. I'm not carrying a keyboard around with me, and using my laptop I'm stuck with what it's built with.
Shit... it just occurred to me that Framework has an opportunity here: they may not be able to build in an ergonomic keyboard with Kailh keys, but they could split the space bar and make it into 2 or 6 keys.
Anyway, I use the home row under my left hand for layer switches. I wrote a blog entry about this, but TL;DR I found that I type too fast to have modifier keys mapped to any of the main keys. I tried layer switches under the thumbs but I have 9 layers (including the base) and my Piantor has only 42 keys, so only 6 thumb keys. I could make do with 8, because one is a toggle layer for QWERTY, for games (well, for Factorio; like hell I'm going to remap all those bindings!). I might be able to squeeze two layers together and get 7, but the second issue is that layer synergy means several layers having most keys under my right hand minimizes cognitive load.
For example, the number pad is under the right hand, as is sane. So having the F-keys in the same configuration helps, because 1 ~ F1, 2 ~ F2... I don't have to think about it. Same with motion keys: I want the up/down/left/right in a T under my right hand, because I'm not ambidextrous and it's more accurate and faster for me. So I want the mouse movements in the same configuration. That's 4 layers right-side dominant, and there are only 3 thumb keys on the left; and it's just awkward to hold a right thumb key whilst typing with the right hand.
So, yeah, I don't use the thumb keys for layer switching. They're modifier keys: lctl, enter, lalt; ralt, space, rctl. Since the ctrls and alts are already hold keys, they can't be used as layer switches, unless I do something like double tap, which I found inaccurate and awkward.
What all this means is that the switch to kanata and a, say, laptop keyboard isn't that bad. Yes, enter and modifier keys are is in the "wrong" places, but everything else is mostly unchanged. And because I'm have the 42, I have extra columns on either side which I duplicate the modifiers, and on the left it's the same on a standard keyboard.
Framework has an opportunity here: they may not be able to build in an ergonomic keyboard with Kailh keys, but they _could_ split the space bar and make it into 2 or 6 keys.
Framework has announced a “One Key Module” which will be available later this year and will allow building custom keyboard designs for the Framework 16, which already uses QMK.
Some details are still unknown, but it seems like something like a Corne layout will soon be possible.
I've programmed my keyboard (bit round the houses as I can't directly assign copy and paste keycodes) so Fn+X/C/V send XF86Cut/Copy/Paste.
It works in Firefox. Yay!
It doesn't work in anything else I've tried, but according to that article GTK and Qt are being updated and they usually handle copy/paste rather than the apps themselves.
Looking forward to ditching Ctrl+C, which should never have been a copy shortcut in the first place.
I found this handy snippet to enable these keys in GTK 2 and 3 (not sure of the equivalent for GTK 4 but I guess that's the one which has been updated anyway): https://forum.colemak.com/topic/1438-dreymars-big-bag-of-keyboard-tricks-linuxxkb-files-included/#p10012
Unfortunately I've found this whilst I'm not at the right computer so I haven't been able to test them.
Edit: I tested this and it doesn't appear to have helped.
There is an unintended benefit to putting an obstacle between people who don't know how to use the terminal and pasting code into it.
Expanding on this, we could make it so that root must use ed(1) to edit files?
"Ed is the standard text editor."
For the uninitiated
No, only vi
vi is so outdated, we use viii now. You're two versions behind!
you're evil. i love it.
Ha! Butterflies!
My patch to add Copy/Paste keycode support to the Cosmic Terminal was merged!
https://github.com/pop-os/cosmic-term/pull/481
As someone who likes Rust but dislikes the look of COSMIC, are there plans to allow theming?
There are already settings to change some of the colors used.
For the terminal in particular there is an option to hide the menu bar, making it look as Foot or Alacritty do.
Holy fucking shit. I just realized that's why Ctrl + C and Ctrl + V don't work in Micro. This has been eye opening.
xclip?
I have been trying to bind ctrl c to copy in micro and alacrity, I can't find a way.
Always a pleasure to meet another Micro user.
weird -- they work for me. ctrl+c sends SIGINT, and ctrl+v iirc isn't treated specially. i figured sending SIGINT with kill would then preform a copy, but it doesn't. fuck. now i have another puzzle...
Honestly, this is a nice feature of macOS (or at least iTerm 2; I don’t use the official terminal). I know CTRL-C is used to kill processes and we all have that muscle memory but I usually try to change that on my personal Linux installs because I’ve hit it by mistake before.
I used to use CTRL+INSERT for copy and SHIFT+INSERT for paste but there’s usually no insert key on laptops or even small keyboards. It’s probably time to just adapt.
⌘C and ⌘V work in the native MacOS terminal app as well.
It’s the #1 thing that drives me crazy about Linux.
It seems obvious. You’ve got a Windows/Apple/Super key and a Control key. So you’d think Control would be for control characters and Windows/Apple/Super would be for application things.
I can understand Windows fucking this up, cuz the terminal experience is such a low priority. But Linux?
There’s some projects like Kinto and Toshy which try to fix it, but neither work on NixOS quite yet.
I use Ctrl, Alt for applications, Super for the os/windowing. I hated MacOS which mixed these things. Luckily X.org let's you do whatever you like, sometimes it's just harder to configure. But I like it as it is.
"Super" is the one modifier key that you can rely on overwriting without interfering with normal app shortcuts, so I'd personally rather prefer if applications don't start trying to use the Super key for their own things.
I have set up Super key shortcuts for all kinds of desktop management operations, opening the launcher/terminal/browser, switching workspaces/windows, closing windows, move/resize, switch tiling mode, audio control, make my package manager install updates, switch between a set of resolutions, activate my password manager, etc.
That said, Copy/Paste is a general/global enough operation that I would not mind having Super+C/V send to the current active app the Copy/Paste keycode (I might do that actually, now that I know that there's a code apps are starting to support!). But I think it should be the desktop environment the one configuring "Super" shortcuts, not the app.
It makes sense for each application to have their own interpretation of what does each control character (or Control shortcut) do. It's not like all control characters have a very reliable meaning to begin with.. I mean, the backspace character (Control+H) was originally meant to move a character backwards without deleting it, but most screen terminals didn't do that. If what you mean is alternate characters from Unicode and so, then the "Alt" key would be more suitable for that. And in ISO keyboards, "AltGr" is a very common way to have combinations that insert alternate symbols.
I still use ctrl+ins and shift+ins every now and then. I've hit ctrl+shift+c a few times while in my browser (Vivaldi) which unfortunately is bound to "create note". Ctrl+ins is a great workaround than using an extra neuron when in a terminal to also hit shift when copying.
That's why we have mice copy/paste bindings on most systems too. Highlighting text auto copies, and scroll wheel click pastes. Not all do this, but many do and have for a while.
That’s a popular terminal feature, but I regularly get tripped up because my terminal has that behavior but my browser does not.
That’s what’s nice about a global solution.
in most systems this is global. it's provided by the desktop and programs just see a copy/paste event. are you on wayland by any chance?
Yes.
yeah that'd do it. on X11 this is a solved problem, but wayland delegates the responsibility to the wm, and i don't think anyone other than gnome has actually implemented it. another one of the paper cuts that makes it hard for me to make the switch.
I'm on Sway and I use the mouse copy and paste all day everyday.
Switch to a non-buggy browser.
Mice? What is this thing you talk of?
Mice is animal
Mouses is computer/human interface device.
Pretty sure it's mice for both, that's just the correct plural for mouse, and the computer mouse literally got it's name from the animal.
We started calling wireless mice hamsters because they got no tail.
And the second is going extinct.
I use a key remapper to give me the readline keys everywhere. Though I've used XKeysnail and xremap and they're both a bit flakey, so if anyone has better recommendations that work on X11 and Wayland, I'm all ears.
There’s KMonad. Though I tried it once and found it didn’t behave quite like I expected and gave up.
I think that's a slightly different animal. AFAIK it's doesn't switch config depending on the current focused window. E.g. for some programs I don't want remapping.
Nice !! I like the 'old new again' effect ^^
selection autocopy and wheel/shift ins pasting is superior to all alternatives imo
I love it when I have a mouse. It's terrible on modern touchpads though :(
fully agree. i usually sacrifice one of my less used keys and bind it as a left mouse click instead.
Centre click is a godsend though. I recently had to start using Windows again and I keep instinctively hitting it.
One of the first things I had to disable when I switched to linux lol
Middle click has so many other uses in windows that made it sooo jarring. Ctrl c and crtl v are good enough for me. (Or shift in terminals)
Middle-click often works when ctrl+c/ctrl+v won't. It's also a separate buffer giving you the ability to have two different things copy/paste-able
Control+C is used to kill a process in the terminal and that shouldn't be overwritten. If it is, you'd have to create a totally separate key binding to kill a process. Seems unnecessarily complex when Control+Shift+C works just fine.
Sun keyboards had dedicated copy and paste keys.
Also the illusive "Stop" key that you needed to break into the boot rom.
The article doesn't suggest using Control+C. It talks about dedicated copy and paste key codes, and you can program your keyboard to map those codes to whatever keys you like. They suggest Fn+C.
standards.xkcd
Holy shit can you guys read the article please? It's an existing standard and a dedicated keycode
I think at this point XKCD should be a TLD.
I would join lemmy.xkcd in a heartbeat.
We could use Ctrl+Insert and Shift+Insert like in the last three decades, but some of these keyboards apparently forgot about the Insert key.
I confirmed that these already supported a number of terminals plus QT and GTK. They could also be mapped to be more ergonomic with a programmable keyboard:
But Shift+insert currently pastes the primary selection, not the copy-paste clipboard. So it doesn't do the same as Ctrl+V.
It depends. In Firefox, Chrome and LibreOffice, Shift-Insert pastes the clipboard, not the selection. Viva Linux!
Well yeah but shift insert is annoying as hell since the keys are so far apart
what about shift+insert amd ctrl+insert thats literally already there
Because lots of people don't have an insert key?
Well, the article proposes to use dedicated copy and paste keys. If you don't have an insert key, you probably don't have those either.
Agreed. The post didn't suggest that.
For people already using programmable keyboards global copy/paste shortcuts are a nice perk.
I spend nearly all my day in a browser or a terminal and as I use a terminal and browser that already support this, the effect is 99% complete.
Kitty has a setting that makes Ctrl-C copy text, but only if you've selected something. If you haven't it does a regular break. Best of both worlds!
I feel like you may have misunderstood the article. It's talking about how support is increasing for dedicated Copy keys, and that programmable keyboards make it easy to use dedicated Copy keys. The article does not mention changing the behaviour of Ctrl-C.
What else does this say?
And I'm pretty sure this key combination predates copy and paste key combinations.
Come on, having a 3-key combo for such a common task is a PITA. There's a reason people have been complaining about this for decades.
The first time you accidentally type Control-C into a terminal and cancel an important process when you meant to copy some text it becomes a PITA.
Exactly. I do it pretty regularly and I've been using Linux for 20 years.
And yet people here are still saying "no biggie". It's pure status quo bias.
No, it's recognising that terminal has its own rules and the learned Ctrl+C for copy has no sense... Okay, C-Copy. Some sense. Now, Ctrl+V for... vaste? :)
All while having an Insert fucking button.
In the end, me personally does not care as long as Ctrl+C continues to be the process-killer
That's what I came here to say. What's the point in making an unnecessarily complex "hack" to circumvent what shift-control-c and v does? I've never had a problem with it. And there's something to be said for not making it super easy to paste text to a terminal, especially from places online...
Wow. I haven't seen a Sun keyboard like that in .. geez forever. Whose were fun times. I was younger then.
Stop+a crew.
Back when a PROM really meant something.
You could also drop into a serious bios-style motherboard manager to really control booting and hardware configs.
Ctrl+Ins gang rise up
I used to have a Linux keyboard (with Tux instead of the Windows logo on super) with dedicated copy and paste keys. As far as I recall I never used them.
On old keyboards with those dedicated Copy/Paste keys, they weren’t easy to reach.
Now with programmable keyboards and layers, they can be as convenient as Control C & V.
On the software side, there were many years where they weren’t well-supported, but that’s changing now.
Hey, this is one of the reasons I bought this keyboard!
For a couple extra bucks you can get them to make each individual key a separate key code by asking them to convert it to Single Usage Code Firmware, which is so nifty to me!
you can remap keys with any keyboards
While correct, for the keyboard I linked, when you press F13 through F24 it sends Shift+F1 through Shift+F12.
Which is not impossible to remap, but what if you need to press Shift+F1?
I have a typematrix keyboard.
sigh can't believe that no one mentioned that there is a default set of shortcuts that are used across all GNU programs, and it's been the default since way before Ctrl+C/Ctrl+V existed. You can easily copy/paste stuff in any terminal using the same keypresses you would on Emacs, I.e. Ctrl+space to start selection, Alt+W to copy and Ctrl+Y to paste. In fact you can navigate the entire line the same way, not just copy/pasting but moving back and forward, selecting and deleting stuff, e.g. Ctrl+A Ctrl+K cuts the entire line.
Unless you activate Vi mode (which most terminals support) and then you can use the same keypresses you would on Vi, including
ci"
and other cool stuff that's much more powerful that simple copy/paste.There is a default, it's just not the same as word uses.
You describing a kill ring which is internal to the shell and not synced to the system clipboard. Nor does it work in GUI apps.
The benefit of universal bindings is not have to learn one method for GUI apps, another for terminals and a third for shells implementing the kill-ring like bindings.
Edit: i mean, there's software to remap your keyboard.
I don't want copy paste buttons support, I want the caps lock delay to be fixed. Yes, I use the caps lock not shift, as my brain can't get used to using shift for caps. I'm so tired of typing like THis all the time. 😂 (I'm using a hack currently that helps, but it would be nice if it gets fixed on Linux in general).
Nothing wrong with you using caps lock instead of shift, but I haven't noticed any 'caps lock delay' personally.
Oh, many people gave me shit for using caps lock, and the delay is a very well known issue on Linux in general. There are even a couple of fixes for it by some folks. Like this one. And even the archwiki has a workaround for it. It's a major pain for me. lol
Interesting.
This isn't a thing already? This is why people don't take linux seriously.
I assure you a great many people take Linux seriously.
On Windows, Control-C in a terminal also cancels instead of copies. That’s why people don’t take Windows seriously.
Powershell uses ctrl c
Yes, it uses it to close the currently executing program like every other terminal out there.
Not on my machine
You must be a mac user then because it doesn't make any sense to have that criticism as a windows user lmao