dwm-movetoedge-6.2.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-movetoedge-6.2.diff (2355B) | |
--- | |
1 diff --git a/config.def.h b/config.def.h | |
2 index 1c0b587..7e8436f 100644 | |
3 --- a/config.def.h | |
4 +++ b/config.def.h | |
5 @@ -84,6 +84,15 @@ static Key keys[] = { | |
6 { MODKEY, XK_period, focusmon, {.i … | |
7 { MODKEY|ShiftMask, XK_comma, tagmon, {.i … | |
8 { MODKEY|ShiftMask, XK_period, tagmon, {.i … | |
9 + { MODKEY, XK_KP_End, movetoedge, … | |
10 + { MODKEY, XK_KP_Down, movetoedge, … | |
11 + { MODKEY, XK_KP_Next, movetoedge, … | |
12 + { MODKEY, XK_KP_Left, movetoedge, … | |
13 + { MODKEY, XK_KP_Begin, movetoedge, … | |
14 + { MODKEY, XK_KP_Right, movetoedge, … | |
15 + { MODKEY, XK_KP_Home, movetoedge, … | |
16 + { MODKEY, XK_KP_Up, movetoedge, … | |
17 + { MODKEY, XK_KP_Prior, movetoedge, … | |
18 TAGKEYS( XK_1, 0) | |
19 TAGKEYS( XK_2, 1) | |
20 TAGKEYS( XK_3, 2) | |
21 diff --git a/dwm.c b/dwm.c | |
22 index 9fd0286..b9030fe 100644 | |
23 --- a/dwm.c | |
24 +++ b/dwm.c | |
25 @@ -184,6 +184,7 @@ static void maprequest(XEvent *e); | |
26 static void monocle(Monitor *m); | |
27 static void motionnotify(XEvent *e); | |
28 static void movemouse(const Arg *arg); | |
29 +static void movetoedge(const Arg *arg); | |
30 static Client *nexttiled(Client *c); | |
31 static void pop(Client *); | |
32 static void propertynotify(XEvent *e); | |
33 @@ -1193,6 +1194,43 @@ movemouse(const Arg *arg) | |
34 } | |
35 } | |
36 | |
37 +void | |
38 +movetoedge(const Arg *arg) { | |
39 + /* only floating windows can be moved */ | |
40 + Client *c; | |
41 + c = selmon->sel; | |
42 + int x, y, nx, ny; | |
43 + | |
44 + if (!c || !arg) | |
45 + return; | |
46 + if (selmon->lt[selmon->sellt]->arrange && !c->isfloating) | |
47 + return; | |
48 + if (sscanf((char *)arg->v, "%d %d", &x, &y) != 2) | |
49 + return; | |
50 + | |
51 + if(x == 0) | |
52 + nx = (selmon->mw - c->w)/2; | |
53 + else if(x == -1) | |
54 + nx = borderpx; | |
55 + else if(x == 1) | |
56 + nx = selmon->mw - (c->w + 2 * borderpx); | |
57 + else | |
58 + nx = c->x; | |
59 + | |
60 + if(y == 0) | |
61 + ny = (selmon->mh - (c->h + bh))/2; | |
62 + else if(y == -1) | |
63 + ny = bh + borderpx; | |
64 + else if(y == 1) | |
65 + ny = selmon->mh - (c->h + 2 * borderpx); | |
66 + else | |
67 + ny = c->y; | |
68 + | |
69 + | |
70 + XRaiseWindow(dpy, c->win); | |
71 + resize(c, nx, ny, c->w, c->h, True); | |
72 +} | |
73 + | |
74 Client * | |
75 nexttiled(Client *c) | |
76 { |