Variable: last-event-device
last-event-device is a variable defined in keyboard.c.
Value
nil
Documentation
The name of the input device of the most recently read event.
When the input extension is being used on X, this is the name of the X Input Extension device from which the last event was generated as a string. Otherwise, this is "Virtual core keyboard" for keyboard input events, and "Virtual core pointer" for other events.
It is nil if the last event did not come from an input device (i.e. it
came from unread-command-events instead).
Probably introduced at or before Emacs version 29.1.
Source Code
// Defined in /usr/src/emacs/src/keyboard.c
DEFVAR_LISP ("last-event-device", Vlast_event_device,
doc: /* The name of the input device of the most recently read event.
When the input extension is being used on X, this is the name of the X
Input Extension device from which the last event was generated as a
string. Otherwise, this is "Virtual core keyboard" for keyboard input
events, and "Virtual core pointer" for other events.
It is nil if the last event did not come from an input device (i.e. it
came from `unread-command-events' instead). */);