dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit ca2df77446856a5c3da1d923ac52783f3faece5c
parent 785017b1256a123aefa242441cfc4c858a3f406d
Author: Frank LENORMAND <lenormf@gmail.com>
Date:   Wed,  5 Oct 2016 10:34:01 +0300

Fix several issues with remote commands and their documentation

This commit updates the documentation of the `create`, `focus` and `tag`
commands in the default configuration file; the `tagid` function no
longer expects tags to be integers and only appends tags instead of
replacing them; the `focusid` function allows focusing non-visible
windows.

Diffstat:
config.def.h | 6+++---
dvtm.c | 13++++++++++---
2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -188,11 +188,11 @@ static Button buttons[] = { #endif /* CONFIG_MOUSE */ static Cmd commands[] = { - /* create [ cmd ]: create a new window, run `cmd` in the shell if specified */ + /* create [cmd]: create a new window, run `cmd` in the shell if specified */ { "create", { create, { NULL } } }, - /* focus <win_id>: focus the visible window whose `DVTM_WINDOW_ID` is `win_id` */ + /* focus <win_id>: focus the window whose `DVTM_WINDOW_ID` is `win_id` */ { "focus", { focusid, { NULL } } }, - /* tag <win_id> <tag>: assign the given `tag` to the window whose `DVTM_WINDOW_ID` is `win_id` */ + /* tag <win_id> <tag> [tag ...]: replace the tags of the window with the given identifier */ { "tag", { tagid, { NULL } } }, }; diff --git a/dvtm.c b/dvtm.c @@ -800,13 +800,16 @@ tag(const char *args[]) { static void tagid(const char *args[]) { - if (!args[0] || !args[1] || !atoi(args[1])) + if (!args[0] || !args[1]) return; const int win_id = atoi(args[0]); for (Client *c = clients; c; c = c->next) { if (c->id == win_id) { - c->tags = bitoftag(args[1]) & TAGMASK; + unsigned int i; + c->tags = 0; + for (i = 1; i < MAX_ARGS && args[i]; i++) + c->tags |= bitoftag(args[i]) & TAGMASK; tagschanged(); return; } @@ -1148,11 +1151,15 @@ focusid(const char *args[]) { return; const int win_id = atoi(args[0]); - for (Client *c = nextvisible(clients); c; c = nextvisible(c->next)) { + for (Client *c = clients; c; c = c->next) { if (c->id == win_id) { focus(c); if (c->minimized) toggleminimize(NULL); + if (!isvisible(c)) { + c->tags |= tagset[seltags]; + tagschanged(); + } return; } }