Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keamon

Key Daemon - A Linux input filtering daemon for key remapping and event interception.

Disclaimer

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.

Overview

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.

Installation

Manual Build

git clone https://github.com/Julius-IX/keamon
cd keamon
make
sudo make install

Arch Linux (AUR)

The 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 -si

Systemd Service

Enable and start the service:

sudo systemctl enable --now keamon.service

Configure arguments (idle sleep and capture duration):

sudo systemctl edit keamon.service

Add these lines (or use this):

[Service]
ExecStart=
ExecStart=/usr/local/bin/keamon 5000 3000

Replace 5000 and 3000 with your preferred values in milliseconds.

How It Works

Every cycle, Keamon:

  1. Randomly selects two different input codes (keyboard keys or mouse buttons)
  2. Grabs all input devices that produce either code
  3. Intercepts events for those codes for a configurable duration (Y ms)
  4. Executes custom handlers for each intercepted event
  5. Releases all grabbed devices
  6. Sleeps for an idle period (X ms)
  7. Repeats indefinitely

Supported input codes can easily be extended by adding to input_codes.c. See official linux input codes at kernel docs.

Building

make

Running Manually

Requires 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 ./keamon

Configuration

Both X (idle sleep between cycles) and Y (capture duration) are resolved in this priority order:

  1. Command line arguments
  2. Environment variables
  3. Hardcoded defaults

Default Values

  • X (idle sleep): 5 min
  • Y (capture window): 1 min

Environment Variables

  • INPUT_FILTER_SLEEP_MS: Idle time between capture windows
  • INPUT_FILTER_CAPTURE_MS: Duration of each capture window

Command Line

./keamon [X_ms] [Y_ms]

Help

./keamon --help
# or
./keamon -h
# or
./keamon help

About

A Linux input daemon for randomly remapping keyboard and mouse inputs, because sometimes your computer needs to betray you.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages