In vim, to jump to a tag (tjump) ctrl-] is used. I'm french and using a
french azerty keyboard. On windows or osx, ctrl-] can be acheived by
pressing ctrl-$ but not in xorg, since ^$ doesn't seem to exist.

ctrl-$ is simpler because to produce a ']' I need to use one more
modifier: "altgr".

So, to reproduce the windows/osx behaviour, I though I could grab the
key ctrl-$ in dwm and then send to the selected window the key
combination ctrl-altgr-].

The attach code does this and it works perfectly in gvim or
rxvt-unicode.

But not in xterm (nor uxterm).

My question is: how can I make this work in xterm ?

--
Tinou
XKeyEvent makeKeyEvent(Display *display, Window win, Window winRoot, Bool press, KeyCode keycode, int modifiers)
{
	XKeyEvent event = {
		.display     = display,
		.window      = win,
		.root        = winRoot,
		.subwindow   = None,
		.time        = CurrentTime,
		.x           = 1,
		.y           = 1,
		.x_root      = 1,
		.y_root      = 1,
		.same_screen = True,
		.keycode     = keycode,
		.state       = modifiers,
		.type        = press ? KeyPress : KeyRelease
	};
	return event;
}

void sendKey(KeyCode keycode, int modifiers)
{
	if (!sel || !sel->win)
		return ;
	XKeyEvent kep = makeKeyEvent(dpy, sel->win, root, True, keycode, modifiers);
	XSendEvent(dpy, sel->win, True, KeyPressMask, (XEvent*)&kep);
	XKeyEvent ker = makeKeyEvent(dpy, sel->win, root, False, keycode, modifiers);
	XSendEvent(dpy, sel->win, True, KeyPressMask, (XEvent*)&ker);
	XUngrabKeyboard(dpy, CurrentTime);
}

static void sendbracket(const Arg *arg)
{
	sendKey(XKeysymToKeycode(dpy, XK_bracketright), ControlMask|Mod5Mask);
}

Reply via email to