The current heuristics of Guacamole.Keyboard are insufficient for current browser behavior, namely:
- AltGr vs. Ctrl+Alt and associated ambiguity
- Accuracy and inaccuracy of e.keyIdentifier (usually incorrect, doesn't always take Shift or Caps Lock into account)
- Accuracy, but occasional unavailability, of e.key
- Accuracy, but unpredictability, of keypress
- Lack of keyup for printable characters in when Meta is being held
I believe a better approach would be to adopt an internal queue of key events, where each event is essentially a stripped-down copy of keydown/keypress/keyup. Pattern matching similar to regex could then be applied to the front of this queue, removing sets of keys which are known to represent specific keysyms, and keeping ambiguous combinations until time or further events narrow the possibilities.