add uicb_focus_history and bind with -1 to Mod4+Tab by default

This commit is contained in:
Julien Danjou 2007-12-15 20:32:49 +01:00
parent ae7b2ed9d0
commit db6a9e92c3
4 changed files with 39 additions and 0 deletions

View File

@ -176,6 +176,13 @@ keys
command = "client_focusprev"
}
key
{
modkey = {"Mod4"}
key = "Tab"
command = "focus_history"
arg = "-1"
}
key
{
modkey = {"Mod4", "Shift"}
key = "j"

27
focus.c
View File

@ -21,6 +21,7 @@
#include "util.h"
#include "tag.h"
#include "layout.h"
#include "focus.h"
static FocusList *
@ -103,4 +104,30 @@ focus_get_latest_client_for_tag(FocusList *head, TagClientLink *tc, Tag *t)
return NULL;
}
void
uicb_focus_history(awesome_config *awesomeconf,
int screen,
const char *arg)
{
int i;
FocusList *fl = awesomeconf->focus;
Tag *curtag = get_current_tag(awesomeconf->screens[screen]);
if(arg)
{
i = atoi(arg);
if(i < 0)
{
for(; fl && i < 0; fl = fl->prev)
if(is_client_tagged(awesomeconf->screens[screen].tclink,
fl->client,
curtag))
i++;
if(fl)
focus(fl->client, True, awesomeconf, screen);
}
}
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99

View File

@ -28,5 +28,7 @@ void focus_add_client(FocusList **, Client *);
void focus_delete_client(FocusList **, Client *);
Client * focus_get_latest_client_for_tag(FocusList *, TagClientLink *, Tag *);
UICB_PROTO(uicb_focus_history);
#endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99

3
uicb.c
View File

@ -28,6 +28,7 @@
#include "layout.h"
#include "mouse.h"
#include "statusbar.h"
#include "focus.h"
#include "layouts/tile.h"
const NameFuncLink UicbList[] =
@ -75,6 +76,8 @@ const NameFuncLink UicbList[] =
/* mouse.c */
{"client_movemouse", uicb_client_movemouse},
{"client_resizemouse", uicb_client_resizemouse},
/* focus.c */
{"focus_history", uicb_focus_history},
{NULL, NULL}
};