cmdtree

A trie command launcher for X11
git clone git://jb55.com/cmdtree
Log | Files | Refs | README | LICENSE

commit 1ee2efb9667af35d5e5ccfea6824701c2fdbce44
parent 6e938b9a190ae6c41614b2377f44d4e0ffc28b78
Author: William Casarin <jb55@jb55.com>
Date:   Mon,  9 Jul 2018 18:42:25 -0700

hardcode commands for now until I have a config format

Diffstat:
Mcmdtree.c | 4+---
Mcommand.c | 24++++++++++++++++--------
2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/cmdtree.c b/cmdtree.c @@ -72,7 +72,7 @@ setup(Drw *drw) parentwin); int vertwidth = 200; mw = wa.width; - mh = (lines + 1) * bh; + mh = 1 * bh; switch (position) { case POSITION_BOTTOM: y = wa.height - mh; @@ -95,8 +95,6 @@ setup(Drw *drw) mw = vertwidth; mh = wa.height; } - lines = 3; - lines = MAX(lines, 0); sep_width = drw_fontset_getwidth(drw, separator); swa.override_redirect = True; diff --git a/command.c b/command.c @@ -36,20 +36,28 @@ command_lookup(struct command *cmd, int ncmds, const char *binding) { return NULL; } -static struct command emacs_commands[] = { - { .bind = "d", .name = "emacs-dev", .nchildren = 0, .children = NULL }, +/* static struct command emacs_commands[] = { */ +/* { .bind = "d", .name = "emacs-dev", .nchildren = 0, .children = NULL }, */ +/* }; */ + +static struct command browser_commands[] = { + { .bind = "s", .name = "chrome", .nchildren = 0, .children = NULL }, + { .bind = "c", .name = "chromium", .nchildren = 0, .children = NULL }, + { .bind = "f", .name = "firefox", .nchildren = 0, .children = NULL }, }; static const struct command examples[] = { - { .bind = "f", .name = "firefox", .nchildren = 0, .children = NULL }, + { .bind = "b", + .name = "browsers", + .nchildren = LENGTH(browser_commands), + .children = browser_commands + }, { .bind = "e", - .name = "emacs", - .children = emacs_commands, - .nchildren = LENGTH(emacs_commands) + .name = "emacs-dev", + .children = NULL, + .nchildren = 0 }, - - { .bind = "N", .name = "networking", .nchildren = 0, .children = NULL }, }; struct command *