3

I would like to set custom keyboard shortcuts for using clipboard. I would like to change it from:

Copy: ctrl + c in programs, ctrl + shift + c in terminal
Paste: ctrl + v in programs, ctrl + shift + v in terminal
Cut: ctrl + x in programs, does not work properly in terminal

To:

Copy: Win + c everywhere
Paste: Win + v everywhere
Cut: Win + x everywhere

How can I achive this ?
Thank you for your help

PS: I am using: Arch linux, xserver, i3wm, xclip, alacritty

1
  • 2
    Each program interacts on its own manner with the clipboard (and terminal emulators are especially picky), so an universal solution is impossible.
    – Quasímodo
    Commented Sep 10, 2020 at 12:00

1 Answer 1

3

Note that bindsym is for associating a key with a command and that $mod is a variable that stores your picked special key (you had to choose between Ctrl and Super(1)).

So, let's go:

  1. Be sure you have installed wl-clipboard, it works on Wayland (which is the default server for i3). On Arch Linux you can ensure its installation with this command:
    sudo pacman -S wl-clipboard --needed -y
    
  2. Lets edit the i3 config file, default at ~/.config/i3/config
  3. Add the following lines for both copy and paste(2):
    bindsym $mod+c exec wl-copy
    bindsym $mod+v exec wl-paste
    
  4. Save it

About the 'cut' function: maybe you could do something like

bindsym $mod+x exec wl-copy ERASE

where ERASE may be a function which deletes the chosen text after its copying. Of course that last one does not work as it is! We need to think in a way to replace ERASE.


(1) We don't say Win on Linux, but Super. It's the same key by the way.

(2) The combo $mod+v is used by default to split vertically, I recommend to use paste with $mode+p or something else.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .