/ ink / events / terminal-focus-event.ts
terminal-focus-event.ts
 1  import { Event } from './event.js'
 2  
 3  export type TerminalFocusEventType = 'terminalfocus' | 'terminalblur'
 4  
 5  /**
 6   * Event fired when the terminal window gains or loses focus.
 7   *
 8   * Uses DECSET 1004 focus reporting - the terminal sends:
 9   * - CSI I (\x1b[I) when the terminal gains focus
10   * - CSI O (\x1b[O) when the terminal loses focus
11   */
12  export class TerminalFocusEvent extends Event {
13    readonly type: TerminalFocusEventType
14  
15    constructor(type: TerminalFocusEventType) {
16      super()
17      this.type = type
18    }
19  }