Skip to content

About

A system-wide keyboard and mouse chatter blocker for Linux

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Chatter Blocker for Linux

A system-wide keyboard and mouse chatter blocker for Linux, written in Python.

Chatter Blocker is a native Linux application built with evdev, uinput, and GTK 4. It works below the display server, so the same build supports Wayland, X11, mixed XWayland sessions, and desktop environments without a compositor-specific extension.

How it works, including Wayland

Wayland intentionally does not let an ordinary client globally intercept and discard another client's keystrokes. This application does not bypass that rule with a compositor-specific private protocol. It filters at the Linux input layer:

physical keyboard / mouse
          |
          v
  /dev/input/event* -- EVIOCGRAB --> chatter filter
                                          |
                                   accepted events only
                                          |
                                          v
                          matching /dev/uinput device
                                          |
                                          v
                         Wayland compositor or X server --> applications

The input backend discovers keyboard and pointer event devices, takes an exclusive grab, and mirrors each through a matching virtual "Keyboard Chatter Blocker" device. Keeping them separate preserves the keyboard, mouse, and touchpad classifications expected by udev, libinput, and desktop compositors. Events which are not chatter are replayed unchanged. The kernel releases every grab automatically if the process exits or crashes. Newly attached and removed devices are detected while the app runs.

This design depends on the Linux evdev and uinput ABIs, not GNOME, KDE, wlroots, Xorg, or a specific compositor. The supplied permission installer uses udev and seat uaccess, which is common across desktop distributions. See Other init/device managers for systems without it.

Requirements

  • Linux with the uinput kernel module and /dev/input/event* devices.
  • Python 3.10 or newer, including the venv module.
  • GTK 4 and PyGObject (gi with the GTK 4 introspection data).
  • udev with active-seat uaccess support for the supplied permission rules, or equivalent permissions configured by the administrator.

Common package names are python3, python3-venv, python3-gi, gir1.2-gtk-4.0, and kmod on Debian-derived distributions; python3-gobject, gtk4, and python3 on Fedora-derived distributions; and python, python-gobject, and gtk4 on Arch-derived distributions. Package names vary, so use the equivalent provided by your distribution.

Install

Enter the repository checkout:

cd /path/to/the/repository

For a per-user application install:

./scripts/install.sh --user
sudo ./scripts/install.sh --permissions-only

For one system-wide application install:

sudo ./scripts/install.sh --system

Add --autostart to the --user or --system command if the app should start with the graphical session. It can also be toggled later with Start With Linux in the UI. After installing permissions, log out and back in so the seat manager applies the new device ACLs, then launch Keyboard Chatter Blocker from the application menu or run:

chatter-blocker

Do not run the graphical application with sudo. The installer uses a virtual environment with system site packages so it can use the distribution's PyGObject build while keeping the application isolated.

To run directly from a checkout instead:

python3 -m chatter_blocker.app

Permissions and security

Reading /dev/input/event* permits observation of everything typed, including passwords. Writing /dev/uinput permits synthetic input. The installed udev rules use the uaccess tag so these capabilities are granted to the user at the active local seat; the rules do not make input devices world-readable.

The installer places these system integration files:

  • /etc/udev/rules.d/70-chatter-blocker.rules
  • /etc/modules-load.d/chatter-blocker.conf

The second file loads uinput at boot. To diagnose a startup error, check that the nodes exist and that the logged-in user has an ACL on them:

ls -l /dev/uinput /dev/input/event*
getfacl /dev/uinput /dev/input/event0

If /dev/uinput is absent, run sudo modprobe uinput. If permissions were just installed, logging out and back in is usually required. An error saying that a device cannot be exclusively grabbed usually means another input remapper, macro tool, or virtual-machine input service already owns it; stop one of the two tools rather than running this application as root.

Other init/device managers

