[[!meta title="Tell Xorg to re-grab the keyboard"]]
[[!meta date="2011-12-29 23:45"]]
[[!meta author="rohieb"]]
[[!meta license="CC-BY-SA 3.0"]]

OK, I was doing some debugging with Xorg, and thought I had to use the
[Magic SysRq][0] key to kill it. But when I had pressed Alt-SysRq-R to
give the keyboard control from Xorg back to the kernel, it turned out
that I not longer needed to do another SysRq because my Xorg magically
worked again… ;-) Unfortunately now, everytime I pressed Alt-F4 to close
a window, I found myself on tty4… rather poor. So I needed some way to
tell Xorg to grab the keyboard again, and [there it is][1]: Just open an
xterm and execute 

    sudo kbd_mode -s

[0]: http://en.wikipedia.org/wiki/Magic_SysRq_key
[1]: https://learninginlinux.wordpress.com/2010/06/16/debugging-notes-to-self/

[[!tag fix howto debugging Linux shell SysRq Xorg]]