mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Adding aspectresize patch
This commit is contained in:
parent
376b48e4d2
commit
b3d336322e
@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
|
||||
### Changelog:
|
||||
|
||||
2020-08-27 - Added aspectresize patch
|
||||
|
||||
2020-08-25 - Unified tag icon handling while adding support for different icons per monitor. Added alttagsdecoration patch.
|
||||
|
||||
2020-08-22 - Added logic to auto-hide bars if nothing is drawn on them (e.g. for standalone bars that only show certain clients). Added clientindicators patch and unified indicator code. Simplified Pango integration by settling on common function signatures.
|
||||
@ -170,6 +172,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
- [alwaysfullscreen](https://dwm.suckless.org/patches/alwaysfullscreen/)
|
||||
- prevents the focus to drift from the active fullscreen client when using focusstack\(\)
|
||||
|
||||
- [aspectresize](https://dwm.suckless.org/patches/aspectresize/)
|
||||
- allows windows to be resized with its aspect ratio remaining constant
|
||||
|
||||
- [attachabove](https://dwm.suckless.org/patches/attachabove/)
|
||||
- new windows are placed above selected client
|
||||
|
||||
|
@ -945,6 +945,10 @@ static Key keys[] = {
|
||||
{ MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} },
|
||||
{ MODKEY|ShiftMask, XK_o, setcfact, {0} },
|
||||
#endif // CFACTS_PATCH
|
||||
#if ASPECTRESIZE_PATCH
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_e, aspectresize, {.i = +24} },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_r, aspectresize, {.i = -24} },
|
||||
#endif // ASPECTRESIZE_PATCH
|
||||
#if MOVERESIZE_PATCH
|
||||
{ MODKEY|Mod4Mask, XK_Down, moveresize, {.v = "0x 25y 0w 0h" } },
|
||||
{ MODKEY|Mod4Mask, XK_Up, moveresize, {.v = "0x -25y 0w 0h" } },
|
||||
|
4
dwm.c
4
dwm.c
@ -63,6 +63,10 @@
|
||||
#endif // SPAWNCMD_PATCH
|
||||
|
||||
/* macros */
|
||||
#define Button6 6
|
||||
#define Button7 7
|
||||
#define Button8 8
|
||||
#define Button9 9
|
||||
#define NUMTAGS 9
|
||||
#define BARRULES 20
|
||||
#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask)
|
||||
|
24
patch/aspectresize.c
Normal file
24
patch/aspectresize.c
Normal file
@ -0,0 +1,24 @@
|
||||
void
|
||||
aspectresize(const Arg *arg)
|
||||
{
|
||||
/* only floating windows can be moved */
|
||||
Client *c;
|
||||
c = selmon->sel;
|
||||
float ratio;
|
||||
int w, h,nw, nh;
|
||||
|
||||
if (!c || !arg)
|
||||
return;
|
||||
if (selmon->lt[selmon->sellt]->arrange && !c->isfloating)
|
||||
return;
|
||||
|
||||
ratio = (float)c->w / (float)c->h;
|
||||
h = arg->i;
|
||||
w = (int)(ratio * h);
|
||||
|
||||
nw = c->w + w;
|
||||
nh = c->h + h;
|
||||
|
||||
XRaiseWindow(dpy, c->win);
|
||||
resize(c, c->x, c->y, nw, nh, True);
|
||||
}
|
1
patch/aspectresize.h
Normal file
1
patch/aspectresize.h
Normal file
@ -0,0 +1 @@
|
||||
static void aspectresize(const Arg *arg);
|
@ -82,6 +82,9 @@
|
||||
#endif
|
||||
|
||||
/* Other patches */
|
||||
#if ASPECTRESIZE_PATCH
|
||||
#include "aspectresize.c"
|
||||
#endif
|
||||
#if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBELOW_PATCH || ATTACHBOTTOM_PATCH
|
||||
#include "attachx.c"
|
||||
#endif
|
||||
|
@ -79,6 +79,9 @@
|
||||
#endif
|
||||
|
||||
/* Other patches */
|
||||
#if ASPECTRESIZE_PATCH
|
||||
#include "aspectresize.h"
|
||||
#endif
|
||||
#if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBELOW_PATCH || ATTACHBOTTOM_PATCH
|
||||
#include "attachx.h"
|
||||
#endif
|
||||
|
@ -299,6 +299,11 @@
|
||||
* Other patches
|
||||
*/
|
||||
|
||||
/* This patch allows windows to be resized with its aspect ratio remaining constant.
|
||||
* https://dwm.suckless.org/patches/aspectresize/
|
||||
*/
|
||||
#define ASPECTRESIZE_PATCH 0
|
||||
|
||||
/* This patch prevents the focus to drift from the active fullscreen client when
|
||||
* using focusstack().
|
||||
* https://dwm.suckless.org/patches/alwaysfullscreen/
|
||||
|
Loading…
Reference in New Issue
Block a user