The application itself does not require systemd. On a system without udev and logind-style uaccess, arrange equivalent read access to the physical event devices and write access to /dev/uinput using that system's device manager. Many distributions expose an input group as a fallback. Adding a user to that group grants broad, persistent access to all input and should be treated as a security decision, not a routine application preference.

Use and configuration

  1. Start the application and verify that the status line reports monitored input devices.
  2. Check Enable.
  3. Start with the 100 ms global threshold, or set it to zero and configure only known-bad keys from Configure Keys.
  4. Type naturally while watching Chatter Log. Set each affected key's threshold slightly above its largest observed chatter delay.
  5. Enable Start With Linux after the settings have been tested.

Key identifiers use stable names such as H, Enter, mouse_left, and mouse_forward. The UI captures ordinary keyboard keys; unusual media keys, mouse buttons, and wheel_change can be added directly to the text configuration if needed.

Configuration is stored at:

$XDG_CONFIG_HOME/chatter-blocker/config.txt

When XDG_CONFIG_HOME is unset, the location is ~/.config/chatter-blocker/config.txt. It uses a line-oriented name: value format. For example:

is_enabled: true
global_chatter: 40
minimum_chatter_time: 0
measure_from: Press
key.H: 110
key.mouse_forward: 80
other_key_resets_timeout: false
exclude_injected: true

Start In Tray hides the GTK window at startup and when it is closed. GTK 4 has no portable status-icon API shared by all Linux desktops, so this mode does not promise a tray icon. Launching the app again presents the existing single-instance window.

Features

Feature Status
Global and per-key chatter thresholds Supported
Measure from press or release; minimum chatter time Supported; minimum time is also editable in the config file
Held-key/autorepeat handling Supported
Keyboard, mouse buttons, and wheel-change filtering Supported through evdev
Chatter log and per-session statistics Supported
Enable, start hidden, and start with login Supported with GTK/XDG equivalents
Auto-disable by running program Supported using Linux process names from /proc
Temporary block chord and hotkey config keys Parsed by the config/filter; global desktop hotkey registration is not portable and is not currently exposed by the GTK UI
Auto-disable for fullscreen windows Config and UI are present; compositor-independent detection is unavailable because Wayland does not expose a global fullscreen query
Hidden background operation Supported with hide/show single-instance behavior; GTK 4 has no portable tray-icon API
Persistent statistics Optional CSV persistence; disabled by default
Injected-event exclusion Bypasses kernel-identified virtual devices; evdev cannot identify every possible software source

Limitations

  • Filtering starts only after the user's graphical-session process launches. It does not protect a firmware password prompt, boot loader, display-manager login screen, kernel console before launch, or another user's session.
  • Remote-desktop, accessibility, and software-injected events which never pass through a selected /dev/input/event* device cannot be filtered.
  • Exclusive device grabs conflict with other low-level remappers. Input method editors operating above evdev normally remain compatible, but ordering with other grab/uinput tools cannot be made compositor-independent.
  • A portable Wayland application cannot inspect the active top-level window, so fullscreen auto-disable cannot be guaranteed across compositors. Use the program-name auto-disable list for games.
  • Fonts, widgets, theme, tray behavior, and key names follow the active Linux desktop environment.
  • Multi-seat and unusual kiosk/container setups may require administrator-made device selection and ACL rules. Flatpak/Snap sandboxes do not normally expose the raw input and uinput devices this design requires.
  • Because the app sits in the input path, a stalled process can temporarily interrupt input. Exiting or killing it releases the kernel grabs. Keep SSH or another recovery route available while first testing unusual hardware.

Development and tests

The filter and configuration tests do not need device permissions or a display:

python3 -m unittest discover -v

The input backend intentionally uses only Python's standard library and Linux ioctls. Hardware integration testing must be done in a real local session with permission to grab the test devices; do not run it over an input path you cannot recover remotely.

License

This project is provided under the MIT License.

About

A system-wide keyboard and mouse chatter blocker for Linux

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages