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"}
|
||||
key = "j"
|
||||
command = "screen_focusnext"
|
||||
command = "screen_focus"
|
||||
arg = "+1"
|
||||
}
|
||||
key
|
||||
{
|
||||
modkey = {"Mod4", "Control"}
|
||||
key = "k"
|
||||
command = "screen_focusprev"
|
||||
command = "screen_focus"
|
||||
arg = "-1"
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/** Switch focus to a specified screen
|
||||
* \param awesomeconf awesome config ref
|
||||
* \param arg screen number
|
||||
* \ingroup ui_callback
|
||||
*/
|
||||
void
|
||||
uicb_screen_focusnext(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
uicb_screen_focus(awesome_config *awesomeconf, int screen, const char *arg)
|
||||
{
|
||||
int next_screen = screen + 1 >= get_screen_count(awesomeconf->display) ? 0 : screen + 1;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[next_screen].tags,
|
||||
awesomeconf->screens[next_screen].ntags)->client_sel;
|
||||
int new_screen, numscreens = get_screen_count(awesomeconf->display);
|
||||
|
||||
focus(sel, True, awesomeconf, next_screen - screen);
|
||||
move_mouse_pointer_to_screen(awesomeconf->display, next_screen);
|
||||
}
|
||||
if(arg)
|
||||
new_screen = compute_new_value_from_arg(arg, screen);
|
||||
else
|
||||
new_screen = screen + 1;
|
||||
|
||||
void
|
||||
uicb_screen_focusprev(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
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;
|
||||
if (new_screen < 0)
|
||||
new_screen = numscreens - 1;
|
||||
if (new_screen > (numscreens - 1))
|
||||
new_screen = 0;
|
||||
|
||||
focus(sel, True, awesomeconf, prev_screen - screen);
|
||||
move_mouse_pointer_to_screen(awesomeconf->display, prev_screen);
|
||||
focus(get_current_tag(awesomeconf->screens[new_screen].tags,
|
||||
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)
|
||||
|
|
3
screen.h
3
screen.h
|
@ -35,8 +35,7 @@ int get_screen_count(Display *);
|
|||
int get_phys_screen(Display *, int);
|
||||
void move_client_to_screen(Client *, awesome_config *, int, Bool);
|
||||
|
||||
UICB_PROTO(uicb_screen_focusnext);
|
||||
UICB_PROTO(uicb_screen_focusprev);
|
||||
UICB_PROTO(uicb_screen_focus);
|
||||
UICB_PROTO(uicb_client_movetoscreen);
|
||||
|
||||
#endif
|
||||
|
|
3
uicb.c
3
uicb.c
|
@ -62,8 +62,7 @@ const NameFuncLink UicbList[] = {
|
|||
{"tag_setnmaster", uicb_tag_setnmaster},
|
||||
{"tag_setncol", uicb_tag_setncol},
|
||||
/* screen.c */
|
||||
{"screen_focusnext", uicb_screen_focusnext},
|
||||
{"screen_focusprev", uicb_screen_focusprev},
|
||||
{"screen_focus", uicb_screen_focus},
|
||||
{"client_movetoscreen", uicb_client_movetoscreen},
|
||||
/* awesome.c */
|
||||
{"quit", uicb_quit},
|
||||
|
|
Loading…
Reference in New Issue