dvtm

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

commit 33f916686952c333543c7024b6ec5ac5206a1049
parent 0171959180cc583caa5758d6189ff073afc806d4
Author: Greg Reagle <greg.reagle@umbc.edu>
Date:   Thu, 30 Jan 2014 09:51:26 +0100

Add Mod-Tab to focus previously selected window

Diffstat:
config.def.h | 1+
dvtm.1 | 3+++
dvtm.c | 11+++++++++++
3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -76,6 +76,7 @@ static Key keys[] = { { MOD, '7', { focusn, { "7" } } }, { MOD, '8', { focusn, { "8" } } }, { MOD, '9', { focusn, { "9" } } }, + { MOD, '\t', { focuslast, { NULL } } }, { MOD, 'q', { quit, { NULL } } }, { MOD, 'a', { togglerunall, { NULL } } }, { MOD, 'r', { redraw, { NULL } } }, diff --git a/dvtm.1 b/dvtm.1 @@ -101,6 +101,9 @@ Focus the .IR n \-th window. .TP +.B Mod\-Tab +Focus the previously selected window. +.TP .B Mod\-. Toggle minimization of current window. .TP diff --git a/dvtm.c b/dvtm.c @@ -150,6 +150,7 @@ static void focusnext(const char *args[]); static void focusnextnm(const char *args[]); static void focusprev(const char *args[]); static void focusprevnm(const char *args[]); +static void focuslast(const char *args[]); static void killclient(const char *args[]); static void lock(const char *key[]); static void paste(const char *args[]); @@ -187,6 +188,7 @@ static char *title; /* global variables */ Screen screen = { MFACT, SCROLL_HISTORY }; static Client *sel = NULL; +static Client *lastsel = NULL; static Client *msel = NULL; static bool mouse_events_enabled = ENABLE_MOUSE; static Layout *layout = layouts; @@ -382,6 +384,7 @@ focus(Client *c) { Client *tmp = sel; if (sel == c) return; + lastsel = sel; sel = c; settitle(c); if (tmp && !isarrange(fullscreen)) { @@ -664,6 +667,8 @@ destroy(Client *c) { sel = NULL; } } + if (lastsel == c) + lastsel = NULL; werase(c->window); wnoutrefresh(c->window); vt_destroy(c->term); @@ -827,6 +832,12 @@ focusprevnm(const char *args[]) { } static void +focuslast(const char *args[]) { + if (lastsel) + focus(lastsel); +} + +static void killclient(const char *args[]) { if (!sel) return;