Skip to content

Framebuffer Mode

Alejandro Quintanar edited this page Nov 30, 2025 · 1 revision

Framebuffer Mode

Framebuffer mode provides direct rendering to /dev/fb0 on Linux console, enabling pixel-perfect DOS-like display with classic text modes.

Note: This feature is Linux-only and requires the framebuffer-backend feature at compile time.


Requirements

  • Linux operating system
  • Physical console (TTY1-6), not terminal emulators or SSH
  • Access to /dev/fb0 (root or member of video group)
  • Compiled with --features framebuffer-backend

Quick Start

# Build with framebuffer support
cargo build --release --features framebuffer-backend

# Run in framebuffer mode (may require sudo)
sudo ./target/release/term39 -f --fb-mode=80x25

Setup Wizard

Use the interactive setup wizard to configure framebuffer mode:

term39 --fb-setup

The wizard allows you to:

  • Select text mode
  • Choose pixel scale factor
  • Select console font
  • Configure mouse settings

Settings are saved to ~/.config/term39/fb.toml.


Text Modes

Classic DOS Modes

Mode Columns Rows Character Size
40x25 40 25 16x16
80x25 80 25 8x16 (default)
80x43 80 43 8x11
80x50 80 50 8x8

High-Resolution Modes

Mode Columns Rows Character Size
160x50 160 50 8x16
160x100 160 100 8x16
320x100 320 100 8x16
320x200 320 200 8x8

Command-Line Options

Basic Options

# Enable framebuffer mode
term39 -f
term39 --framebuffer

# Specify text mode
term39 -f --fb-mode=80x50

# Set pixel scale (1-4 or auto)
term39 -f --fb-scale=2

# Specify font
term39 -f --fb-font=Unifont-APL8x16

Font Management

# List available fonts
term39 --fb-list-fonts

# Use specific font
term39 -f --fb-font=Uni3-Terminus16

Mouse Options

# Specify mouse device
term39 -f --mouse-device=/dev/input/event2

# Adjust sensitivity (0.1-5.0)
term39 -f --mouse-sensitivity=1.5

# Swap mouse buttons
term39 -f --swap-mouse-buttons

# Invert axes
term39 -f --invert-mouse-x
term39 -f --invert-mouse-y

All Framebuffer Options

Option Description
-f, --framebuffer Enable framebuffer mode
--fb-mode <MODE> Text mode (40x25, 80x25, etc.)
--fb-scale <SCALE> Pixel scale factor (1, 2, 3, 4, auto)
--fb-font <FONT> Console font name
--fb-list-fonts List available fonts and exit
--fb-setup Launch setup wizard
--mouse-device <DEV> Mouse input device path
--mouse-sensitivity <N> Mouse sensitivity (0.1-5.0)
--swap-mouse-buttons Swap left/right buttons
--invert-mouse-x Invert X-axis
--invert-mouse-y Invert Y-axis

Permissions

Option 1: Add User to Groups

# Add to video group (for /dev/fb0)
sudo usermod -aG video $USER

# Add to input group (for mouse devices)
sudo usermod -aG input $USER

# Log out and back in for changes to take effect

Option 2: Run with sudo

sudo term39 -f --fb-mode=80x25

Troubleshooting

"Framebuffer device not found"

Ensure you're on a physical console (Ctrl+Alt+F1 through F6), not a terminal emulator.

"No permission to access /dev/fb0"

Add your user to the video group:

sudo usermod -aG video $USER

Then log out and back in.

Mouse not working

  1. Check if mouse device exists:

    ls -la /dev/input/mice /dev/input/event*
  2. Add user to input group:

    sudo usermod -aG input $USER
  3. Try specifying the device explicitly:

    term39 -f --mouse-device=/dev/input/event2

Wrong font dimensions

Use --fb-list-fonts to see available fonts and their dimensions, then select one matching your desired text mode.


Recommended Fonts

Font Dimensions Notes
Unifont-APL8x16 8x16 Excellent Unicode coverage
Uni3-Terminus16 8x16 Good all-around font
Uni3-TerminusBold16 8x16 Bold variant
Unifont 16x16 Full Unicode, for 40x25 mode

Install fonts on Debian/Ubuntu:

sudo apt install kbd unifont

Configuration File

Framebuffer settings are saved to ~/.config/term39/fb.toml:

[display]
mode = "80x25"
scale = "auto"

[font]
name = "Unifont-APL8x16"

[mouse]
device = "/dev/input/mice"
swap_buttons = false
invert_x = false
invert_y = false

See Also

Clone this wiki locally