How to use the guacamole-common-js.Keyboard function in guacamole-common-js

To help you get started, we’ve selected a few guacamole-common-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / incubator-dlab / services / self-service / src / main / resources / webapp / src / app / webterminal / webterminal.component.ts View on Github external
// Error handler
    guac.onerror = (error) => console.log(error.message);
    window.onunload = () => guac.disconnect();

    // Mouse
    const mouse = new Guacamole.Mouse(guac.getDisplay().getElement());
    mouse.onmousemove = (mouseState) => {
      if (navigator.userAgent.indexOf('Firefox') === -1) {
        mouseState.x = mouseState.x + 125;
        mouseState.y = mouseState.y + 65;
      }
      guac.sendMouseState(mouseState);
    }

    const keyboard = new Guacamole.Keyboard(document);
    keyboard.onkeydown = (keysym) => guac.sendKeyEvent(1, keysym);
    keyboard.onkeyup = (keysym) => guac.sendKeyEvent(0, keysym);
  }
}
github paidem / guacozy / frontend / src / Components / GuacViewer / GuacViewer.js View on Github external
useEffect(() => {
        // don't bind to events if we know this input will not be accepted at server side
        if (!controlInput) {
            return;
        }

        // Keyboard
        let keyboard = new Guacamole.Keyboard(displayRef.current);

        const fixKeys = (keysym) => {
            // 65508 - Right Ctrl
            // 65507 - Left Ctrl
            // somehow Right Ctrl is not sent, so send Left Ctrl instead
            if (keysym === 65508) return 65507;

            return keysym
        };

        keyboard.onkeydown = function (keysym) {
            guacRef.current.sendKeyEvent(1, fixKeys(keysym));
        };

        keyboard.onkeyup = function (keysym) {
            guacRef.current.sendKeyEvent(0, fixKeys(keysym));