Key Daemon - A Linux input filtering daemon for key remapping and event interception.
I do no take accountability for any damages that might occur to personal relationships due to the use of this software. This was created as a good spirited prank for a friend.
Keamon is a low-level input filtering daemon for Linux that intercepts and manipulates keyboard and mouse events. It randomly selects pairs of input codes and swaps their events at configurable intervals.
git clone https://github.com/Julius-IX/keamon
cd keamon
make
sudo make installThe AUR is not accepting new account registrations due to bot spam. Once reopened, the package will be available. For now, build locally:
cd pkg
makepkg -siEnable and start the service:
sudo systemctl enable --now keamon.serviceConfigure arguments (idle sleep and capture duration):
sudo systemctl edit keamon.serviceAdd these lines (or use this):
[Service]
ExecStart=
ExecStart=/usr/local/bin/keamon 5000 3000
Replace 5000 and 3000 with your preferred values in milliseconds.
Every cycle, Keamon:
- Randomly selects two different input codes (keyboard keys or mouse buttons)
- Grabs all input devices that produce either code
- Intercepts events for those codes for a configurable duration (Y ms)
- Executes custom handlers for each intercepted event
- Releases all grabbed devices
- Sleeps for an idle period (X ms)
- Repeats indefinitely
Supported input codes can easily be extended by adding to input_codes.c. See official linux input codes at kernel docs.
makeRequires root privileges or appropriate udev rules for /dev/input/event* and /dev/uinput access.
# Run with defaults
sudo ./keamon
# Specify custom idle sleep and capture duration (in milliseconds)
sudo ./keamon 5000 3000
# Use environment variables
sudo -E INPUT_FILTER_SLEEP_MS=2000 INPUT_FILTER_CAPTURE_MS=10000 ./keamonBoth X (idle sleep between cycles) and Y (capture duration) are resolved in this priority order:
- Command line arguments
- Environment variables
- Hardcoded defaults
- X (idle sleep): 5 min
- Y (capture window): 1 min
INPUT_FILTER_SLEEP_MS: Idle time between capture windowsINPUT_FILTER_CAPTURE_MS: Duration of each capture window
./keamon [X_ms] [Y_ms]./keamon --help
# or
./keamon -h
# or
./keamon help