How do I simulate keypresses?
asked 2012-09-11 15:20:49 +0000
This post is a wiki. Anyone with karma >100 is welcome to improve it.
Hello everybody,
this is my first post here, although I've been using i3 for some months now. I really have to thank the developers for this incredible wm (and for its docs!! :) ).
Some context for my question.
I'm using an Apple keyboard and I set the Meta key as $mod. Since this key is easier to reach than Ctrl, I would like to use it for copy/paste shortcuts and other stuff. E.g., I'd like to press Meta+c to copy the selected text to the clipboard, and Meta+v to paste. I tried different programs (xdotool, xte, xvkbd ...) to simulate keypresses. They do work in a terminal, i.e, if I run in xterm
xte "keydown Control_R" "key c" "keyup Control_R"
I do get ^C as output. However, if I configure i3 like this
bindsym $mod+c exec xte "keydown Control_R" "key c" "keyup Control_R"
nothing happens, probably becasue the command is run in the login shell.
So I guess my question becomes: is there a way to tell i3 to send a keypress to the focused container?
Thanks in advance.
Bye