dot

packages and services management
Log | Files | Refs | README

commit 7237a1f8ccd18ac0f20a56d29a384cef422a11af
parent a50ed32b76c3582e155e9f9c876d20cbc93d1586
Author: josuah <mail@josuah.net>
Date:   Tue, 25 Oct 2016 20:43:01 -0400

Added a nice patch for dvtm.

Diffstat:
MBUILD/dvtm | 2+-
Mbin/config-build | 16++++++----------
Mdvtm/config.h | 192+++++++++++++++++++++++++++++++++++++------------------------------------------
Advtm/gaps.diff | 201+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 299 insertions(+), 112 deletions(-)

diff --git a/BUILD/dvtm b/BUILD/dvtm @@ -4,7 +4,7 @@ tar=http://github.com/martanne/dvtm/archive/master.tar.gz build() { - patch -p1 < "$CONFIG/$1/dvtm-focused-tags.diff" + patch -p1 < "$CONFIG/$1/gaps.diff" cp -f "$CONFIG/$1/config.h" . cp -f "$CONFIG/$1/dvtm-status" . diff --git a/bin/config-build b/bin/config-build @@ -55,6 +55,9 @@ compile() local PREFIX="$PROGRAMS/$name" local dirs='bin doc etc include lib libexec man share' + [ ! -f "$CONFIG/BUILD/$name" ] && error "$2 has no build script" + . "$CONFIG/BUILD/$name" + info "Installing $name" cd "$PREFIX" && mkdir -p $dirs @@ -67,7 +70,9 @@ download() local name="$1" tar="$2" local tmp="$(mktemp -u)" - [ -d "$PROGRAMS/$name/src" ] && error "'$name/src' already in $PROGRAMS" + [ -d "$PROGRAMS/$name/src" ] && error "$name/src already in $PROGRAMS" + [ ! -f "$CONFIG/BUILD/$name" ] && error "$2 has no build script" + . "$CONFIG/BUILD/$name" info "Downloading $tar" @@ -134,15 +139,6 @@ build() mkdir -p "$PROGRAMS" "$PREFIX" -#[ $# -lt 2 ] && help - -# Build script specific to the program, with build() and tar='...' -if [ "$2" ] -then - [ ! -f "$CONFIG/BUILD/$2" ] && error "$2 has no build script" - . "$CONFIG/BUILD/$2" -fi - case "$1" in d | download ) download "$2" "$tar" diff --git a/dvtm/config.h b/dvtm/config.h @@ -11,70 +11,68 @@ * A_INVIS Invisible or blank mode */ -enum { DEFAULT, BLACK, WARNING}; +enum { + DEFAULT, + BLUE, +}; static Color colors[] = { - [DEFAULT] = { .fg = -1, .bg = -1, .fg256 = -1, .bg256 = -1, }, - [BLACK] = { .fg = COLOR_BLACK, .bg = -1, .fg256 = 0, .bg256 = -1, }, - [WARNING] = { .fg = COLOR_RED, .bg = -1, .fg256 = 1, .bg256 = -1, }, + [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) +#define COLOR(c) COLOR_PAIR(colors[c].pair) /* curses attributes for the currently focused window */ -#define SELECTED_ATTR (COLOR(DEFAULT) | A_BOLD) +#define SELECTED_ATTR (COLOR(BLUE) | A_NORMAL) /* curses attributes for normal (not selected) windows */ -#define NORMAL_ATTR (COLOR(BLACK) | A_BOLD) +#define NORMAL_ATTR (COLOR(DEFAULT) | A_NORMAL) /* curses attributes for a window with pending urgent flag */ -#define URGENT_ATTR (COLOR(WARNING) | A_BLINK) +#define URGENT_ATTR NORMAL_ATTR /* curses attributes for the status bar */ -#define BAR_ATTR (COLOR(DEFAULT) | A_BOLD) -/* curses attributes for the currently selected tags */ -#define TAG_SEL (COLOR(DEFAULT) | A_BOLD | A_REVERSE) -/* curses attributes for not selected tags which contain no windows */ -#define TAG_NORMAL (COLOR(BLACK) | A_BOLD) -/* curses attributes for not selected tags which contain windows */ -#define TAG_OCCUPIED (COLOR(DEFAULT) | A_BOLD) -/* curses attributes for not selected tags which with urgent windows */ -#define TAG_URGENT (COLOR(WARNING) | A_BLINK | A_REVERSE) - +#define BAR_ATTR (COLOR(BLUE) | A_NORMAL) /* characters for beginning and end of status bar message */ -#define BAR_BEGIN ' ' -#define BAR_END ' ' -/* printf format string for the tag in the status bar */ -#define TAG_SYMBOL " %s " -#define TAG_SYMBOL_FOCUSED " %s " +#define BAR_BEGIN ' ' +#define BAR_END ' ' /* status bar (command line option -s) position */ -#define BAR_POS BAR_TOP /* BAR_BOTTOM, BAR_OFF */ +#define BAR_POS BAR_TOP /* BAR_BOTTOM, BAR_OFF */ /* whether status bar should be hidden if only one client exists */ -#define BAR_AUTOHIDE false - +#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 2000 +#define SCROLL_HISTORY 5000 +/* 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[][10] = { "1", "2", "3", "4 mail", "5 irc", }; +const char tags[][8] = { "1", "2", "3", "4", "5" }; #include "tile.c" +#include "grid.c" +#include "fullscreen.c" #include "bstack.c" #include "tstack.c" #include "vstack.c" #include "fibonacci.c" -#include "grid.c" -#include "fullscreen.c" /* by default the first layout entry is used */ static Layout layouts[] = { - { " | |-| f ", tile }, - { " |-,-| b ", bstack }, - { " |-'-| u ", tstack }, - { " |===| n ", vstack }, - { " | |@| o ", fibonacci }, - { " |-|-| g ", grid }, - { " | | m ", fullscreen }, + { "│├┤f", tile }, + { "├┼┤g", grid }, + { "├┬┤b", bstack }, + { "├┴┤u", tstack }, + { "├─┤n", vstack }, + { "│@│o", fibonacci }, + { "│ │m", fullscreen }, }; #define MOD CTRL(' ') @@ -82,54 +80,35 @@ static Layout layouts[] = { { { MOD, 'v', KEY, }, { view, { tags[TAG] } } }, \ { { MOD, 't', KEY, }, { tag, { tags[TAG] } } }, \ { { MOD, 'V', KEY, }, { toggleview, { tags[TAG] } } }, \ - { { MOD, 'T', KEY, }, { toggletag, { tags[TAG] } } }, \ - { { MOD, KEY_F(KEY), }, { view, { tags[TAG] } } }, + { { MOD, 'T', KEY, }, { toggletag, { tags[TAG] } } }, -/* you can at most specifiy MAX_ARGS (3) number of arguments */ +/* you can specifiy at most 3 arguments */ static KeyBinding bindings[] = { - - /* content */ - { { 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" } } }, - { { KEY_SPREVIOUS, }, { scrollback, { "-1" } } }, - { { KEY_SNEXT, }, { scrollback, { "1" } } }, - - /* interface */ - { { MOD, 's', }, { togglebar, { NULL } } }, - { { MOD, 'S', }, { togglebarpos, { NULL } } }, - { { MOD, 'M', }, { togglemouse, { NULL } } }, - { { MOD, MOD, }, { send, { (const char []){MOD, 0} } } }, - - /* open / close */ { { MOD, 'c', }, { create, { NULL } } }, { { MOD, 'C', }, { create, { NULL, NULL, "$CWD" } } }, - { { MOD, CTRL('c'), }, { create, { "run" } } }, - { { MOD, 'a', }, { create, { "attach" } } }, - { { MOD, '?', }, { create, { "man dvtm", "dvtm help" } } }, { { MOD, 'x', 'x', }, { killclient, { NULL } } }, - { { MOD, 'q', 'q', }, { quit, { NULL } } }, - - /* layouts */ - { { MOD, 'f', }, { setlayout, { " | |-| f " }, } }, - { { MOD, 'b', }, { setlayout, { " |-,-| b " }, } }, - { { MOD, 'u', }, { setlayout, { " |-'-| u " }, } }, - { { MOD, 'n', }, { setlayout, { " |===| n " }, } }, - { { MOD, 'o', }, { setlayout, { " | @ | o " }, } }, - { { MOD, 'g', }, { setlayout, { " |-|-| g " }, } }, - { { MOD, 'm', }, { setlayout, { " | | m " }, } }, + { { MOD, 'j', }, { focusnext, { NULL } } }, + { { MOD, 'J', }, { focusnextnm, { NULL } } }, + { { MOD, 'K', }, { focusprevnm, { NULL } } }, + { { MOD, 'k', }, { focusprev, { NULL } } }, + { { MOD, 'f', }, { setlayout, { "│├┤f" } } }, + { { MOD, 'g', }, { setlayout, { "├┼┤g" } } }, + { { MOD, 'b', }, { setlayout, { "├┬┤b" } } }, + { { MOD, 'u', }, { setlayout, { "├┴┤u" } } }, + { { MOD, 'n', }, { setlayout, { "├─┤n" } } }, + { { MOD, 'o', }, { setlayout, { "│@│o" } } }, + { { MOD, 'm', }, { setlayout, { "│ │m" } } }, { { MOD, ' ', }, { setlayout, { NULL } } }, { { MOD, 'i', }, { incnmaster, { "+1" } } }, { { MOD, 'd', }, { incnmaster, { "-1" } } }, { { MOD, 'h', }, { setmfact, { "-0.05" } } }, { { MOD, 'l', }, { setmfact, { "+0.05" } } }, - - /* windows */ - { { MOD, '0', }, { togglerunall, { NULL } } }, + { { 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" } } }, @@ -139,28 +118,34 @@ static KeyBinding bindings[] = { { { MOD, '7', }, { focusn, { "7" } } }, { { MOD, '8', }, { focusn, { "8" } } }, { { MOD, '9', }, { focusn, { "9" } } }, - { { MOD, '.', }, { toggleminimize, { NULL } } }, - { { MOD, '\n', }, { zoom, { NULL } } }, - { { MOD, '\r', }, { zoom, { NULL } } }, { { MOD, '\t', }, { focuslast, { NULL } } }, - { { MOD, 'j', }, { focusnext, { NULL } } }, - { { MOD, 'J', }, { focusnextnm, { NULL } } }, - { { MOD, 'K', }, { focusprevnm, { NULL } } }, - { { MOD, 'k', }, { focusprev, { NULL } } }, - - /* tags */ + { { 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, 'v', '0', }, { view, { NULL } } }, { { MOD, 't', '0' }, { tag, { NULL } } }, - TAGKEYS( '1', 0) - TAGKEYS( '2', 1) - TAGKEYS( '3', 2) - TAGKEYS( '4', 3) - TAGKEYS( '5', 4) - TAGKEYS( '6', 5) - TAGKEYS( '7', 6) - TAGKEYS( '8', 7) - TAGKEYS( '9', 8) + TAGKEYS( '1', 0) + TAGKEYS( '2', 1) + TAGKEYS( '3', 2) + TAGKEYS( '4', 3) + TAGKEYS( '5', 4) }; static const ColorRule colorrules[] = { @@ -200,19 +185,24 @@ static const ColorRule colorrules[] = { # define CONFIG_MOUSE /* compile in mouse support if we build against ncurses */ #endif -#define ENABLE_MOUSE false /* whether to enable mouse events by default */ +#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, { " │ │m " } } }, - { BUTTON2_CLICKED, { mouse_zoom, { NULL } } }, - { BUTTON3_CLICKED, { mouse_minimize, { NULL } } }, + { 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 } } }, + /* create [cmd]: create a new window, run `cmd` in the shell if specified */ + { "create", { create, { NULL } } }, + /* focus <win_id>: focus the window whose `DVTM_WINDOW_ID` is `win_id` */ + { "focus", { focusid, { NULL } } }, + /* tag <win_id> <tag> [tag ...]: add +tag, remove -tag or set tag of the window with the given identifier */ + { "tag", { tagid, { NULL } } }, }; /* gets executed when dvtm is started */ diff --git a/dvtm/gaps.diff b/dvtm/gaps.diff @@ -0,0 +1,201 @@ +diff --git a/bstack.c b/bstack.c +index 1d14776..81bb65e 100644 +--- a/bstack.c ++++ b/bstack.c +@@ -18,11 +18,6 @@ static void bstack(void) + 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 */ +@@ -31,11 +26,6 @@ static void bstack(void) + 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); +@@ -47,10 +37,6 @@ static void bstack(void) + 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; + } +diff --git a/dvtm.c b/dvtm.c +index 4cddea0..91c95a2 100644 +--- a/dvtm.c ++++ b/dvtm.c +@@ -399,7 +399,7 @@ draw_border(Client *c) { + + wattrset(c->window, attrs); + getyx(c->window, y, x); +- mvwhline(c->window, 0, 0, ACS_HLINE, c->w); ++ box(c->window, ACS_VLINE, ACS_HLINE); + maxlen = c->w - 10; + if (maxlen < 0) + maxlen = 0; +@@ -419,7 +419,7 @@ draw_border(Client *c) { + + static void + draw_content(Client *c) { +- vt_draw(c->term, c->window, c->has_title_line, 0); ++ vt_draw(c->term, c->window, c->has_title_line, c->has_title_line); + } + + static void +diff --git a/fibonacci.c b/fibonacci.c +index 70555f4..9b12361 100644 +--- a/fibonacci.c ++++ b/fibonacci.c +@@ -37,15 +37,11 @@ static void fibonacci(int s) + /* don't adjust the width for the last client */ + if (i < n - 1) { + nw /= 2; +- nnw -= nw + 1; ++ nnw -= nw; + } +- 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) { +@@ -60,11 +56,6 @@ static void fibonacci(int s) + 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; +@@ -75,7 +66,6 @@ static void fibonacci(int s) + nnh -= nh; + ny += nnh; + } +- mvaddch(ny, nx - 1, ACS_LTEE); + } + + resize(c, nx, ny, nw, nh); +diff --git a/grid.c b/grid.c +index ffa13b5..cb86abf 100644 +--- a/grid.c ++++ b/grid.c +@@ -31,19 +31,6 @@ static void grid(void) + 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++; + } +diff --git a/tile.c b/tile.c +index 4a61a93..0f3dee8 100644 +--- a/tile.c ++++ b/tile.c +@@ -24,10 +24,7 @@ static void tile(void) + if (i == m) { + ny = way; + nx += mw; +- mvvline(ny, nx, ACS_VLINE, wah); +- mvaddch(ny, nx, ACS_TTEE); +- nx++; +- nw = waw - mw -1; ++ nw = waw - mw; + } + nh = (i < n - 1) ? th : (way + wah) - ny; + if (i > m) +diff --git a/tstack.c b/tstack.c +index f3f1eb9..9cbc8ce 100644 +--- a/tstack.c ++++ b/tstack.c +@@ -18,11 +18,6 @@ static void tstack(void) + 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 */ +@@ -31,11 +26,6 @@ static void tstack(void) + 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); +diff --git a/vt.c b/vt.c +index 34c30ca..1b767e2 100644 +--- a/vt.c ++++ b/vt.c +@@ -1471,7 +1471,7 @@ Vt *vt_create(int rows, int cols, int scroll_size) + + void vt_resize(Vt *t, int rows, int cols) + { +- struct winsize ws = { .ws_row = rows, .ws_col = cols }; ++ struct winsize ws = { .ws_row = rows - 1, .ws_col = cols - 2 }; + + if (rows <= 0 || cols <= 0) + return; +@@ -1511,7 +1511,7 @@ void vt_draw(Vt *t, WINDOW *win, int srow, int scol) + t->scol = scol; + } + +- for (int i = 0; i < b->rows; i++) { ++ for (int i = 0; i < b->rows - 1 * srow; i++) { + Row *row = b->lines + i; + + if (!row->dirty) +@@ -1519,7 +1519,7 @@ void vt_draw(Vt *t, WINDOW *win, int srow, int scol) + + wmove(win, srow + i, scol); + Cell *cell = NULL; +- for (int j = 0; j < b->cols; j++) { ++ for (int j = 0; j < b->cols - 1 * srow; j++) { + Cell *prev_cell = cell; + cell = row->cells + j; + if (!prev_cell || cell->attr != prev_cell->attr