index.md - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
index.md (3732B) | |
--- | |
1 moveresize | |
2 ========== | |
3 | |
4 Description | |
5 ----------- | |
6 This changes allows you to move and resize dwm's clients using keyboard | |
7 bindings. | |
8 | |
9 Usage | |
10 ----- | |
11 1. Put the following `moveresize()` function somewhere in your `dwm.c`, | |
12 **after** the line which includes the config.h file: | |
13 | |
14 static void | |
15 moveresize(const Arg *arg) | |
16 { | |
17 XEvent ev; | |
18 Monitor *m = selmon; | |
19 | |
20 if(!(m->sel && arg && arg->v && m->sel->isfloating)) | |
21 return; | |
22 | |
23 resize(m->sel, m->sel->x + ((int *)arg->v)[0], | |
24 m->sel->y + ((int *)arg->v)[1], | |
25 m->sel->w + ((int *)arg->v)[2], | |
26 m->sel->h + ((int *)arg->v)[3], | |
27 True); | |
28 | |
29 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | |
30 } | |
31 | |
32 2. Add a moveresize() function definition in dwm.c below the line: | |
33 static void movemouse(const Arg *arg); | |
34 | |
35 static void moveresize(const Arg *arg); | |
36 | |
37 3. Insert the bindings into the keys list. Here is an example which uses… | |
38 arrow keys to move (mod+arrow) or resize (mod+shift+arrow) the select… | |
39 client: | |
40 | |
41 { MODKEY, XK_Down, … | |
42 { MODKEY, XK_Up, … | |
43 { MODKEY, XK_Right, … | |
44 { MODKEY, XK_Left, … | |
45 { MODKEY|ShiftMask, XK_Down, mover… | |
46 { MODKEY|ShiftMask, XK_Up, … | |
47 { MODKEY|ShiftMask, XK_Right, move… | |
48 { MODKEY|ShiftMask, XK_Left, mover… | |
49 | |
50 In latest version you can also add the following bindings to move client… | |
51 | |
52 { MODKEY|ControlMask, XK_Up, moveresizeedge, {.v =… | |
53 { MODKEY|ControlMask, XK_Down, moveresizeedge, {.v =… | |
54 { MODKEY|ControlMask, XK_Left, moveresizeedge, {.v =… | |
55 { MODKEY|ControlMask, XK_Right, moveresizeedge, {.v =… | |
56 { MODKEY|ControlMask|ShiftMask, XK_Up, moveresizeedge, {.v =… | |
57 { MODKEY|ControlMask|ShiftMask, XK_Down, moveresizeedge, {.v =… | |
58 { MODKEY|ControlMask|ShiftMask, XK_Left, moveresizeedge, {.v =… | |
59 { MODKEY|ControlMask|ShiftMask, XK_Right, moveresizeedge, {.v =… | |
60 | |
61 If you want to automatically toggle the client floating when move/resize, | |
62 then replace the second if statement in the moveresize function with thi… | |
63 | |
64 if (!(m->sel && arg && arg->v)) | |
65 return; | |
66 if (m->lt[m->sellt]->arrange && !m->sel->isfloating) | |
67 togglefloating(NULL); | |
68 | |
69 Multi-head | |
70 ---------- | |
71 From dwm 6.0 onward there's the following patch which is aware of the sc… | |
72 sizes in a multi monitor setup. A second patch allows you to maximize wi… | |
73 | |
74 | |
75 Changelog | |
76 --------- | |
77 20201206: | |
78 * moversizeedge: taking into account `topbar` | |
79 * moversizeedge: correctly moves/resizes client on 2nd monitor | |
80 | |
81 Download | |
82 -------- | |
83 * [dwm-moveresize-20221210-7ac106c.diff](dwm-moveresize-20221210-7ac106c… | |
84 * [dwm-moveresize-20201206-cce77d8.diff](dwm-moveresize-20201206-cce77d8… | |
85 * [dwm-moveresize-20200609-46c8838.diff](dwm-moveresize-20200609-46c8838… | |
86 * [dwm-moveresize-6.2.diff](dwm-moveresize-6.2.diff) | |
87 * [dwm-moveresize-20160731-56a31dc.diff](dwm-moveresize-20160731-56a31dc… | |
88 * [dwm-moveresize-6.1.diff](dwm-moveresize-6.1.diff) (2095b) (20140209) | |
89 * [dwm-moveresize-6.0.diff](dwm-moveresize-6.0.diff) (2025b) (20120406) | |
90 | |
91 Authors | |
92 ------- | |
93 * Georgios Oxinos - <[email protected]> | |
94 * Claudio M. Alessi - <[email protected]> | |
95 * Jan Christoph Ebersbach - <[email protected]> | |
96 * howoz - <[email protected]> |