=head1 NAME

inputplug - XInput event monitor

=head1 SYNOPSIS

B<inputplug> [B<-v>] [B<-n>] [B<-d>] [B<-0>] B<-c> I<command-prefix>

B<inputplug> [B<-h>|B<--help>]

=head1 DESCRIPTION

B<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, B<inputplug> parses the event notification
structure, and calls the command specified by I<command-prefix>. The command
receives four arguments:

=over

=item I<command-prefix> I<event-type> I<device-id> I<device-type> I<device-name>

=back

Event type may be one of the following:

=over

=item * I<XIMasterAdded>

=item * I<XIMasterRemoved>

=item * I<XISlaveAdded>

=item * I<XISlaveRemoved>

=item * I<XISlaveAttached>

=item * I<XISlaveDetached>

=item * I<XIDeviceEnabled>

=item * I<XIDeviceDisabled>

=back

Device type may be any of those:

=over

=item * I<XIMasterPointer>

=item * I<XIMasterKeyboard>

=item * I<XISlavePointer>

=item * I<XISlaveKeyboard>

=item * I<XIFloatingSlave>

=back

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

=head1 OPTIONS

A summary of options is included below.

=over

=item B<-h>, B<--help>

Show help (B<--help> shows more details).

=item B<-v>

Be a bit more verbose.

=item B<-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 B<-d>.

=item B<-d>

Don't daemonise. Run in the foreground.

=item B<-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.

=item B<-c> I<command-prefix>

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

=item B<-p> I<pidfile>

Write the process ID of the running daemon to the file I<pidfile>

=back

=head1 ENVIRONMENT

=over

=item I<DISPLAY>

X11 display to connect to.

=back

=head1 SEE ALSO

L<xinput(1)>

=head1 COPYRIGHT

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

Copyright (C) 2014, 2020 Vincent Bernat.

Licensed as MIT/X11.

=head1 AUTHOR

Andrej Shadura L<< <andrewsh@debian.org> >>
