ESP8266 and ESP32 (the one we support) cannot act as an USB HID device.
You could use a board with an 32u4 as an USB HID device and write a small sketch on it which may read from some pin(s) and turn those into keyboard keystrokes.
For example pressing Windows-key + L to lock the PC.
The newest Espressif cores do seem to (finally) support the ESP to work as an USB device, but those are not yet supported by ESPEasy (you probably can't even order silicon of those right now)
Also those cores use a completely different architecture, so it will take quite a while before those will be supported.
For example the ESP32-S2 was introduced in 2019 and I tried to make an ESPEasy build for it a few weeks ago and failed miserably as the libraries are just not ready yet. That's over 20 months since introduction and still not supported, so it may take a while before those recently introduced (few weeks ago) new Espressif chips will be supported here.
Would be nice to support USB natively from ESPEasy as you may also allow upgrading it as if it is an USB thumbdrive for example.