Add uicb_screen_focus to switch to a specified screen.
This commit is contained in:
parent
b313f266c8
commit
097e8e4172
|
@ -181,13 +181,15 @@ keys
|
||||||
{
|
{
|
||||||
modkey = {"Mod4", "Control"}
|
modkey = {"Mod4", "Control"}
|
||||||
key = "j"
|
key = "j"
|
||||||
command = "screen_focusnext"
|
command = "screen_focus"
|
||||||
|
arg = "+1"
|
||||||
}
|
}
|
||||||
key
|
key
|
||||||
{
|
{
|
||||||
modkey = {"Mod4", "Control"}
|
modkey = {"Mod4", "Control"}
|
||||||
key = "k"
|
key = "k"
|
||||||
command = "screen_focusprev"
|
command = "screen_focus"
|
||||||
|
arg = "-1"
|
||||||
}
|
}
|
||||||
key
|
key
|
||||||
{
|
{
|
||||||
|
|
40
screen.c
40
screen.c
|
@ -241,30 +241,32 @@ move_mouse_pointer_to_screen(Display *disp, int screen)
|
||||||
XWarpPointer(disp, None, RootWindow(disp, screen), 0, 0, 0, 0, 0, 0);
|
XWarpPointer(disp, None, RootWindow(disp, screen), 0, 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Switch focus to a specified screen
|
||||||
|
* \param awesomeconf awesome config ref
|
||||||
|
* \param arg screen number
|
||||||
|
* \ingroup ui_callback
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
uicb_screen_focusnext(awesome_config * awesomeconf,
|
uicb_screen_focus(awesome_config *awesomeconf, int screen, const char *arg)
|
||||||
int screen,
|
|
||||||
const char *arg __attribute__ ((unused)))
|
|
||||||
{
|
{
|
||||||
int next_screen = screen + 1 >= get_screen_count(awesomeconf->display) ? 0 : screen + 1;
|
int new_screen, numscreens = get_screen_count(awesomeconf->display);
|
||||||
Client *sel = get_current_tag(awesomeconf->screens[next_screen].tags,
|
|
||||||
awesomeconf->screens[next_screen].ntags)->client_sel;
|
|
||||||
|
|
||||||
focus(sel, True, awesomeconf, next_screen - screen);
|
if(arg)
|
||||||
move_mouse_pointer_to_screen(awesomeconf->display, next_screen);
|
new_screen = compute_new_value_from_arg(arg, screen);
|
||||||
}
|
else
|
||||||
|
new_screen = screen + 1;
|
||||||
|
|
||||||
void
|
if (new_screen < 0)
|
||||||
uicb_screen_focusprev(awesome_config * awesomeconf,
|
new_screen = numscreens - 1;
|
||||||
int screen,
|
if (new_screen > (numscreens - 1))
|
||||||
const char *arg __attribute__ ((unused)))
|
new_screen = 0;
|
||||||
{
|
|
||||||
int prev_screen = screen - 1 < 0 ? get_screen_count(awesomeconf->display) - 1 : screen - 1;
|
|
||||||
Client *sel = get_current_tag(awesomeconf->screens[prev_screen].tags,
|
|
||||||
awesomeconf->screens[prev_screen].ntags)->client_sel;
|
|
||||||
|
|
||||||
focus(sel, True, awesomeconf, prev_screen - screen);
|
focus(get_current_tag(awesomeconf->screens[new_screen].tags,
|
||||||
move_mouse_pointer_to_screen(awesomeconf->display, prev_screen);
|
awesomeconf->screens[new_screen].ntags)->client_sel,
|
||||||
|
True, awesomeconf, new_screen);
|
||||||
|
|
||||||
|
move_mouse_pointer_to_screen(awesomeconf->display, new_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Move client to a virtual screen (if Xinerama is active)
|
/** Move client to a virtual screen (if Xinerama is active)
|
||||||
|
|
3
screen.h
3
screen.h
|
@ -35,8 +35,7 @@ int get_screen_count(Display *);
|
||||||
int get_phys_screen(Display *, int);
|
int get_phys_screen(Display *, int);
|
||||||
void move_client_to_screen(Client *, awesome_config *, int, Bool);
|
void move_client_to_screen(Client *, awesome_config *, int, Bool);
|
||||||
|
|
||||||
UICB_PROTO(uicb_screen_focusnext);
|
UICB_PROTO(uicb_screen_focus);
|
||||||
UICB_PROTO(uicb_screen_focusprev);
|
|
||||||
UICB_PROTO(uicb_client_movetoscreen);
|
UICB_PROTO(uicb_client_movetoscreen);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
3
uicb.c
3
uicb.c
|
@ -62,8 +62,7 @@ const NameFuncLink UicbList[] = {
|
||||||
{"tag_setnmaster", uicb_tag_setnmaster},
|
{"tag_setnmaster", uicb_tag_setnmaster},
|
||||||
{"tag_setncol", uicb_tag_setncol},
|
{"tag_setncol", uicb_tag_setncol},
|
||||||
/* screen.c */
|
/* screen.c */
|
||||||
{"screen_focusnext", uicb_screen_focusnext},
|
{"screen_focus", uicb_screen_focus},
|
||||||
{"screen_focusprev", uicb_screen_focusprev},
|
|
||||||
{"client_movetoscreen", uicb_client_movetoscreen},
|
{"client_movetoscreen", uicb_client_movetoscreen},
|
||||||
/* awesome.c */
|
/* awesome.c */
|
||||||
{"quit", uicb_quit},
|
{"quit", uicb_quit},
|
||||||
|
|
Loading…
Reference in New Issue