github directvt/vtm v2026.02.20

8 hours ago

GitHub all current

Changes

  • Fix 256-color palette change via OSC 4.
  • Introduce an interactive session token. #877
ObjectID/ClassID Role Methods Method description
terminal vtm.terminal.RequestInteractiveSessionToken() Request an interactive session token. The token will be sent to the requesting app via APC in the following format:
\e_event=session;token=b4514088589a99e3\e\\.

Terminal control using Lua scripts via APC

The built-in terminal is capable of executing Lua scripts received via APC (Application Program Command) vt-sequences. The format of the vt-sequence is as follows:

ESC _ lua: <script body> ST

or

ESC _ lua:FFFFFFFFFFFFFFFF: <script body> ST

where:

  • ESC_: APC vt-sequence prefix.
  • lua:: case-insensitive APC payload marker.
  • <script body>: Lua script body.
  • ST: ESC``\ or BEL - APC sequence terminator.
  • FFFFFFFFFFFFFFFF:: 16-hexadecimal-digit interactive session token ending with a colon. This token can be obtained using the following APC request: \e_lua:terminal.RequestInteractiveSessionToken()\a - The terminal will respond with an APC sequence containing the 16 digits of the required interactive token: \e_event=session;token=FFFFFFFFFFFFFFFF\e\\.

Note: Without specifying an interactive session token, calls to functions related to interactive interaction (moving/sizing windows, mouse, keyboard, focus, etc.) will be silently ignored.

Usage examples:

Note: The global variable terminal (in the Lua namespace) is an alias for vtm.terminal.

  • bash:
    # Print the current scrollback buffer limits
    printf "\e_lua: local n,m,q=terminal.ScrollbackSize(); terminal.PrintLn('size=', n, ' growstep=', m, ' maxsize=', q)\e\\"
    
    # Set the scrollback buffer limit to 10K lines
    printf "\e_lua: terminal.ScrollbackSize(10000)\a"
    
    # Maximize the terminal window
    ## 1. Get a session token:
    printf "\e_lua:terminal.RequestInteractiveSessionToken()\a"
    ## 2. Use the received token when requesting to maximize the window:
    printf "\e_lua:0000000000000000: vtm.applet.Maximize()\e\\"
    

Don't miss a new vtm release

NewReleases is sending notifications on new releases.