1 unstable release

0.4.0 Jul 21, 2021

#993 in Unix APIs

Download history 16/week @ 2024-08-12 15/week @ 2024-08-19 14/week @ 2024-08-26 14/week @ 2024-09-02 16/week @ 2024-09-09 14/week @ 2024-09-16 31/week @ 2024-09-23 20/week @ 2024-09-30 26/week @ 2024-10-07 23/week @ 2024-10-14 15/week @ 2024-10-21 18/week @ 2024-10-28 17/week @ 2024-11-04 16/week @ 2024-11-11 20/week @ 2024-11-18 18/week @ 2024-11-25

73 downloads per month

MIT license

13KB
241 lines

inputplug

inputplug is a very simple daemon which monitors XInput events and runs arbitrary scripts on hierarchy change events (such as a device being attached, removed, enabled or disabled).

To build the project, run cargo build.


NAME

inputplug — XInput event monitor

SYNOPSIS

inputplug [-v] [-n] [-d] [-0] -c command-prefix

inputplug [-h|--help]

DESCRIPTION

inputplug is a daemon which connects to a running X server and monitors its XInput hierarchy change events. Such events arrive when a device is being attached or removed, enabled or disabled etc.

When a hierarchy change happens, inputplug parses the event notification structure, and calls the command specified by command-prefix. The command receives four arguments:

  • command-prefix event-type device-id device-type device-name

Event type may be one of the following:

  • XIMasterAdded
  • XIMasterRemoved
  • XISlaveAdded
  • XISlaveRemoved
  • XISlaveAttached
  • XISlaveDetached
  • XIDeviceEnabled
  • XIDeviceDisabled

Device type may be any of those:

  • XIMasterPointer
  • XIMasterKeyboard
  • XISlavePointer
  • XISlaveKeyboard
  • XIFloatingSlave

Device identifier is an integer. The device name may have embedded spaces.

OPTIONS

A summary of options is included below.

  • -h, --help

    Show help (--help shows more details).

  • -v

    Be a bit more verbose.

  • -n

    Start up, monitor events, but don't actually run anything. With verbose more enabled, would print the actual command it'd run. This implies -d.

  • -d

    Don't daemonise. Run in the foreground.

  • -0

    On start, trigger added and enabled events for each plugged devices. A master device will trigger the "added" event while a slave device will trigger both the "added" and the "enabled" device.

  • -c command-prefix

    Command prefix to run. Unfortunately, currently this is passed to execvp(3) directly, so spaces aren't allowed. This is subject to change in future.

  • -p pidfile

    Write the process ID of the running daemon to the file pidfile

ENVIRONMENT

  • DISPLAY

    X11 display to connect to.

SEE ALSO

xinput(1)

COPYRIGHT

Copyright (C) 2013, 2014, 2018, 2020, 2021 Andrej Shadura.

Copyright (C) 2014, 2020 Vincent Bernat.

Licensed as MIT/X11.

AUTHOR

Andrej Shadura andrewsh@debian.org

Dependencies

~6.5MB
~125K SLoC