https://github.com/aligrudi/fbpad
A small Linux framebuffer virtual terminal
https://github.com/aligrudi/fbpad
c framebuffer virtual-terminal
Last synced: 3 months ago
JSON representation
A small Linux framebuffer virtual terminal
- Host: GitHub
- URL: https://github.com/aligrudi/fbpad
- Owner: aligrudi
- Created: 2013-10-24T12:30:06.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2025-11-26T16:18:19.000Z (4 months ago)
- Last Synced: 2025-11-29T13:38:13.232Z (4 months ago)
- Topics: c, framebuffer, virtual-terminal
- Language: C
- Homepage: http://litcave.rudi.ir/
- Size: 249 KB
- Stars: 142
- Watchers: 6
- Forks: 20
- Open Issues: 2
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
- awesome-ricing - fbpad - A small Linux framebuffer virtual terminal. (C) (Packages / Terminals)
README
FBPAD
=====
Fbpad is a small Linux framebuffer virtual terminal. It manages many
terminals through single-letter tags; each tag can hold two terminals.
The following table lists fbpad's key-bindings (m-k means pressing k,
while holding the alt key).
============== =======================================
KEY COMMAND
============== =======================================
m-c execute a shell (SHELL)
m-m execute mail program (MAIL)
m-e execute editor program (EDITOR)
m-x switch to tag 'x' (TAGS)
m-j switch to current tag's alternative terminal
m-k like m-j
m-p show tag summary
m-o jump to the previous tag
m-tab show the next terminal
m-s create a text screenshot (SCRSHOT)
m-y redraw the terminal
c-m-e reload the fonts and terminal colors (CLRFILE)
c-m-l lock the screen; use PASS to unlock
c-m-o disable/enable tag switching
c-m-q quit fbpad
m-, scroll up
m-. scroll down
m-= split tag horizontally/vertically
m-- unsplit tag
m-; like m-c but with switching signals
============== =======================================
To execute a single program in fbpad, the program and its arguments
can be passed as command line arguments of fbpad. Fbpad executes the
specified program in a terminal, disables all terminal switching
commands, and exits as soon as the program finishes.
Programs like fbpdf, fbvnc, and fbff read the FBDEV environment
variable, which can specify the framebuffer device and its drawing
region, like "/dev/fb0:1438x448+1+451". Fbpad defines this
environment variable when executing a program, so that if a tag is
split, the program running in its terminal is limited to its
corresponding framebuffer region.
SETTING UP
==========
Fbpad can be configured by editing the conf.h header. To start fbpad,
FR must point to a valid fbpad font (for testing you can try
http://litcave.rudi.ir/courr.tf), and SHELL to the shell you want
fbpad to execute. Once these are set, fbpad can be started without
problems.
Fbpad fonts can be generated using fbpad_mkfn program
(http://litcave.rudi.ir/). The FR, FI, and FB macros specify the path
of fbpad fonts for regular, italic, and bold fonts. If FI or FB is
NULL, the regular font is used for italic or bold text.
Next, you may want to change the list of fbpad tags by changing the
TAGS macro. The FGCOLOR and BGCOLOR macros specify the foreground and
background colors. Individual colors can be customized by editing the
hex RGB color description of COLOR* macros. Also SCRSHOT macro
specifies where fbpad text screenshots, created by "m-s" command, must
be saved.
If you want to use fbpad's scrsnap feature, you can edit TAGS_SAVED
to change the list of saved tags. Framebuffer memory is saved and
reloaded for terminals in these tags, which is very convenient when
you are using programs that modify the framebuffer simultaneously,
like fbpdf.
CLRFILE
=======
If CLRFILE is set, fbpad fonts and colors can be changed using c-m-e.
This is an example:
# Foreground and background colors
color ffefef 333333
# Basic 16-color palette
color16 000000 ff5f87 00d787 cdcd00 00afff ff87df 00cdcd e5e5e5
7f7f7f ff0000 00ff00 ffff00 5c5cff ff00ff 00ffff ffffff
# Cursor color
cursor 444444 ffbb55
# Border color and width
border ffbb55 3
# Fonts: regular, italic, bold
font /path/to/0.tf /path/to/1.tf /path/to/2.tf
256-COLOR MODE
==============
Fbpad supports xterm's 256-color extension, but most programs will not
use this extension, unless the $TERM terminfo entry declares this
feature. For this purpose, fbpad-256 terminfo file can be created to
contain (the two-space identation should be ignored):
fbpad-256,
use=linux, U8#0,
colors#256,
pairs#32767,
setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
Which can be installed with tic command:
$ tic -x ./fbpad-256
The following line should be added to shell's startup script:
export TERM=fbpad-256
Note that in order to use this feature and italic fonts in Vim, adding
fbpad-256 terminfo is not necessary. Including the following lines in
the vimrc file should enable them:
set t_ZH=[3m
set t_Co=256
PERFORMANCE
===========
To improve text rendering performance in fbpad, you may redefine
fb_set() in pad.c based on the color depth and encoding of your
framebuffer. For instance, if using a 32-bit little-endian RGB
framebuffer, you may redefine it as follows:
static void fb_set(char *d, unsigned r, unsigned g, unsigned b)
{
d[0] = b;
d[1] = g;
d[2] = r;
}