Added dvtm to build-extensions

This commit is contained in:
Chris Dorman 2020-11-29 17:49:10 -08:00
parent 1dd831ca60
commit a605faa573
25 changed files with 5759 additions and 1 deletions

View File

@ -44,6 +44,7 @@ openssl="openssl-1.1.1h.tar.gz"
tmpdir="`pwd`/pkgsrc"
softwaredir="`pwd`/src/rootfs"
freondir="/freon"
systemdir="`pwd`/system"
# source directories
gccsrcdir=${gcc//.tar.xz}
@ -435,9 +436,21 @@ openssl()
cd $tmpdir
}
# DVTM ~ Dynamic virtual terminal manager
dvtm()
{
cd $systemdir/dvtm
make -j$corecount
make install
cd $tmpdir
}
case $1 in
all ) echo "Building all!"
ncurses; nano; chttpd; gmp; mpfr; binutils; mpc; gcc; bash; isl; termcap; ircii; openssl;;
ncurses; nano; chttpd; gmp; mpfr; binutils; mpc; gcc; bash; isl; termcap; ircii; openssl; dvtm;;
packages ) echo "Building useful essentials..."
ncurses; nano; bash; termcap;;
* ) echo "Building $1..."

1
deps/dvtm.deps vendored Normal file
View File

@ -0,0 +1 @@
ncurses

2
deps/ircii.deps vendored Normal file
View File

@ -0,0 +1,2 @@
ncurses
openssl

22
system/dvtm/LICENSE Normal file
View File

@ -0,0 +1,22 @@
MIT/X Consortium License
(c) 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
(c) 2007-2016 Marc André Tanner <mat at brain-dump dot org>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

68
system/dvtm/Makefile Normal file
View File

@ -0,0 +1,68 @@
include config.mk
SRC = dvtm.c vt.c
OBJ = ${SRC:.c=.o}
all: clean options dvtm
options:
@echo dvtm build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
config.h:
cp config.def.h config.h
.c.o:
@echo CC $<
@${CC} -c ${CFLAGS} $<
${OBJ}: config.h config.mk
dvtm: ${OBJ}
@echo CC -o $@
@${CC} -o $@ ${OBJ} ${LDFLAGS}
debug: clean
@make CFLAGS='${DEBUG_CFLAGS}'
clean:
@echo cleaning
@rm -f dvtm ${OBJ} dvtm-${VERSION}.tar.gz
dist: clean
@echo creating dist tarball
@mkdir -p dvtm-${VERSION}
@cp -R LICENSE Makefile README.md testsuite.sh config.def.h config.mk \
${SRC} vt.h forkpty-aix.c forkpty-sunos.c tile.c bstack.c \
tstack.c vstack.c grid.c fullscreen.c fibonacci.c \
dvtm-status dvtm.info dvtm.1 dvtm-${VERSION}
@tar -cf dvtm-${VERSION}.tar dvtm-${VERSION}
@gzip dvtm-${VERSION}.tar
@rm -rf dvtm-${VERSION}
install: dvtm
@echo stripping executable
@${STRIP} dvtm
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin
@cp -f dvtm ${DESTDIR}${PREFIX}/bin
@chmod 755 ${DESTDIR}${PREFIX}/bin/dvtm
@cp -f dvtm-status ${DESTDIR}${PREFIX}/bin
@chmod 755 ${DESTDIR}${PREFIX}/bin/dvtm-status
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
@mkdir -p ${DESTDIR}${MANPREFIX}/man1
@sed "s/VERSION/${VERSION}/g" < dvtm.1 > ${DESTDIR}${MANPREFIX}/man1/dvtm.1
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/dvtm.1
@echo installing terminfo description
@TERMINFO=${TERMINFO} tic -s dvtm.info
uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
@rm -f ${DESTDIR}${PREFIX}/bin/dvtm
@rm -f ${DESTDIR}${PREFIX}/bin/dvtm-status
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
@rm -f ${DESTDIR}${MANPREFIX}/man1/dvtm.1
.PHONY: all options clean dist install uninstall debug

320
system/dvtm/README.md Normal file
View File

