First of all, I don't expect that something like this already exists, but I am interested in knowing how something like this would be accomplished.
I want a program that I can have running in the background that will intercept ALL keystrokes entered (I'm assuming X is running and perhaps even that Unity is also running), process those keystrokes and then send the original or modified keystrokes on to be handled as normal.
My ultimate goal is creating a sort of keymapping that more closely mimics OS X shortcut behavior. This is very difficult with a standard Ubuntu install since things like ctrl+c seem to be set in stone whereas to mimic OS X behavior, it would need to be cmd+c. Anyway, I'm less interested in discussing the why and more interested in discussing the how. I'm not adverse to writing a daemon in Python, C or whatever else might be needed (I'm also somewhat comfortable with standard UNIX apis). I am, however, completely ignorant about where to begin with something like this.
When the keystrokes are intercepted and processed, it should be able to send them back to the OS following the same interface that the strokes were originally sent with. Maybe this would have to be a patch to X itself? Or would something be able to be in place between the keyboard and X?
To show events from keyboards, but also other input devices, there is also
evtest
.It can not create keypresses in itself, but see below.
It shows events on a lower level than
xev
would, for example.Also, it shows which events can be created by the device.
As it happens,
event4
refers to my main keyboard.So I create the example output below with the command
and pressing aB:
(To find the right event number (like my event4), you could look at
cat /proc/bus/input/devices
. TheName
may not refer to a keyboard, but look for the entryHandlers
containingsysrq
kbd
andleds
. Or just try them all.)Keypress events can not be created by
evdev
, but there is an implementation of a key remapping usingevdev
that can create new events,It seems to match what you are looking for:
At Home Modifier by Evdev (
ahm
orat-home-modifier-evdev
):It does not claim to be a clean implementation - but that does not prevent to learn from it.
Yes there is a keylogger for ubuntu..
You can download it from here
Or you install it via apt-get
Enable universe repositories,and then run the following in terminal
To run,type the following in terminal
for seeing results
tail log.file