new feature: add focus{next,prev}screen ui_callback functions
this allows to switch focused screen in multi-head (zaphod) mode
This commit is contained in:
parent
1a276a7832
commit
32654ce496
|
@ -70,6 +70,8 @@ awesome:
|
|||
(("Mod4"), "b", "togglebar"),
|
||||
(("Mod4"), "j", "focusnext"),
|
||||
(("Mod4"), "k", "focusprev"),
|
||||
(("Mod4", "Control"), "j", "focusnextscreen"),
|
||||
(("Mod4", "Control"), "k", "focusprevscreen"),
|
||||
(("Mod4"), "h", "setmwfact", "-0.05"),
|
||||
(("Mod4"), "l", "setmwfact", "+0.05"),
|
||||
(("Mod4"), "p", "setborder", "+1"),
|
||||
|
|
4
config.c
4
config.c
|
@ -33,6 +33,7 @@
|
|||
#include "draw.h"
|
||||
#include "util.h"
|
||||
#include "statusbar.h"
|
||||
#include "screen.h"
|
||||
#include "layouts/tile.h"
|
||||
#include "layouts/max.h"
|
||||
#include "layouts/floating.h"
|
||||
|
@ -109,6 +110,9 @@ static const NameFuncLink KeyfuncList[] = {
|
|||
{"setmwfact", uicb_setmwfact},
|
||||
{"setnmaster", uicb_setnmaster},
|
||||
{"setncols", uicb_setncols},
|
||||
/* screen.c */
|
||||
{"focusnextscreen", uicb_focusnextscreen},
|
||||
{"focusprevscreen", uicb_focusprevscreen},
|
||||
/* awesome.c */
|
||||
{"quit", uicb_quit},
|
||||
/* statusbar.c */
|
||||
|
|
39
screen.c
39
screen.c
|
@ -20,7 +20,12 @@
|
|||
*/
|
||||
|
||||
#include "util.h"
|
||||
#include "client.h"
|
||||
#include "screen.h"
|
||||
#include "tag.h"
|
||||
#include "layout.h"
|
||||
|
||||
extern Client *sel, *clients;
|
||||
|
||||
/** Get screens info
|
||||
* \param disp Display ref
|
||||
|
@ -85,3 +90,37 @@ get_display_info(Display *disp, int screen, Statusbar statusbar)
|
|||
|
||||
return si;
|
||||
}
|
||||
|
||||
void
|
||||
uicb_focusnextscreen(Display *disp,
|
||||
DC *drawcontext,
|
||||
awesome_config * awesomeconf,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *c;
|
||||
int next_screen = awesomeconf->screen + 1 >= ScreenCount(disp) ? 0 : awesomeconf->screen + 1;
|
||||
|
||||
for(c = clients; c && !isvisible(c, next_screen, awesomeconf[next_screen - awesomeconf->screen].selected_tags, awesomeconf[next_screen - awesomeconf->screen].ntags); c = c->next);
|
||||
if(c)
|
||||
{
|
||||
focus(c->display, &drawcontext[next_screen - awesomeconf->screen], c, True, &awesomeconf[next_screen - awesomeconf->screen]);
|
||||
restack(c->display, &drawcontext[next_screen - awesomeconf->screen], &awesomeconf[next_screen - awesomeconf->screen]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
uicb_focusprevscreen(Display *disp,
|
||||
DC *drawcontext,
|
||||
awesome_config * awesomeconf,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *c;
|
||||
int prev_screen = awesomeconf->screen - 1 < 0 ? ScreenCount(disp) - 1 : awesomeconf->screen - 1;
|
||||
|
||||
for(c = clients; c && !isvisible(c, prev_screen, awesomeconf[prev_screen - awesomeconf->screen].selected_tags, awesomeconf[prev_screen - awesomeconf->screen].ntags); c = c->next);
|
||||
if(c)
|
||||
{
|
||||
focus(c->display, &drawcontext[prev_screen - awesomeconf->screen], c, True, &awesomeconf[prev_screen - awesomeconf->screen]);
|
||||
restack(c->display, &drawcontext[prev_screen - awesomeconf->screen], &awesomeconf[prev_screen - awesomeconf->screen]);
|
||||
}
|
||||
}
|
||||
|
|
2
screen.h
2
screen.h
|
@ -31,5 +31,7 @@ typedef XineramaScreenInfo ScreenInfo;
|
|||
|
||||
ScreenInfo * get_screen_info(Display *, int, Statusbar, int *);
|
||||
ScreenInfo * get_display_info(Display *disp, int, Statusbar statusbar);
|
||||
void uicb_focusnextscreen(Display *, DC *, awesome_config *, const char *);
|
||||
void uicb_focusprevscreen(Display *, DC *, awesome_config *, const char *);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue