index.md - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
index.md (1441B) | |
--- | |
1 aspectresize | |
2 ============ | |
3 | |
4 Description | |
5 ----------- | |
6 This patch you to resize the window with its aspect ratio remain constan… | |
7 moveresize patch for manual resize. | |
8 | |
9 Usage | |
10 ----- | |
11 1. Put the following `aspectresize()` function somewhere in your `dwm.c`, | |
12 **after** the line which includes the config.h file: | |
13 | |
14 void | |
15 aspectresize(const Arg *arg) { | |
16 /* only floating windows can be moved */ | |
17 Client *c; | |
18 c = selmon->sel; | |
19 float ratio; | |
20 int w, h,nw, nh; | |
21 | |
22 if (!c || !arg) | |
23 return; | |
24 if (selmon->lt[selmon->sellt]->arrange && !c->isfloating) | |
25 return; | |
26 | |
27 ratio = (float)c->w / (float)c->h; | |
28 h = arg->i; | |
29 w = (int)(ratio * h); | |
30 | |
31 nw = c->w + w; | |
32 nh = c->h + h; | |
33 | |
34 XRaiseWindow(dpy, c->win); | |
35 resize(c, c->x, c->y, nw, nh, True); | |
36 } | |
37 | |
38 | |
39 2. Add a aspectresize() function definition in dwm.c below the line: | |
40 static void aspectresize(const Arg *arg); | |
41 | |
42 3. You can use Mod+Shift+j to increase size and Mod+Shift+k to decrease … | |
43 which respects client's aspect ratio: | |
44 | |
45 { MODKEY|ShiftMask, XK_j, aspectresize, {.i =… | |
46 { MODKEY|ShiftMask, XK_k, aspectresize, {.i =… | |
47 | |
48 Download | |
49 -------- | |
50 * [dwm-aspectresize-6.2.diff](dwm-aspectresize-6.2.diff) | |
51 | |
52 Authors | |
53 ------- | |
54 * Dhaval Patel - <[email protected]> |