         @terminal.showSessions()
     , 3000
   
+  setKeyView:->
+    @getSingleton('windowController').addLayer @
+    # checking existence of terminal because of the initial timeout
+    # this may run before it is created
+    @terminal.setFocused true if @terminal
+    super
+
   click: ->
     @setKeyView()
     

            name: sessions[key]
            mainView: this
        @sessionBox.show()
      
      KD.whoami().tellKite
        kiteName: 'webterm',
        method: 'createServer',

    
    @listenWindowResize()
    
    @on "ReceivedClickElsewhere", =>
      @terminal.setFocused false
      @getSingleton('windowController').removeLayer @

    # $(window).bind "focus", =>
    #   @terminal.setFocused true
    
    # $(window).bind "blur", =>
    #   @terminal.setFocused false
    
    KD.whoami().tellKite
      kiteName: 'webterm',