@ -0,0 +1,320 @@
# dvtm - dynamic virtual terminal manager
[dvtm](http://www.brain-dump.org/projects/dvtm/) brings the concept
of tiling window management, popularized by X11-window managers like
[dwm](http://dwm.suckless.org) to the console. As a console window
manager it tries to make it easy to work with multiple console based
programs.
![abduco+dvtm demo](https://raw.githubusercontent.com/martanne/dvtm/gh-pages/screencast.gif)
## News
- [dvtm-0.14](http://www.brain-dump.org/projects/dvtm/dvtm-0.14.tar.gz)
[released](http://lists.suckless.org/dev/1502/25558.html) (19.02.2015)
- [dvtm-0.13](http://www.brain-dump.org/projects/dvtm/dvtm-0.13.tar.gz)
[released](http://lists.suckless.org/dev/1411/24449.html) (15.11.2014)
- [dvtm-0.12](http://www.brain-dump.org/projects/dvtm/dvtm-0.12.tar.gz)
[released](http://lists.suckless.org/dev/1407/22702.html) (05.07.2014)
- [dvtm-0.11](http://www.brain-dump.org/projects/dvtm/dvtm-0.11.tar.gz)
[released](http://lists.suckless.org/dev/1403/20371.html) (08.03.2014)
- [dvtm-0.10](http://www.brain-dump.org/projects/dvtm/dvtm-0.10.tar.gz)
[released](http://lists.suckless.org/dev/1312/18805.html) (28.12.2013)
- [dvtm-0.9](http://www.brain-dump.org/projects/dvtm/dvtm-0.9.tar.gz)
[released](http://lists.suckless.org/dev/1304/15112.html) (3.04.2013)
- [dvtm-0.8](http://www.brain-dump.org/projects/dvtm/dvtm-0.8.tar.gz)
[released](http://lists.suckless.org/dev/1208/12004.html) (1.08.2012)
- [dvtm-0.7](http://www.brain-dump.org/projects/dvtm/dvtm-0.7.tar.gz)
[released](http://lists.suckless.org/dev/1109/9266.html) (4.09.2011)
- [dvtm-0.6](http://www.brain-dump.org/projects/dvtm/dvtm-0.6.tar.gz)
[released](http://lists.suckless.org/dev/1010/6146.html) (8.10.2010)
- [dvtm-0.5.2](http://www.brain-dump.org/projects/dvtm/dvtm-0.5.2.tar.gz)
[released](http://lists.suckless.org/dev/0907/0520.html) (7.07.2009)
- [dvtm-0.5.1](http://www.brain-dump.org/projects/dvtm/dvtm-0.5.1.tar.gz)
[released](http://lists.suckless.org/dwm/0902/7405.html) (8.02.2009)
- [dvtm-0.5](http://www.brain-dump.org/projects/dvtm/dvtm-0.5.tar.gz)
[released](http://lists.suckless.org/dwm/0901/7354.html) (26.01.2009)
- [dvtm-0.4.1](http://www.brain-dump.org/projects/dvtm/dvtm-0.4.1.tar.gz)
[released](http://lists.suckless.org/dwm/0805/5672.html) (10.05.2008)
- [dvtm-0.4](http://www.brain-dump.org/projects/dvtm/dvtm-0.4.tar.gz)
[released](http://lists.suckless.org/dwm/0802/4850.html) (17.02.2008)
- [dvtm-0.3](http://www.brain-dump.org/projects/dvtm/dvtm-0.3.tar.gz)
[released](http://lists.suckless.org/dwm/0801/4735.html) (12.01.2008)
- [dvtm-0.2](http://www.brain-dump.org/projects/dvtm/dvtm-0.2.tar.gz)
[released](http://lists.suckless.org/dwm/0712/4677.html) (29.12.2007)
- [dvtm-0.1](http://www.brain-dump.org/projects/dvtm/dvtm-0.1.tar.gz)
[released](http://lists.suckless.org/dwm/0712/4632.html) (21.12.2007)
- [dvtm-0.01](http://www.brain-dump.org/projects/dvtm/dvtm-0.01.tar.gz)
[released](http://lists.suckless.org/dwm/0712/4424.html) (08.12.2007)
## Download
Either Download the latest source tarball
[dvtm-0.14.tar.gz](http://www.brain-dump.org/projects/dvtm/dvtm-0.14.tar.gz)
with sha1sum
205a2165e70455309f7ed6a6f11b3072fb9b13c3 dvtm-0.14.tar.gz
compile (you will need curses headers) and install it
$EDITOR config.mk && $EDITOR config.def.h && make && sudo make install
or use one of the distribution provided packages:
* [Debian](http://packages.debian.org/dvtm)
* [Ubuntu](http://packages.ubuntu.com/dvtm)
* [Fedora](https://admin.fedoraproject.org/pkgdb/package/dvtm/)
* [openSUSE](http://software.opensuse.org/package/dvtm?search_term=dvtm)
* [ArchLinux](http://www.archlinux.org/packages/?q=dvtm)
* [Gentoo](http://packages.gentoo.org/package/app-misc/dvtm)
* [Slackware](http://slackbuilds.org/result/?search=dvtm)
* [FreeBSD](http://www.freshports.org/sysutils/dvtm/)
* [NetBSD](http://www.pkgsrc.se/misc/dvtm/)
* [OpenBSD](http://openports.se/misc/dvtm)
* [Mac OS X](http://braumeister.org/formula/dvtm) via homebrew
## Why dvtm? The philosophy behind
dvtm strives to adhere to the
[Unix philosophy](http://www.catb.org/esr/writings/taoup/html/ch01s06.html).
It tries to do one thing, *dynamic* window management on the console,
and to do it well.
As such dvtm does *not* implement [session management](#faq) but instead
delegates this task to a separate tool called
[abduco](http://www.brain-dump.org/projects/abduco/).
Similarly dvtm's copy mode is implemented by piping the scroll back buffer
content to an external editor and only storing whatever the editor writes
to `stdout`. Hence the selection process is delegated to the editor
where powerful features such as regular expression search are available.
As a result dvtm's source code is relatively small
([~4000 lines of C](http://www.ohloh.net/p/dvtm/analyses/latest/languages_summary)),
simple and therefore easy to hack on.
## Quickstart
All of dvtm keybindings start with a common modifier which from now
on is refered to as `MOD`. By default `MOD` is set to `CTRL+g` however
this can be changed at runttime with the `-m` command line option.
For example setting `MOD` to `CTRL-b` is accomplished by starting
`dvtm -m ^b`.
### Windows
New windows are created with `MOD+c` and closed with `MOD+x`.
To switch among the windows use `MOD+j` and `MOD+k` or `MOD+[1..9]`
where the digit corresponds to the window number which is displayed
in the title bar. Windows can be minimized and restored with `MOD+.`.
Input can be directed to all visible window by pressing `MOD+a`,
issuing the same key combination again restores normal behaviour
i.e. only the currently focused window will receive input.
### Layouts
Visible Windows are arranged by a layout. Each layout consists of a
master and a tile area. Typically the master area occupies the largest
part of the screen and is intended for the currently most important
window. The size of the master area can be shrunk with `MOD+h`
and enlarged with `MOD-l` respectively. Windows can be zoomed into
the master area with `MOD+Enter`. The number of windows in the
master area can be increased and decreased with `MOD+i` and `MOD+d`.
By default dvtm comes with 4 different layouts which can be cycled
through via `MOD+Space`
* vertical stack: master area on the left half, other clients
stacked on the right
* bottom stack: master area on the top half, other clients stacked below
* grid: every window gets an equally sized portion of the screen
* fullscreen: only the selected window is shown and occupies the
whole available display area `MOD+m`
Further layouts are included in the source tarball but disabled by
default.
### Tagging
Each window has a non empty set of tags [1..n] associated with it. A view
consists of a number of tags. The current view includes all windows
which are tagged with the currently active tags. The following key
bindings are used to manipulate the tagsets.
- `MOD-0` view all windows with any tag
- `Mod-v-Tab` toggles to the previously selected tags
- `MOD-v-[1..n]` view all windows with nth tag
- `Mod-V-[1..n]` add/remove all windows with nth tag to/from the view
- `Mod-t-[1..n]` apply nth tag to focused window
- `Mod-T-[1..n]` add/remove nth tag to/from focused window
### Statusbar
dvtm can be instructed to read and display status messages from a named
pipe. As an example the `dvtm-status` script is provided which shows the
current time.
#!/bin/sh
FIFO="/tmp/dvtm-status.$$"
[ -p "$FIFO" ] || mkfifo -m 600 "$FIFO" || exit 1
while true; do
date +%H:%M
sleep 60
done > "$FIFO" &
STATUS_PID=$!
dvtm -s "$FIFO" "$@" 2> /dev/null
kill $STATUS_PID
wait $STATUS_PID 2> /dev/null
rm -f "$FIFO"
### Copymode ###
`MOD+e` pipes the whole scroll buffer content to an external editor.
What ever the editor writes to `stdout` is remembered by dvtm and can
later be pasted with `MOD+p`.
In order for this to work the editor needs to be usable as a filter
and should use `stderr` for its user interface. Examples where this is
the case include [sandy](http://tools.suckless.org/sandy) and
[vis](http://github.com/martanne/vis).
$ echo Hello World | vis - | cat
## Patches
There exist a number of out of tree patches which customize dvtm's
behaviour:
- [pertag](http://waxandwane.org/dvtm.html) (see also the corresponding
[mailing list post](http://lists.suckless.org/hackers/1510/8186.html))
## FAQ
### Detach / reattach functionality
dvtm doesn't have session support built in. Use
[abduco](http://www.brain-dump.org/projects/abduco/) instead.
$ abduco -c dvtm-session
Detach using `CTRL-\` and later reattach with
$ abduco -a dvtm-session
### Copy / Paste does not work under X
If you have mouse support enabled, which is the case with the
default settings, you need to hold down shift while selecting
and inserting text. In case you don't like this behaviour either
run dvtm with the `-M` command line argument, disable it at run
time with `MOD+M` or modify `config.def.h` to disable it completely
at compile time. You will however no longer be able to perform
other mouse actions like selecting windows etc.
### How to change the key bindings?
The configuration of dvtm is done by creating a custom `config.h`
and (re)compiling the source code. See the default `config.def.h`
as an example, adapting it to your preference should be straightforward.
You basically define a set of layouts and keys which dvtm will use.
There are some pre defined macros to ease configuration.
### WARNING: terminal is not fully functional
This means you haven't installed the `dvtm.info` terminfo description
which can be done with `tic -s dvtm.info`. If for some reason you
can't install new terminfo descriptions set the `DVTM_TERM` environment
variable to a known terminal when starting `dvtm` as in
$ DVTM_TERM=rxvt dvtm
This will instruct dvtm to use rxvt as `$TERM` value within its windows.
### How to set the window title?
The window title can be changed by means of a
[xterm extension](http://tldp.org/HOWTO/Xterm-Title-3.html#ss3.2)
terminal escape sequence
$ echo -ne "\033]0;Your title here\007"
So for example in `bash` if you want to display the current working
directory in the window title this can be accomplished by means of
the following section in your startup files.
# If this is an xterm set the title to user@host:dir
case "$TERM" in
dvtm*|xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
;;
*)
;;
esac
Other shells provide similar functionality, zsh as an example has a
[precmd function](http://zsh.sourceforge.net/Doc/Release/Functions.html#Hook-Functions)
which can be used to achieve the same effect.
### Something is wrong with the displayed colors
Make sure you have set `$TERM` correctly for example if you want to
use 256 color profiles you probably have to append `-256color` to
your regular terminal name. Also due to limitations of ncurses by
default you can only use 255 color pairs simultaneously. If you
need more than 255 different color pairs at the same time, then you
have to rebuild ncurses with
$ ./configure ... --enable-ext-colors
Note that this changes the ABI and therefore sets SONAME of the
library to 6 (i.e. you have to link against `libncursesw.so.6`).
### Some characters are displayed like garbage
Make sure you compiled dvtm against a unicode aware curses library
(in case of ncurses this would be `libncursesw`). Also make sure
that your locale settings contain UTF-8.
### The numeric keypad does not work with Putty
Disable [application keypad mode](http://the.earth.li/~sgtatham/putty/0.64/htmldoc/Chapter4.html#config-features-application)
in the Putty configuration under `Terminal => Features => Disable application keypad mode`.
### Unicode characters do not work within Putty
You have to tell Putty in which
[character encoding](http://the.earth.li/~sgtatham/putty/0.64/htmldoc/Chapter4.html#config-translation)
the received data is. Set the dropdown box under `Window => Translation`
to UTF-8. In order to get proper line drawing characters you proabably
also want to set the TERM environment variable to `putty` or `putty-256color`.
If that still doesn't do the trick then try running dvtm with the
following ncurses related environment variable set `NCURSES_NO_UTF8_ACS=1`.
## Development
You can always fetch the current code base from the git repository.
git clone https://github.com/martanne/dvtm.git
or
git clone git://repo.or.cz/dvtm.git
If you have comments, suggestions, ideas, a bug report, a patch or something
else related to abduco then write to the
[suckless developer mailing list](http://suckless.org/community)
or contact me directly mat[at]brain-dump.org.
[![Build Status](https://travis-ci.org/martanne/dvtm.svg?branch=master)](https://travis-ci.org/martanne/dvtm)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/4256/badge.svg)](https://scan.coverity.com/projects/4256)
## License
dvtm reuses some code of dwm and is released under the same
[MIT/X11 license](https://raw.githubusercontent.com/martanne/dvtm/master/LICENSE).
The terminal emulation part is licensed under the ISC license.

58
system/dvtm/bstack.c Normal file
View File

@ -0,0 +1,58 @@
static void bstack(void)
{
unsigned int i, n, nx, ny, nw, nh, m, mw, mh, tw;
Client *c;
for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next))
if (!c->minimized)
n++;
m = MAX(1, MIN(n, screen.nmaster));
mh = n == m ? wah : screen.mfact * wah;
mw = waw / m;
tw = n == m ? 0 : waw / (n - m);
nx = wax;
ny = way;
for (i = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) {
if (c->minimized)
continue;
if (i < m) { /* master */
if (i > 0) {
mvvline(ny, nx, ACS_VLINE, nh);
mvaddch(ny, nx, ACS_TTEE);
nx++;
}
nh = mh;
nw = (i < m - 1) ? mw : (wax + waw) - nx;
} else { /* tile window */
if (i == m) {
nx = wax;
ny += mh;
nh = (way + wah) - ny;
}
if (i > m) {
mvvline(ny, nx, ACS_VLINE, nh);
mvaddch(ny, nx, ACS_TTEE);
nx++;
}
nw = (i < n - 1) ? tw : (wax + waw) - nx;
}
resize(c, nx, ny, nw, nh);
nx += nw;
i++;
}
/* Fill in nmaster intersections */
if (n > m) {
nx = wax;
for (i = 0; i < m; i++) {
if (i > 0) {
mvaddch(ny, nx, ACS_PLUS);
nx++;
}
nw = (i < m - 1) ? mw : (wax + waw) - nx;
nx += nw;
}
}
}

217
system/dvtm/config.def.h Normal file
View File

@ -0,0 +1,217 @@
/* valid curses attributes are listed below they can be ORed
*
* A_NORMAL Normal display (no highlight)
* A_STANDOUT Best highlighting mode of the terminal.
* A_UNDERLINE Underlining
* A_REVERSE Reverse video
* A_BLINK Blinking
* A_DIM Half bright
* A_BOLD Extra bright or bold
* A_PROTECT Protected mode
* A_INVIS Invisible or blank mode
*/
enum {
DEFAULT,
BLUE,
};
static Color colors[] = {
[DEFAULT] = { .fg = -1, .bg = -1, .fg256 = -1, .bg256 = -1, },
[BLUE] = { .fg = COLOR_BLUE, .bg = -1, .fg256 = 68, .bg256 = -1, },
};
#define COLOR(c) COLOR_PAIR(colors[c].pair)
/* curses attributes for the currently focused window */
#define SELECTED_ATTR (COLOR(BLUE) | A_NORMAL)
/* curses attributes for normal (not selected) windows */
#define NORMAL_ATTR (COLOR(DEFAULT) | A_NORMAL)
/* curses attributes for a window with pending urgent flag */
#define URGENT_ATTR NORMAL_ATTR
/* curses attributes for the status bar */
#define BAR_ATTR (COLOR(BLUE) | A_NORMAL)
/* characters for beginning and end of status bar message */
#define BAR_BEGIN '['
#define BAR_END ']'
/* status bar (command line option -s) position */
#define BAR_POS BAR_TOP /* BAR_BOTTOM, BAR_OFF */
/* whether status bar should be hidden if only one client exists */
#define BAR_AUTOHIDE true
/* master width factor [0.1 .. 0.9] */
#define MFACT 0.5
/* number of clients in master area */
#define NMASTER 1
/* scroll back buffer size in lines */
#define SCROLL_HISTORY 500
/* printf format string for the tag in the status bar */
#define TAG_SYMBOL "[%s]"
/* curses attributes for the currently selected tags */
#define TAG_SEL (COLOR(BLUE) | A_BOLD)
/* curses attributes for not selected tags which contain no windows */
#define TAG_NORMAL (COLOR(DEFAULT) | A_NORMAL)
/* curses attributes for not selected tags which contain windows */
#define TAG_OCCUPIED (COLOR(BLUE) | A_NORMAL)
/* curses attributes for not selected tags which with urgent windows */
#define TAG_URGENT (COLOR(BLUE) | A_NORMAL | A_BLINK)
const char tags[][8] = { "1", "2", "3", "4", "5" };
#include "tile.c"
#include "grid.c"
#include "bstack.c"
#include "fullscreen.c"
/* by default the first layout entry is used */
static Layout layouts[] = {
{ "[]=", tile },
{ "+++", grid },
{ "TTT", bstack },
{ "[ ]", fullscreen },
};
#define MOD CTRL('g')
#define TAGKEYS(KEY,TAG) \
{ { MOD, 'v', KEY, }, { view, { tags[TAG] } } }, \
{ { MOD, 't', KEY, }, { tag, { tags[TAG] } } }, \
{ { MOD, 'V', KEY, }, { toggleview, { tags[TAG] } } }, \
{ { MOD, 'T', KEY, }, { toggletag, { tags[TAG] } } },
/* you can at most specifiy MAX_ARGS (3) number of arguments */
static KeyBinding bindings[] = {
{ { MOD, 'c', }, { create, { NULL } } },
{ { MOD, 'C', }, { create, { NULL, NULL, "$CWD" } } },
{ { MOD, 'x', 'x', }, { killclient, { NULL } } },
{ { MOD, 'j', }, { focusnext, { NULL } } },
{ { MOD, 'J', }, { focusnextnm, { NULL } } },
{ { MOD, 'K', }, { focusprevnm, { NULL } } },
{ { MOD, 'k', }, { focusprev, { NULL } } },
{ { MOD, 'f', }, { setlayout, { "[]=" } } },
{ { MOD, 'g', }, { setlayout, { "+++" } } },
{ { MOD, 'b', }, { setlayout, { "TTT" } } },
{ { MOD, 'm', }, { setlayout, { "[ ]" } } },
{ { MOD, ' ', }, { setlayout, { NULL } } },
{ { MOD, 'i', }, { incnmaster, { "+1" } } },
{ { MOD, 'd', }, { incnmaster, { "-1" } } },
{ { MOD, 'h', }, { setmfact, { "-0.05" } } },
{ { MOD, 'l', }, { setmfact, { "+0.05" } } },
{ { MOD, '.', }, { toggleminimize, { NULL } } },
{ { MOD, 's', }, { togglebar, { NULL } } },
{ { MOD, 'S', }, { togglebarpos, { NULL } } },
{ { MOD, 'M', }, { togglemouse, { NULL } } },
{ { MOD, '\n', }, { zoom , { NULL } } },
{ { MOD, '\r', }, { zoom , { NULL } } },
{ { MOD, '1', }, { focusn, { "1" } } },
{ { MOD, '2', }, { focusn, { "2" } } },
{ { MOD, '3', }, { focusn, { "3" } } },
{ { MOD, '4', }, { focusn, { "4" } } },
{ { MOD, '5', }, { focusn, { "5" } } },
{ { MOD, '6', }, { focusn, { "6" } } },
{ { MOD, '7', }, { focusn, { "7" } } },
{ { MOD, '8', }, { focusn, { "8" } } },
{ { MOD, '9', }, { focusn, { "9" } } },
{ { MOD, '\t', }, { focuslast, { NULL } } },
{ { MOD, 'q', 'q', }, { quit, { NULL } } },
{ { MOD, 'a', }, { togglerunall, { NULL } } },
{ { MOD, CTRL('L'), }, { redraw, { NULL } } },
{ { MOD, 'r', }, { redraw, { NULL } } },
{ { MOD, 'e', }, { copymode, { NULL } } },
{ { MOD, '/', }, { copymode, { "/" } } },
{ { MOD, 'p', }, { paste, { NULL } } },
{ { MOD, KEY_PPAGE, }, { scrollback, { "-1" } } },
{ { MOD, KEY_NPAGE, }, { scrollback, { "1" } } },
{ { MOD, '?', }, { create, { "man dvtm", "dvtm help" } } },
{ { MOD, MOD, }, { send, { (const char []){MOD, 0} } } },
{ { KEY_SPREVIOUS, }, { scrollback, { "-1" } } },
{ { KEY_SNEXT, }, { scrollback, { "1" } } },
{ { MOD, '0', }, { view, { NULL } } },
{ { MOD, KEY_F(1), }, { view, { tags[0] } } },
{ { MOD, KEY_F(2), }, { view, { tags[1] } } },
{ { MOD, KEY_F(3), }, { view, { tags[2] } } },
{ { MOD, KEY_F(4), }, { view, { tags[3] } } },
{ { MOD, KEY_F(5), }, { view, { tags[4] } } },
{ { MOD, 'v', '0' }, { view, { NULL } } },
{ { MOD, 'v', '\t', }, { viewprevtag, { NULL } } },
{ { MOD, 't', '0' }, { tag, { NULL } } },
TAGKEYS( '1', 0)
TAGKEYS( '2', 1)
TAGKEYS( '3', 2)
TAGKEYS( '4', 3)
TAGKEYS( '5', 4)
};
static const ColorRule colorrules[] = {
{ "", A_NORMAL, &colors[DEFAULT] }, /* default */
};
/* possible values for the mouse buttons are listed below:
*
* BUTTON1_PRESSED mouse button 1 down
* BUTTON1_RELEASED mouse button 1 up
* BUTTON1_CLICKED mouse button 1 clicked
* BUTTON1_DOUBLE_CLICKED mouse button 1 double clicked
* BUTTON1_TRIPLE_CLICKED mouse button 1 triple clicked
* BUTTON2_PRESSED mouse button 2 down
* BUTTON2_RELEASED mouse button 2 up
* BUTTON2_CLICKED mouse button 2 clicked
* BUTTON2_DOUBLE_CLICKED mouse button 2 double clicked
* BUTTON2_TRIPLE_CLICKED mouse button 2 triple clicked
* BUTTON3_PRESSED mouse button 3 down
* BUTTON3_RELEASED mouse button 3 up
* BUTTON3_CLICKED mouse button 3 clicked
* BUTTON3_DOUBLE_CLICKED mouse button 3 double clicked
* BUTTON3_TRIPLE_CLICKED mouse button 3 triple clicked
* BUTTON4_PRESSED mouse button 4 down
* BUTTON4_RELEASED mouse button 4 up
* BUTTON4_CLICKED mouse button 4 clicked
* BUTTON4_DOUBLE_CLICKED mouse button 4 double clicked
* BUTTON4_TRIPLE_CLICKED mouse button 4 triple clicked
* BUTTON_SHIFT shift was down during button state change
* BUTTON_CTRL control was down during button state change
* BUTTON_ALT alt was down during button state change
* ALL_MOUSE_EVENTS report all button state changes
* REPORT_MOUSE_POSITION report mouse movement
*/
#ifdef NCURSES_MOUSE_VERSION
# define CONFIG_MOUSE /* compile in mouse support if we build against ncurses */
#endif
#define ENABLE_MOUSE true /* whether to enable mouse events by default */
#ifdef CONFIG_MOUSE
static Button buttons[] = {
{ BUTTON1_CLICKED, { mouse_focus, { NULL } } },
{ BUTTON1_DOUBLE_CLICKED, { mouse_fullscreen, { "[ ]" } } },
{ BUTTON2_CLICKED, { mouse_zoom, { NULL } } },
{ BUTTON3_CLICKED, { mouse_minimize, { NULL } } },
};
#endif /* CONFIG_MOUSE */
static Cmd commands[] = {
{ "create", { create, { NULL } } },
};
/* gets executed when dvtm is started */
static Action actions[] = {
{ create, { NULL } },
};
static char const * const keytable[] = {
/* add your custom key escape sequences */
};
/* editor to use for copy mode. If neither of DVTM_EDITOR, EDITOR and PAGER is
* set the first entry is chosen. Otherwise the array is consulted for supported
* options. A %d in argv is replaced by the line number at which the file should
* be opened. If filter is true the editor is expected to work even if stdout is
* redirected (i.e. not a terminal). If color is true then color escape sequences
* are generated in the output.
*/
static Editor editors[] = {
{ .name = "vis", .argv = { "vis", "+%d", "-", NULL }, .filter = true, .color = false },
{ .name = "sandy", .argv = { "sandy", "-d", "-", NULL }, .filter = true, .color = false },
{ .name = "dvtm-editor", .argv = { "dvtm-editor", "-", NULL }, .filter = true, .color = false },
{ .name = "vim", .argv = { "vim", "+%d", "-", NULL }, .filter = false, .color = false },
{ .name = "less", .argv = { "less", "-R", "+%d", NULL }, .filter = false, .color = true },
{ .name = "more", .argv = { "more", "+%d", NULL }, .filter = false, .color = false },
};

217
system/dvtm/config.h Normal file
View File

@ -0,0 +1,217 @@
/* valid curses attributes are listed below they can be ORed
*
* A_NORMAL Normal display (no highlight)
* A_STANDOUT Best highlighting mode of the terminal.
* A_UNDERLINE Underlining
* A_REVERSE Reverse video
* A_BLINK Blinking
* A_DIM Half bright
* A_BOLD Extra bright or bold
* A_PROTECT Protected mode
* A_INVIS Invisible or blank mode
*/
enum {
DEFAULT,
BLUE,
};
static Color colors[] = {
[DEFAULT] = { .fg = -1, .bg = -1, .fg256 = -1, .bg256 = -1, },
[BLUE] = { .fg = COLOR_BLUE, .bg = -1, .fg256 = 68, .bg256 = -1, },
};
#define COLOR(c) COLOR_PAIR(colors[c].pair)
/* curses attributes for the currently focused window */
#define SELECTED_ATTR (COLOR(BLUE) | A_NORMAL)
/* curses attributes for normal (not selected) windows */
#define NORMAL_ATTR (COLOR(DEFAULT) | A_NORMAL)
/* curses attributes for a window with pending urgent flag */
#define URGENT_ATTR NORMAL_ATTR
/* curses attributes for the status bar */
#define BAR_ATTR (COLOR(BLUE) | A_NORMAL)
/* characters for beginning and end of status bar message */
#define BAR_BEGIN '['
#define BAR_END ']'
/* status bar (command line option -s) position */
#define BAR_POS BAR_TOP /* BAR_BOTTOM, BAR_OFF */
/* whether status bar should be hidden if only one client exists */
#define BAR_AUTOHIDE true
/* master width factor [0.1 .. 0.9] */
#define MFACT 0.5
/* number of clients in master area */
#define NMASTER 1
/* scroll back buffer size in lines */
#define SCROLL_HISTORY 500
/* printf format string for the tag in the status bar */
#define TAG_SYMBOL "[%s]"
/* curses attributes for the currently selected tags */
#define TAG_SEL (COLOR(BLUE) | A_BOLD)
/* curses attributes for not selected tags which contain no windows */
#define TAG_NORMAL (COLOR(DEFAULT) | A_NORMAL)
/* curses attributes for not selected tags which contain windows */
#define TAG_OCCUPIED (COLOR(BLUE) | A_NORMAL)
/* curses attributes for not selected tags which with urgent windows */
#define TAG_URGENT (COLOR(BLUE) | A_NORMAL | A_BLINK)
const char tags[][8] = { "1", "2", "3", "4", "5" };
#include "tile.c"
#include "grid.c"
#include "bstack.c"
#include "fullscreen.c"
/* by default the first layout entry is used */
static Layout layouts[] = {
{ "[]=", tile },
{ "+++", grid },
{ "TTT", bstack },
{ "[ ]", fullscreen },
};
#define MOD CTRL('g')
#define TAGKEYS(KEY,TAG) \
{ { MOD, 'v', KEY, }, { view, { tags[TAG] } } }, \
{ { MOD, 't', KEY, }, { tag, { tags[TAG] } } }, \
{ { MOD, 'V', KEY, }, { toggleview, { tags[TAG] } } }, \
{ { MOD, 'T', KEY, }, { toggletag, { tags[TAG] } } },
/* you can at most specifiy MAX_ARGS (3) number of arguments */
static KeyBinding bindings[] = {
{ { MOD, 'c', }, { create, { NULL } } },
{ { MOD, 'C', }, { create, { NULL, NULL, "$CWD" } } },
{ { MOD, 'x', 'x', }, { killclient, { NULL } } },
{ { MOD, 'j', }, { focusnext, { NULL } } },
{ { MOD, 'J', }, { focusnextnm, { NULL } } },
{ { MOD, 'K', }, { focusprevnm, { NULL } } },
{ { MOD, 'k', }, { focusprev, { NULL } } },
{ { MOD, 'f', }, { setlayout, { "[]=" } } },
{ { MOD, 'g', }, { setlayout, { "+++" } } },
{ { MOD, 'b', }, { setlayout, { "TTT" } } },
{ { MOD, 'm', }, { setlayout, { "[ ]" } } },
{ { MOD, ' ', }, { setlayout, { NULL } } },
{ { MOD, 'i', }, { incnmaster, { "+1" } } },
{ { MOD, 'd', }, { incnmaster, { "-1" } } },
{ { MOD, 'h', }, { setmfact, { "-0.05" } } },
{ { MOD, 'l', }, { setmfact, { "+0.05" } } },
{ { MOD, '.', }, { toggleminimize, { NULL } } },
{ { MOD, 's', }, { togglebar, { NULL } } },
{ { MOD, 'S', }, { togglebarpos, { NULL } } },
{ { MOD, 'M', }, { togglemouse, { NULL } } },
{ { MOD, '\n', }, { zoom , { NULL } } },
{ { MOD, '\r', }, { zoom , { NULL } } },
{ { MOD, '1', }, { focusn, { "1" } } },
{ { MOD, '2', }, { focusn, { "2" } } },
{ { MOD, '3', }, { focusn, { "3" } } },
{ { MOD, '4', }, { focusn, { "4" } } },
{ { MOD, '5', }, { focusn, { "5" } } },
{ { MOD, '6', }, { focusn, { "6" } } },
{ { MOD, '7', }, { focusn, { "7" } } },
{ { MOD, '8', }, { focusn, { "8" } } },
{ { MOD, '9', }, { focusn, { "9" } } },
{ { MOD, '\t', }, { focuslast, { NULL } } },
{ { MOD, 'q', 'q', }, { quit, { NULL } } },
{ { MOD, 'a', }, { togglerunall, { NULL } } },
{ { MOD, CTRL('L'), }, { redraw, { NULL } } },
{ { MOD, 'r', }, { redraw, { NULL } } },
{ { MOD, 'e', }, { copymode, { NULL } } },
{ { MOD, '/', }, { copymode, { "/" } } },
{ { MOD, 'p', }, { paste, { NULL } } },
{ { MOD, KEY_PPAGE, }, { scrollback, { "-1" } } },
{ { MOD, KEY_NPAGE, }, { scrollback, { "1" } } },
{ { MOD, '?', }, { create, { "man dvtm", "dvtm help" } } },
{ { MOD, MOD, }, { send, { (const char []){MOD, 0} } } },
{ { KEY_SPREVIOUS, }, { scrollback, { "-1" } } },
{ { KEY_SNEXT, }, { scrollback, { "1" } } },
{ { MOD, '0', }, { view, { NULL } } },
{ { MOD, KEY_F(1), }, { view, { tags[0] } } },
{ { MOD, KEY_F(2), }, { view, { tags[1] } } },
{ { MOD, KEY_F(3), }, { view, { tags[2] } } },
{ { MOD, KEY_F(4), }, { view, { tags[3] } } },
{ { MOD, KEY_F(5), }, { view, { tags[4] } } },
{ { MOD, 'v', '0' }, { view, { NULL } } },
{ { MOD, 'v', '\t', }, { viewprevtag, { NULL } } },
{ { MOD, 't', '0' }, { tag, { NULL } } },
TAGKEYS( '1', 0)
TAGKEYS( '2', 1)
TAGKEYS( '3', 2)
TAGKEYS( '4', 3)
TAGKEYS( '5', 4)
};
static const ColorRule colorrules[] = {
{ "", A_NORMAL, &colors[DEFAULT] }, /* default */
};
/* possible values for the mouse buttons are listed below:
*
* BUTTON1_PRESSED mouse button 1 down
* BUTTON1_RELEASED mouse button 1 up
* BUTTON1_CLICKED mouse button 1 clicked
* BUTTON1_DOUBLE_CLICKED mouse button 1 double clicked
* BUTTON1_TRIPLE_CLICKED mouse button 1 triple clicked
* BUTTON2_PRESSED mouse button 2 down
* BUTTON2_RELEASED mouse button 2 up
* BUTTON2_CLICKED mouse button 2 clicked
* BUTTON2_DOUBLE_CLICKED mouse button 2 double clicked
* BUTTON2_TRIPLE_CLICKED mouse button 2 triple clicked
* BUTTON3_PRESSED mouse button 3 down
* BUTTON3_RELEASED mouse button 3 up
* BUTTON3_CLICKED mouse button 3 clicked
* BUTTON3_DOUBLE_CLICKED mouse button 3 double clicked
* BUTTON3_TRIPLE_CLICKED mouse button 3 triple clicked
* BUTTON4_PRESSED mouse button 4 down
* BUTTON4_RELEASED mouse button 4 up
* BUTTON4_CLICKED mouse button 4 clicked
* BUTTON4_DOUBLE_CLICKED mouse button 4 double clicked
* BUTTON4_TRIPLE_CLICKED mouse button 4 triple clicked
* BUTTON_SHIFT shift was down during button state change
* BUTTON_CTRL control was down during button state change
* BUTTON_ALT alt was down during button state change
* ALL_MOUSE_EVENTS report all button state changes
* REPORT_MOUSE_POSITION report mouse movement
*/
#ifdef NCURSES_MOUSE_VERSION
# define CONFIG_MOUSE /* compile in mouse support if we build against ncurses */
#endif
#define ENABLE_MOUSE true /* whether to enable mouse events by default */
#ifdef CONFIG_MOUSE
static Button buttons[] = {
{ BUTTON1_CLICKED, { mouse_focus, { NULL } } },
{ BUTTON1_DOUBLE_CLICKED, { mouse_fullscreen, { "[ ]" } } },
{ BUTTON2_CLICKED, { mouse_zoom, { NULL } } },
{ BUTTON3_CLICKED, { mouse_minimize, { NULL } } },
};
#endif /* CONFIG_MOUSE */
static Cmd commands[] = {
{ "create", { create, { NULL } } },
};
/* gets executed when dvtm is started */
static Action actions[] = {
{ create, { NULL } },
};
static char const * const keytable[] = {
/* add your custom key escape sequences */
};
/* editor to use for copy mode. If neither of DVTM_EDITOR, EDITOR and PAGER is
* set the first entry is chosen. Otherwise the array is consulted for supported
* options. A %d in argv is replaced by the line number at which the file should
* be opened. If filter is true the editor is expected to work even if stdout is
* redirected (i.e. not a terminal). If color is true then color escape sequences
* are generated in the output.
*/
static Editor editors[] = {
{ .name = "vis", .argv = { "vis", "+%d", "-", NULL }, .filter = true, .color = false },
{ .name = "sandy", .argv = { "sandy", "-d", "-", NULL }, .filter = true, .color = false },
{ .name = "dvtm-editor", .argv = { "dvtm-editor", "-", NULL }, .filter = true, .color = false },
{ .name = "vim", .argv = { "vim", "+%d", "-", NULL }, .filter = false, .color = false },
{ .name = "less", .argv = { "less", "-R", "+%d", NULL }, .filter = false, .color = true },
{ .name = "more", .argv = { "more", "+%d", NULL }, .filter = false, .color = false },
};

21
system/dvtm/config.mk Normal file
View File

@ -0,0 +1,21 @@
# dvtm version
VERSION = 0.15
# Customize below to fit your system
PREFIX ?= /freon
MANPREFIX = ${PREFIX}/share/man
# specify your systems terminfo directory
# leave empty to install into your home folder
TERMINFO := ${DESTDIR}${PREFIX}/share/terminfo
INCS = -I.
LIBS = -lc -lutil -lncursesw
CPPFLAGS = -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_XOPEN_SOURCE_EXTENDED
CFLAGS += -std=c99 ${INCS} -DVERSION=\"${VERSION}\" -DNDEBUG ${CPPFLAGS}
LDFLAGS += ${LIBS}
DEBUG_CFLAGS = ${CFLAGS} -UNDEBUG -O0 -g -ggdb -Wall -Wextra -Wno-unused-parameter
CC ?= cc
STRIP ?= strip

16
system/dvtm/dvtm-status Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
FIFO="/tmp/dvtm-status.$$"
[ -p "$FIFO" ] || mkfifo -m 600 "$FIFO" || exit 1
while true; do
date +%H:%M
sleep 60
done > "$FIFO" &
STATUS_PID=$!
dvtm -s "$FIFO" "$@" 2> /dev/null
kill $STATUS_PID
wait $STATUS_PID 2> /dev/null
rm -f "$FIFO"

283
system/dvtm/dvtm.1 Normal file
View File

@ -0,0 +1,283 @@
.TH DVTM 1 dvtm\-VERSION
.nh
.SH NAME
dvtm \- dynamic virtual terminal manager
.SH SYNOPSIS
.B dvtm
.RB [ \-v ]
.RB [ \-M ]
.RB [ \-m
.IR modifier ]
.RB [ \-d
.IR delay ]
.RB [ \-h
.IR lines ]
.RB [ \-t
.IR title ]
.RB [ \-s
.IR status-fifo ]
.RB [ \-c
.IR cmd-fifo ]
.RI [ command \ ... "" ]
.SH DESCRIPTION
dvtm is a dynamic tiling window manager for the console.
As a console window manager it tries to make it easy to work with multiple
console based applications.
.SH OPTIONS
.TP
.B \-v
Print version information to standard output and exit.
.TP
.B \-M
Toggle default mouse grabbing upon startup. Use this to allow normal mouse operation
under X.
.TP
.BI \-m \ modifier
Set command modifier at runtime.
.TP
.BI \-d \ delay
Set the delay ncurses waits before deciding if a character that might be
part of an escape sequence is actually part of an escape sequence.
.TP
.BI \-h \ lines
Set the scrollback history buffer size at runtime.
.TP
.BI \-t \ title
Set a static terminal
.I title
and don't change it to the one of the currently focused window.
.TP
.BI \-s \ status-fifo
Open or create the named pipe
.I status-fifo
read its content and display it in the statusbar. See the
.I dvtm-status
script for an usage example.
.TP
.BI \-c \ cmd-fifo
Open or create the named pipe
.I cmd-fifo
and look for commands to execute which were defined in
.IR config.h .
.TP
.IR command \ ...
Execute
.IR command (s),
each in a separate window.
.SH USAGE
.SS Keyboard commands
.TP
.B Mod
Each keybinding begins with Mod which defaults to
.BR ^g ,
but can be changed in
.I config.h
or with the
.B \-m
command line option.
.TP
.B Mod\-c
Create a new shell window.
.TP
.B Mod\-C
Create a new shell window using the current working directory of the focused window.
.TP
.B Mod\-x\-x
Close focused window.
.TP
.B Mod\-l
Increases the master area width about 5% (all except grid and
fullscreen layout).
.TP
.B Mod\-h
Decreases the master area width about 5% (all except grid and
fullscreen layout).
.TP
.B Mod\-i
Increase number of windows displayed in the master area.
.TP
.B Mod\-d
Decrease number of windows displayed in the master area.
.TP
.B Mod\-j
Focus next window.
.TP
.B Mod\-k
Focus previous window.
.TP
.B Mod\-J
Focus next non minimized window.
.TP
.B Mod\-K
Focus previous non minimized window.
.TP
.BI Mod\- n
Focus the
.IR n \-th
window.
.TP
.B Mod\-Tab
Focus previously selected window.
.TP
.B Mod\-.
Toggle minimization of current window.
.TP
.B Mod\-m
Maximize current window (change to fullscreen layout).
.TP
.B Shift\-PageUp
.TQ
.B Mod\-PageUp
Scroll up.
.TP
.B Shift\-PageDown
.TQ
.B Mod\-PageDown
Scroll down.
.TP
.B Mod\-Space
Toggle between defined layouts (affects all windows).
.TP
.B Mod\-Enter
Zooms/cycles current window to/from master area.
.TP
.B Mod\-f
Change to vertical stack tiling layout.
.TP
.B Mod\-b
Change to bottom stack tiling layout.
.TP
.B Mod\-g
Change to grid layout.
.TP
.B Mod\-s
Show/hide the status bar.
.TP
.B Mod\-S
Toggle position of the status bar between top and bottom.
.TP
.B Mod\-r
.TQ
.B Mod\-^L
Redraw whole screen.
.TP
.B Mod\-a
Toggle keyboard multiplexing mode, if activated keypresses are sent to all
visible windows.
.TP
.B Mod\-M
Toggle dvtm mouse grabbing.
.TP
.B Mod\-e
Enter copy mode (see section below for further information).
.TP
.B Mod\-/
Enter copy mode and start searching forward (assumes a vi-like editor).
.TP
.B Mod\-p
Paste last copied text from copy mode at current cursor position.
.TP
.B Mod\-?
Show this manual page.
.TP
.B Mod\-Mod
Send the Mod key.
.TP
.B Mod-F[1..n]
.TQ
.B Mod-v-[1..n]
View all windows with nth tag.
.TP
.B Mod-0
View all windows with any tag.
.TP
.B Mod-v-Tab
Toggles to the previously selected tags.
.TP
.B Mod-V-[1..n]
Add/remove all windows with nth tag to/from the view.
.TP
.B Mod-t-[1..n]
Apply nth tag to focused window.
.TP
.B Mod-T-[1..n]
Add/remove nth tag to/from focused window.
.TP
.B Mod\-q\-q
Quit dvtm.
.SS Mouse commands
.TP
.B Copy and Paste
By default dvtm captures mouse events to provide the actions listed below.
Unfortunately this interferes with the standard X copy and paste mechanism.
To work around this you need to hold down
.B Shift
while selecting or pasting text.
Alternatively you can disable mouse support at compile time, start dvtm with the
.B -M
flag or toggle mouse support during runtime with
.BR Mod\-M .
.TP
.B Button1 click
Focus window.
.TP
.B Button1 double click
Focus window and toggle maximization.
.TP
.B Button2 click
Zoom/cycle current window to/from master area.
.TP
.B Button3 click
Toggle minimization of current window.
.SS Copy mode
Copy mode gives easy access to past output by piping it to an editor. What
ever the editor prints to stdout upon exiting will be stored in an internal
register and can be pasted into other clients (via
.B Mod\-p
)
.SH ENVIRONMENT VARIABLES
.TP
.B DVTM
Each process spawned by dvtm will have this variable set to the dvtm version
it is running under.
.TP
.B DVTM_WINDOW_ID
Each process also has access to its constant and unique window id.
.TP
.B DVTM_CMD_FIFO
If the -c command line argument was specified upon dvtm startup, this variable
will be set to the file name of the named pipe. Thus allowing the process
to send commands back to dvtm.
.TP
.B DVTM_TERM
By default dvtm uses its own terminfo file and therefore sets
.BR TERM=dvtm
within the client windows. This can be overridden by setting the
.BR DVTM_TERM
environment variable to a valid terminal name before launching dvtm.
.TP
.B DVTM_EDITOR
When entering the copymode dvtm pipes the whole scroll back buffer to
.BR DVTM_EDITOR
which is launched with
.BR \-
(indicating to read from stdin) as its only argument.
If
.BR DVTM_EDITOR
is not set
.BR EDITOR
is checked, if this is also not set the default value specified in
.BR config.h
is used instead.
.SH EXAMPLE
See the
.I dvtm-status
script as an example of how to display text in the
status bar.
.SH CUSTOMIZATION
dvtm is customized by creating a custom
.I config.h
and (re)compiling the source code.
This keeps it fast, secure and simple.
.SH AUTHOR
dvtm is written by Marc André Tanner <mat at brain-dump.org>

1841
system/dvtm/dvtm.c Normal file

File diff suppressed because it is too large Load Diff

136
system/dvtm/dvtm.info Normal file
View File

@ -0,0 +1,136 @@
dvtm|dynamic virtual terminal manager,
am,
eo,
mir,
msgr,
xenl,
colors#8,
cols#80,
it#8,
lines#24,
ncv@,
pairs#64,
acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G,
blink=\E[5m,
bold=\E[1m,
civis=\E[?25l,
clear=\E[H\E[2J,
cnorm=\E[?25h,
cr=^M,
csr=\E[%i%p1%d;%p2%dr,
cub=\E[%p1%dD,
cub1=^H,
cud=\E[%p1%dB,
cud1=^J,
cuf=\E[%p1%dC,
cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH,
cuu=\E[%p1%dA,
cuu1=\E[A,
dl=\E[%p1%dM,
dl1=\E[M,
ed=\E[J,
el=\E[K,
el1=\E[1K,
enacs=\E(B\E)0,
home=\E[H,
hpa=\E[%i%p1%dG,
ht=^I,
hts=\EH,
ich=\E[%p1%d@,
ich1=\E[@,
il=\E[%p1%dL,
il1=\E[L,
ind=^J,
is1=\E[?47l\E=\E[?1l,
is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l,
kDC=\E[3$,
kEND=\E[8$,
kHOM=\E[7$,
kIC=\E[2$,
kLFT=\E[d,
kNXT=\E[6$,
kPRV=\E[5$,
kRIT=\E[c,
ka1=\EOw,
ka3=\EOy,
kb2=\EOu,
kbs=\177,
kc1=\EOq,
kc3=\EOs,
kcbt=\E[Z,
kcub1=\E[D,
kcud1=\E[B,
kcuf1=\E[C,
kcuu1=\E[A,
kdch1=\E[3~,
kel=\E[8\^,
kend=\E[8~,
kent=\EOM,
kf0=\E[21~,
kf1=\E[11~,
kf2=\E[12~,
kf3=\E[13~,
kf4=\E[14~,
kf5=\E[15~,
kf6=\E[17~,
kf7=\E[18~,
kf8=\E[19~,
kf9=\E[20~,
kf10=\E[21~,
kf11=\E[23~,
kf12=\E[24~,
kf13=\E[25~,
kf14=\E[26~,
kf15=\E[28~,
kf16=\E[29~,
kf17=\E[31~,
kf18=\E[32~,
kf19=\E[33~,
kf20=\E[34~,
kf21=\E[23$,
kf22=\E[24$
kfnd=\E[1~,
khome=\E[7~,
kich1=\E[2~,
kind=\E[a,
kmous=\E[M,
knp=\E[6~,
kpp=\E[5~,
kri=\E[b,
kslt=\E[4~,
op=\E[39;49m,
rc=\E8,
rev=\E[7m,
ri=\EM,
ritm=\E[23m,
rmacs=^O,
rmcup=\E[2J\E[?47l\E8,
rmir=\E[4l,
rmso=\E[27m,
rmul=\E[24m,
rs1=\E>\E[?1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H,
rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h,
s0ds=\E(B,
s1ds=\E(0,
sc=\E7,
setab=\E[4%p1%dm,
setaf=\E[3%p1%dm,
sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;,
sgr0=\E[m\017,
sitm=\E[3m,
smacs=^N,
smcup=\E7\E[?47h,
smir=\E[4h,
smso=\E[7m,
smul=\E[4m,
tbc=\E[3g,
vpa=\E[%i%p1%dd,
dvtm-256color|dynamic virtual terminal manager with 256 colors,
use=dvtm,
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,

94
system/dvtm/fibonacci.c Normal file
View File

@ -0,0 +1,94 @@
static void fibonacci(int s)
{
unsigned int nx, ny, nw, nnw, nh, nnh, i, n, mod;
Client *c;
for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next))
if (!c->minimized)
n++;
/* initial position and dimensions */
nx = wax;
ny = way;
nw = (n == 1) ? waw : screen.mfact * waw;
/* don't waste space dviding by 2 doesn't work for odd numbers
* plus we need space for the border too. therefore set up these
* variables for the next new width/height
*/
nnw = waw - nw - 1;
nnh = nh = wah;
/* set the mod factor, 2 for dwindle, 4 for spiral */
mod = s ? 4 : 2;
for (i = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) {
if (c->minimized)
continue;
/* dwindle: even case, spiral: case 0 */
if (i % mod == 0) {
if (i) {
if (s) {
nh = nnh;
ny -= nh;
} else {
ny += nh;
nh = nnh;
}
/* don't adjust the width for the last client */
if (i < n - 1) {
nw /= 2;
nnw -= nw + 1;
}
mvaddch(ny, nx - 1, ACS_LTEE);
}
} else if (i % mod == 1) { /* dwindle: odd case, spiral: case 1 */
nx += nw;
mvvline(ny, nx, ACS_VLINE, nh);
mvaddch(ny, nx, ACS_TTEE);
++nx;
nw = nnw;
/* don't adjust the height for the last client */
if (i < n - 1) {
nh /= 2;
nnh -= nh;
}
} else if (i % mod == 2 && s) { /* spiral: case 2 */
ny += nh;
nh = nnh;
/* don't adjust the width for the last client */
if (i < n - 1) {
nw /= 2;
nnw -= nw + 1;
nx += nnw;
mvvline(ny, nx, ACS_VLINE, nh);
mvaddch(ny, nx, ACS_TTEE);
++nx;
} else {
mvaddch(ny, nx - 1, ACS_LTEE);
}
} else if (s) { /* spiral: case 3 */
nw = nnw;
nx -= nw + 1; /* border */
/* don't adjust the height for the last client */
if (i < n - 1) {
nh /= 2;
nnh -= nh;
ny += nnh;
}
mvaddch(ny, nx - 1, ACS_LTEE);
}
resize(c, nx, ny, nw, nh);
i++;
}
}
static void spiral(void)
{
fibonacci(1);
}
static void dwindle(void)
{
fibonacci(0);
}

96
system/dvtm/forkpty-aix.c Normal file
View File

@ -0,0 +1,96 @@
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
* Copyright (c) 2012 Ross Palmer Mohn <rpmohn@waxandwane.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stropts.h>
#include <unistd.h>
#include <paths.h>
pid_t forkpty(int *master, char *name, struct termios *tio, struct winsize *ws)
{
int slave, fd;
char *path;
pid_t pid;
struct termios tio2;
if ((*master = open("/dev/ptc", O_RDWR|O_NOCTTY)) == -1)
return -1;
if ((path = ttyname(*master)) == NULL)
goto out;
if ((slave = open(path, O_RDWR|O_NOCTTY)) == -1)
goto out;
switch (pid = fork()) {
case -1:
goto out;
case 0:
close(*master);
fd = open(_PATH_TTY, O_RDWR|O_NOCTTY);
if (fd >= 0) {
ioctl(fd, TIOCNOTTY, NULL);
close(fd);
}
setsid();
fd = open(_PATH_TTY, O_RDWR|O_NOCTTY);
if (fd >= 0)
return -1;
fd = open(path, O_RDWR);
if (fd < 0)
return -1;
close(fd);
fd = open("/dev/tty", O_WRONLY);
if (fd < 0)
return -1;
close(fd);
if (tcgetattr(slave, &tio2) != 0)
return -1;
if (tio != NULL)
memcpy(tio2.c_cc, tio->c_cc, sizeof tio2.c_cc);
tio2.c_cc[VERASE] = '\177';
if (tcsetattr(slave, TCSAFLUSH, &tio2) == -1)
return -1;
if (ioctl(slave, TIOCSWINSZ, ws) == -1)
return -1;
dup2(slave, 0);
dup2(slave, 1);
dup2(slave, 2);
if (slave > 2)
close(slave);
return 0;
}
close(slave);
return pid;
out:
if (*master != -1)
close(*master);
if (slave != -1)
close(slave);
return -1;
}

View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdlib.h>
#include <strings.h>
#include <stropts.h>
#include <unistd.h>
#ifndef TTY_NAME_MAX
#define TTY_NAME_MAX TTYNAME_MAX
#endif
pid_t forkpty(int *master, char *name, struct termios *tio, struct winsize *ws)
{
int slave;
char *path;
pid_t pid;
if ((*master = open("/dev/ptmx", O_RDWR|O_NOCTTY)) == -1)
return -1;
if (grantpt(*master) != 0)
goto out;
if (unlockpt(*master) != 0)
goto out;
if ((path = ptsname(*master)) == NULL)
goto out;
if (name != NULL)
strlcpy(name, path, TTY_NAME_MAX);
if ((slave = open(path, O_RDWR|O_NOCTTY)) == -1)
goto out;
switch (pid = fork()) {
case -1:
goto out;
case 0:
close(*master);
setsid();
#ifdef TIOCSCTTY
if (ioctl(slave, TIOCSCTTY, NULL) == -1)
return -1;
#endif
if (ioctl(slave, I_PUSH, "ptem") == -1)
return -1;
if (ioctl(slave, I_PUSH, "ldterm") == -1)
return -1;
if (tio != NULL && tcsetattr(slave, TCSAFLUSH, tio) == -1)
return -1;
if (ioctl(slave, TIOCSWINSZ, ws) == -1)
return -1;
dup2(slave, 0);
dup2(slave, 1);
dup2(slave, 2);
if (slave > 2)
close(slave);
return 0;
}
close(slave);
return pid;
out:
if (*master != -1)
close(*master);
if (slave != -1)
close(slave);
return -1;
}

5
system/dvtm/fullscreen.c Normal file
View File

@ -0,0 +1,5 @@
static void fullscreen(void)
{
for (Client *c = nextvisible(clients); c; c = nextvisible(c->next))
resize(c, wax, way, waw, wah);
}

50
system/dvtm/grid.c Normal file
View File

@ -0,0 +1,50 @@
static void grid(void)
{
unsigned int i, n, nx, ny, nw, nh, aw, ah, cols, rows;
Client *c;
for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next))
if (!c->minimized)
n++;
/* grid dimensions */
for (cols = 0; cols <= n / 2; cols++)
if (cols * cols >= n)
break;
rows = (cols && (cols - 1) * cols >= n) ? cols - 1 : cols;
/* window geoms (cell height/width) */
nh = wah / (rows ? rows : 1);
nw = waw / (cols ? cols : 1);
for (i = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) {
if (c->minimized)
continue;
/* if there are less clients in the last row than normal adjust the
* split rate to fill the empty space */
if (rows > 1 && i == (rows * cols) - cols && (n - i) <= (n % cols))
nw = waw / (n - i);
nx = (i % cols) * nw + wax;
ny = (i / cols) * nh + way;
/* adjust height/width of last row/column's windows */
ah = (i >= cols * (rows - 1)) ? wah - nh * rows : 0;
/* special case if there are less clients in the last row */
if (rows > 1 && i == n - 1 && (n - i) < (n % cols))
/* (n % cols) == number of clients in the last row */
aw = waw - nw * (n % cols);
else
aw = ((i + 1) % cols == 0) ? waw - nw * cols : 0;
if (i % cols) {
mvvline(ny, nx, ACS_VLINE, nh + ah);
/* if we are on the first row, or on the last one and there are fewer clients
* than normal whose border does not match the line above, print a top tree char
* otherwise a plus sign. */
if (i <= cols
|| (i >= rows * cols - cols && n % cols
&& (cols - (n % cols)) % 2))
mvaddch(ny, nx, ACS_TTEE);
else
mvaddch(ny, nx, ACS_PLUS);
nx++, aw--;
}
resize(c, nx, ny, nw + aw, nh + ah);
i++;
}
}

63
system/dvtm/testsuite.sh Executable file
View File

@ -0,0 +1,63 @@
#!/bin/sh
MOD="" # CTRL+g
ESC="" # \e
DVTM="./dvtm"
DVTM_EDITOR="vis"
LOG="dvtm.log"
TEST_LOG="$0.log"
UTF8_TEST_URL="http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt"
[ ! -z "$1" ] && DVTM="$1"
[ ! -x "$DVTM" ] && echo "usage: $0 path-to-dvtm-binary" && exit 1
dvtm_input() {
printf "$1"
}
dvtm_cmd() {
printf "${MOD}$1\n"
sleep 1
}
sh_cmd() {
printf "$1\n"
sleep 1
}
test_copymode() { # requires wget, diff, vis
local FILENAME="UTF-8-demo.txt"
local COPY="$FILENAME.copy"
[ ! -e "$FILENAME" ] && (wget "$UTF8_TEST_URL" -O "$FILENAME" > /dev/null 2>&1 || return 1)
sleep 1
sh_cmd "cat $FILENAME"
dvtm_cmd 'e'
dvtm_input "?UTF-8 encoded\n"
dvtm_input '^kvG1k$'
dvtm_input ":wq\n"
sleep 1
rm -f "$COPY"
sh_cmd "vis $COPY"
dvtm_input 'i'
dvtm_cmd 'p'
dvtm_input "dd:wq\n"
while [ ! -r "$COPY" ]; do sleep 1; done;
dvtm_input "exit\n"
diff -u "$FILENAME" "$COPY" 1>&2
local RESULT=$?
rm -f "$COPY"
return $RESULT
}
if ! which vis > /dev/null 2>&1 ; then
echo "vis not found, skiping copymode test"
exit 0
fi
{
echo "Testing $DVTM" 1>&2
$DVTM -v 1>&2
test_copymode && echo "copymode: OK" 1>&2 || echo "copymode: FAIL" 1>&2;
} 2> "$TEST_LOG" | $DVTM -m ^g 2> $LOG
cat "$TEST_LOG" && rm "$TEST_LOG" $LOG

49
system/dvtm/tile.c Normal file
View File

@ -0,0 +1,49 @@
static void tile(void)
{
unsigned int i, n, nx, ny, nw, nh, m, mw, mh, th;
Client *c;
for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next))
if (!c->minimized)
n++;
m = MAX(1, MIN(n, screen.nmaster));
mw = n == m ? waw : screen.mfact * waw;
mh = wah / m;
th = n == m ? 0 : wah / (n - m);
nx = wax;
ny = way;
for (i = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) {
if (c->minimized)
continue;
if (i < m) { /* master */
nw = mw;
nh = (i < m - 1) ? mh : (way + wah) - ny;
} else { /* tile window */
if (i == m) {
ny = way;
nx += mw;
mvvline(ny, nx, ACS_VLINE, wah);
mvaddch(ny, nx, ACS_TTEE);
nx++;
nw = waw - mw -1;
}
nh = (i < n - 1) ? th : (way + wah) - ny;
if (i > m)
mvaddch(ny, nx - 1, ACS_LTEE);
}
resize(c, nx, ny, nw, nh);
ny += nh;
i++;
}
/* Fill in nmaster intersections */
if (n > m) {
ny = way + mh;
for (i = 1; i < m; i++) {
mvaddch(ny, nx - 1, ((ny - 1) % th ? ACS_RTEE : ACS_PLUS));
ny += mh;
}
}
}

45
system/dvtm/tstack.c Normal file
View File

@ -0,0 +1,45 @@
static void tstack(void)
{
unsigned int i, n, nx, ny, nw, nh, m, mw, mh, tw;
Client *c;
for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next))
if (!c->minimized)
n++;
m = MAX(1, MIN(n, screen.nmaster));
mh = n == m ? wah : screen.mfact * wah;
mw = waw / m;
tw = n == m ? 0 : waw / (n - m);
nx = wax;
ny = way + wah - mh;
for (i = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) {
if (c->minimized)
continue;
if (i < m) { /* master */
if (i > 0) {
mvvline(ny, nx, ACS_VLINE, nh);
mvaddch(ny, nx, ACS_TTEE);
nx++;
}
nh = mh;
nw = (i < m - 1) ? mw : (wax + waw) - nx;
} else { /* tile window */
if (i == m) {
nx = wax;
ny = way;
nh = (way + wah) - ny - mh;
}
if (i > m) {
mvvline(ny, nx, ACS_VLINE, nh);
mvaddch(ny, nx, ACS_TTEE);
nx++;
}
nw = (i < n - 1) ? tw : (wax + waw) - nx;
}
resize(c, nx, ny, nw, nh);
nx += nw;
i++;
}
}

27
system/dvtm/vstack.c Normal file
View File

@ -0,0 +1,27 @@
/* A vertical stack layout, all windows have the full screen width. */
static void vstack(void)
{
unsigned int i, n, ny, nh, m, mh, th;
Client *c;
for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next))
if (!c->minimized)
n++;
m = MAX(1, MIN(n, screen.nmaster));
mh = (n == m ? wah : screen.mfact * wah);
th = n == m ? 0 : (wah - mh) / (n - m);
ny = way;
for (i = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) {
if (c->minimized)
continue;
if (i < m) /* master */
nh = (i < m - 1) ? mh / m : (way + mh) - ny;
else /* tile window */
nh = (i < n - 1) ? th : (way + wah) - ny;
resize(c, wax, ny, waw, nh);
ny += nh;
i++;
}
}

1960
system/dvtm/vt.c Normal file

File diff suppressed because it is too large Load Diff

66
system/dvtm/vt.h Normal file
View File

@ -0,0 +1,66 @@
/*
* Copyright © 2004 Bruno T. C. de Oliveira
* Copyright © 2006 Pierre Habouzit
* Copyright © 2008-2013 Marc André Tanner
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef VT_H
#define VT_H
#include <curses.h>
#include <stdbool.h>
#include <sys/types.h>
#ifndef NCURSES_MOUSE_VERSION
#define mmask_t unsigned long
#endif
typedef struct Vt Vt;
typedef void (*vt_title_handler_t)(Vt*, const char *title);
typedef void (*vt_urgent_handler_t)(Vt*);
void vt_init(void);
void vt_shutdown(void);
void vt_keytable_set(char const * const keytable_overlay[], int count);
void vt_default_colors_set(Vt*, attr_t attrs, short fg, short bg);
void vt_title_handler_set(Vt*, vt_title_handler_t);
void vt_urgent_handler_set(Vt*, vt_urgent_handler_t);
void vt_data_set(Vt*, void *);
void *vt_data_get(Vt*);
Vt *vt_create(int rows, int cols, int scroll_buf_sz);
void vt_resize(Vt*, int rows, int cols);
void vt_destroy(Vt*);
pid_t vt_forkpty(Vt*, const char *p, const char *argv[], const char *cwd, const char *env[], int *to, int *from);
int vt_pty_get(Vt*);
bool vt_cursor_visible(Vt*);
int vt_process(Vt *);
void vt_keypress(Vt *, int keycode);
ssize_t vt_write(Vt*, const char *buf, size_t len);
void vt_mouse(Vt*, int x, int y, mmask_t mask);
void vt_dirty(Vt*);
void vt_draw(Vt*, WINDOW *win, int startrow, int startcol);
short vt_color_get(Vt*, short fg, short bg);
short vt_color_reserve(short fg, short bg);
void vt_scroll(Vt*, int rows);
void vt_noscroll(Vt*);
pid_t vt_pid_get(Vt*);
size_t vt_content_get(Vt*, char **s, bool colored);
int vt_content_start(Vt*);
#endif /* VT_H */