ISOTerminal.prototype.enableRemoteKeyboard = function(opts){

  // initialize REPL 
  ISOTerminal.prototype.boot.menu.push(
    {
      key: "k",
      title: (opts) => "connect a remote keyboard",
      init: function( mainmenu ){ 
        this.emit('status',"")
        this.emit('enable-console',{stdout:true})
        setTimeout( () => {
          this.send("\n\r1. open a terminal on your laptop/desktop\n\r")
          this.send("2. run (or install) the keyboard forwarder:\n\n\r")
          this.send("\t$ wget https://xrsh.isvery.ninja/xrsh\n\r")
          this.send("\t$ chmod +x xrsh\n\r")
          this.send("\t$ ./xrsh --keyboard\n\r\n\r")
          this.send("\tNOTE: windows-users need WSL\n\n\r")
          this.send("press a key to connect..    (or 'm' for mainmenu)\n\r")
        }, 100 )
      },
      keyHandler: function(ch){
        this.send(ch)
        if( ch == 'm'){
          this.bootMenu()
        }else if( (ch == "\n" || ch == "\r") ){
          try{
            console.log("running websocket server")
            this.send("\n\r")
          }catch(e){ 
            reset()
            throw e // re throw
          }
        }
      }
    }
  )
}

ISOTerminal.addEventListener('init', function(){
  this.enableRemoteKeyboard()
})