Skip to content

Conversation

@Akash-nath29
Copy link

This pull request implements and documents the feature request in #13, allowing users to customize the font family, font size, and initial shell command for colab-xterm sessions.

Key changes:

  • Backend (notebook magic):

    • Updated %xterm magic in notebook.py to accept fontfamily, fontsize, and command as arguments (e.g. %xterm port=8080 fontfamily="consolas" fontsize=18 command="top").
    • These arguments are parsed and passed to the frontend as query parameters.
    • The backend launches the requested initial shell command if provided.
  • Frontend:

    • index.ts now reads fontfamily and fontsize from the URL query parameters and uses those settings when constructing the xterm.js terminal.
    • Defaults remain (fontfamily=monospace, fontsize=14) if parameters are not provided.
  • CLI/Local Usage:

    • While CLI arguments for font are not supported, users can now manually append ?fontFamily=...&fontSize=... to the local URL to preview different terminal styles.

Usage examples:

  • In a notebook cell:
    %xterm port=8080 fontfamily="courier" fontsize=16 command="htop"
    
  • In a browser:
    http://localhost:8080/?fontfamily=Fira%20Mono&fontsize=16
    

Other improvements:

  • Fixed subprocess launching to use the correct Python executable with sys.executable, which improves compatibility across environments.
  • Updated documentation and comments for maintainability.

Closes: #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant