Skip to content

Customize Vysor

Koushik Dutta edited this page Oct 13, 2016 · 4 revisions

Customizing Vysor allows you to change how key events are mapped from your desktop PC to your Android device. You can also modify the navigation bar along the bottom bar of your Vysor screen to add or remove buttons.

Defaults

Here are the default settings that Vysor uses:

{
  "keydown": {
    "ArrowDown": "KEYCODE_DOWN",
    "ArrowLeft": "KEYCODE_LEFT",
    "ArrowRight": "KEYCODE_RIGHT",
    "ArrowUp": "KEYCODE_UP",
    "Backspace": "KEYCODE_DEL",
    "Delete": "KEYCODE_FORWARD_DEL",
    "Enter": "KEYCODE_ENTER",
    "Escape": "KEYCODE_BACK",
    "F1": "KEYCODE_MENU",
    "F2": "VYSOR_SHOW_TITLE_BAR",
    "Home": "KEYCODE_HOME",
    "Tab": {
      "keyevent": "KEYCODE_TAB",
      "shiftKey": true
    }
  },
  "navigationBar": {
    "buttons": [
      {
        "class": "fa fa-lg fa-chevron-left",
        "event": "KEYCODE_BACK",
        "title": "Back"
      },
      {
        "class": "fa fa-lg fa-circle-o",
        "event": "KEYCODE_HOME",
        "title": "Home"
      },
      {
        "class": "fa fa-lg fa-navicon",
        "event": "KEYCODE_APP_SWITCH",
        "title": "Recent Tasks"
      }
    ]
  },
  "devices": {
    "example-device-serial": {
      "keydown": {
        "F3": "KEYCODE_BACK"
      },
      "navigationBar": {
        "buttons": [
          {
            "class": "fa fa-lg fa-circle-o",
            "event": "KEYCODE_HOME",
            "title": "Home"
          }
        ]
      }
    }
  }
}

keydown entry

This entry maps a JavaScript KeyboardEvent.key or KeyboardEvent.keycode to an Android KeyEvent Keycode value.

The syntax for an entry is as follows:

[Keycode Number|Key String]: [KeyEvent String|Key Event Object]

A Key Event Object is:

{
[keycode|keyevent]:[number|string],
shiftKey:[true|false|undefined]
}

Here, an "ArrowDown" in JavaScript is mapped to a "KEYCODE_DOWN" in Android:

"ArrowDown": "KEYCODE_DOWN",

The "shift" modifier can also be sent to the key event. Instead of mapping to a string, map to an object as such. For example, to move between controls on Android, map the Tab Key, with the shift modifier, to KEYCODE_TAB:

"Tab": {
  "keyevent": "KEYCODE_TAB",
  "shiftKey": true
}