You are not logged in.
Pages: 1
Topic closed
I don't care if it's a bad idea, I just want to try it, since the the only way I've known how to copy text in my entire life was Ctrl+C, not Ctrl+Shift+C, which for me is just a random unix decision that I shouldn't have to bare. I don't know how to directly swap it since it's builtin deep inside somewhere I don't know. When I started using GNU/Linux for the first time, this was arguably the thing that shocked me the most. I've continued using it for a few years, and as I use terminals more and more, it's even more noticeable, to be honest.
TLDR: I just want to swap Ctrl+Shift+C with Ctrl+C.
Last edited by whittlers (2024-02-20 08:07:22)
sorry for bad english
Offline
What terminal emulator are you referring to? Certainly not an actual tty as "copy" doesn't mean anything outside of a GUI with a selection / clipboard.
If you wanted to bind any other key to a copy action that should be pretty easy in most terminal emulators, but preventing the built in action of Ctrl-C will be difficult and will require modification and rebuilding of the terminal's source code.
Frankly, it'd probably be easier to bind Ctrl-C at the WM / Compositor level and have it send Ctrl-Shift-C to the client instead. Though this would screw with Ctrl-C in other programs. Potentially you could have Ctrl-C globally bound to run a script that checks whether a terminal emulator is focused, and if so emits a Ctrl-Shift-C event, or otherwise passes the Ctrl-C as-is.
Last edited by Trilby (2024-02-19 01:50:31)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I'm currently using suckless simple terminal. I can't get to modify the binding for interrupt. Any help is welcome.
sorry for bad english
Offline
Ah ... then scrap everything I said before: this is trivially easy.
Just modify config.h appropriately and recompile. If a key combination is found in the shortcuts array, it is handled and *not* sent to the actual terminal device (i.e., the running shell). And there is even a binding there already for the Ctrl+Shift+C to copy, so just remove the ShiftMask from that.
Last edited by Trilby (2024-02-19 21:01:09)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
And there is even a binding there already for the Ctrl+Shift+C
where? i don't find anything related to Signal Interrupt
it seems like it's managed by the terminal itself, so i can change it with `stty intr \^k`
so i already set
```
{ ControlMask, XK_C, clipcopy, {.i = 0} },
{ ControlMask, XK_V, clippaste, {.i = 0} },
```
but it still doesn't work with that... what the duck happens now? i tried with ControlMask + XK_1 and it works, but not with ControlMask + XK_C
sorry for bad english
Offline
SigInt is irrelevant. You *definitely* don't want to make your shell ignore SigInt. You just want the X11 window created by st to handle the Ctrl+C keyboard event differently by not just passing it to the shell as is.
I don't have an Xorg set up to test it myself, but on 1851-1856 of `x.c`, any key that is found in the "shortcuts" array results in the function returning before reaching line 1879 where the string representation of the key press is passed to the actual terminal device.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Offline
i don't find ^C in the key[] array. i don't know where to search for it
sorry for bad english
Offline
There is no ^C key: not in the array nor on your keyboard. But you can press a combination of keys that would be represented by the modifier ControlMask and the keysym XK_c - but as seth notes, this is different than the key that would be represented by XK_C.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
i don't know what else to do then
sorry for bad english
Offline
{ ControlMask, XK_c, clipcopy, {.i = 0} },
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
i don't know how to delete this message, so i edit it saying it worked, thanks
Last edited by whittlers (2024-02-20 06:18:37)
sorry for bad english
Offline
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline
(Hey, sorry if it’s too late to reply and is considered necro-bumping. But I would like to add a couple of extra words to the conversation.)
I use Linux and terminals for a long time now, but I still don’t like the default ctrl+c way too much. I hate it. Hence, I’m here.
As a long-time macOS user, I like cmd+c logic. If you never had macOS before, they have cmd+c, cmd+x, cmd+v for copy-cut-paste, and cmd modifier is usually used instead of ctrl. That logic may look wrong to many PC people, but when you got used to it, it’s really useful.
The point is, on macOS, there’s no ctrl+c for copy, it’s only cmd+c. So you can eat your cake and have it.
Since most of my Arch installs are on my old MacBooks, and I’m a macOS refugee, there are things I like from macOS. And cmd behaviour is probably one of my favourite. So I was looking for ways to make cmd+c, +x, +v (at least these three) work as I used to. That way, I don’t have to deal with the weird ctrl+shift+v of terminal.
I’m on sway wm (which is Wayland), and I have these lines in my config for that:
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
It uses wtype for that.
That’s not directly the solution for this problem, but for me, it solves it.
When I would use another computer (without the cmd key on Apple keyboard), I may just use another modifier key for that (logo key or alt, or whatever is on the left from the space bar).
My terminal is foot, but I think that may apply to any terminal.
And on Fedora’s Workstation (the default one with Gnome), I recently found out that I can choose the cmd+c/v combination for copying/pasting too. That was in the gnome-terminal. I’m specifying the Fedora, because I haven’t checked it on Arch, but I think that would be the same. Just don’t remember whether that feature was in the terminal itself (I think it’s there), or somewhere in Gnome settings. I haven’t checked the ctrl+c combination, though.
So my way of solving this isn’t exactly the direct answer to the question, but just a suggestion that this problem can be solved differently and possibly simpler, if you’re okay with another key combination.
Hope that will help anyone, too.
Russia is committing genocide on Ukraine right now (2022—2024), please help Ukraine as much as you can. That’s the turning point of the democracy vs tyranny war, and if Ukraine loses, everyone in the democracy world will. You can donate to Ukraine here: savelife.in.ua/en/donate or help with spreading the information about the ongoing events. Thank you.
Offline
Mod note: closing this old, solved topic.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Pages: 1
Topic closed