On 14 May 2011 12:39, ilf <[email protected]> wrote:
> I find myself using this mouse thing for moving floating windows around. Is
> there any way to do this via keyboard?
>
> I don't need to so this pixel by pixel, but rather from corner to corner.
>
> --
> ilf
Here's what I use, it's a modified version of moveresize.c
Add something like this to config.h:
{ MODKEY|ControlMask, XK_q, jumpto, {.i = 0}},
{ MODKEY|ControlMask, XK_e, jumpto, {.i = 1}},
{ MODKEY|ControlMask, XK_a, jumpto, {.i = 2}},
{ MODKEY|ControlMask, XK_d, jumpto, {.i = 3}},
Rob.
void moveresize(const Arg *arg) {
XEvent ev;
Monitor *m = selmon;
const int *param = arg->v;
if(!(m->sel && arg && arg->v))
return;
/*
* if monitor->tag[monitor->selectedtag]->has_arrange_function
* and the selected client isn't floating...
*/
if(m->lt[m->sellt]->arrange && !m->sel->isfloating)
m->sel->isfloating = True;
resize(m->sel,
m->sel->x + param[0],
m->sel->y + param[1],
m->sel->w + param[2],
m->sel->h + param[3],
True);
arrange(m);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
void jumpto(const Arg *arg) {
Monitor *m = selmon;
XEvent ev;
if(!m->sel || !arg)
return;
{
#define LEFT (m->wx)
#define RIGHT (m->wx + m->ww - m->sel->w)
#define TOP (m->wy)
#define BOTTOM (m->wy + m->wh - m->sel->h)
struct
{
int x, y;
} jumps[] = {
{ LEFT, TOP },
{ RIGHT, TOP },
{ LEFT, BOTTOM },
{ RIGHT, BOTTOM }
};
if(!(0 <= arg->i && arg->i < LENGTH(jumps)))
return;
if(m->lt[m->sellt]->arrange && !m->sel->isfloating)
m->sel->isfloating = True;
resize(m->sel,
jumps[arg->i].x,
jumps[arg->i].y,
m->sel->w,
m->sel->h,
True);
arrange(m);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
}