mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 12:05:45 +00:00
Adding insets patch
This commit is contained in:
parent
e5ea493d32
commit
1dd4ec5bc4
@ -15,7 +15,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
2020-08-10 - Added cool autostart patch
|
2020-08-10 - Added cool autostart and insets patches
|
||||||
|
|
||||||
2020-08-02 - Added reorganizetags patch
|
2020-08-02 - Added reorganizetags patch
|
||||||
|
|
||||||
@ -301,6 +301,10 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
|||||||
- [inplacerotate](https://dwm.suckless.org/patches/inplacerotate/)
|
- [inplacerotate](https://dwm.suckless.org/patches/inplacerotate/)
|
||||||
- allows rotation of all clients in the master or stack area without affecting the other area
|
- allows rotation of all clients in the master or stack area without affecting the other area
|
||||||
|
|
||||||
|
- [insets](https://dwm.suckless.org/patches/insets/)
|
||||||
|
- lets custom insets from each edge of the screen to be defined
|
||||||
|
- an example use case would be to make space for an external bar
|
||||||
|
|
||||||
- [ispermanent](https://dwm.suckless.org/patches/ispermanent/)
|
- [ispermanent](https://dwm.suckless.org/patches/ispermanent/)
|
||||||
- adds rule option for clients to avoid accidental termination by killclient for sticky windows
|
- adds rule option for clients to avoid accidental termination by killclient for sticky windows
|
||||||
|
|
||||||
|
12
config.def.h
12
config.def.h
@ -403,6 +403,15 @@ static const MonitorRule monrules[] = {
|
|||||||
#endif // PERTAG_PATCH
|
#endif // PERTAG_PATCH
|
||||||
#endif // MONITOR_RULES_PATCH
|
#endif // MONITOR_RULES_PATCH
|
||||||
|
|
||||||
|
#if INSETS_PATCH
|
||||||
|
static const Inset default_inset = {
|
||||||
|
.x = 0,
|
||||||
|
.y = 30,
|
||||||
|
.w = 0,
|
||||||
|
.h = 0,
|
||||||
|
};
|
||||||
|
#endif // INSETS_PATCH
|
||||||
|
|
||||||
/* Bar rules allow you to configure what is shown where on the bar, as well as
|
/* Bar rules allow you to configure what is shown where on the bar, as well as
|
||||||
* introducing your own bar modules.
|
* introducing your own bar modules.
|
||||||
*
|
*
|
||||||
@ -944,6 +953,9 @@ static Key keys[] = {
|
|||||||
#if REORGANIZETAGS_PATCH
|
#if REORGANIZETAGS_PATCH
|
||||||
{ MODKEY|ControlMask, XK_r, reorganizetags, {0} },
|
{ MODKEY|ControlMask, XK_r, reorganizetags, {0} },
|
||||||
#endif // REORGANIZETAGS_PATCH
|
#endif // REORGANIZETAGS_PATCH
|
||||||
|
#if INSETS_PATCH
|
||||||
|
{ MODKEY|ShiftMask|ControlMask, XK_a, updateinset, {.v = &default_inset } },
|
||||||
|
#endif // INSETS_PATCH
|
||||||
{ MODKEY, XK_Return, zoom, {0} },
|
{ MODKEY, XK_Return, zoom, {0} },
|
||||||
#if VANITYGAPS_PATCH
|
#if VANITYGAPS_PATCH
|
||||||
{ MODKEY|Mod4Mask, XK_u, incrgaps, {.i = +1 } },
|
{ MODKEY|Mod4Mask, XK_u, incrgaps, {.i = +1 } },
|
||||||
|
30
dwm.c
30
dwm.c
@ -333,6 +333,15 @@ typedef struct {
|
|||||||
#endif // FLEXTILE_DELUXE_LAYOUT
|
#endif // FLEXTILE_DELUXE_LAYOUT
|
||||||
} Layout;
|
} Layout;
|
||||||
|
|
||||||
|
#if INSETS_PATCH
|
||||||
|
typedef struct {
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int w;
|
||||||
|
int h;
|
||||||
|
} Inset;
|
||||||
|
#endif // INSETS_PATCH
|
||||||
|
|
||||||
#if PERTAG_PATCH
|
#if PERTAG_PATCH
|
||||||
typedef struct Pertag Pertag;
|
typedef struct Pertag Pertag;
|
||||||
#endif // PERTAG_PATCH
|
#endif // PERTAG_PATCH
|
||||||
@ -372,6 +381,9 @@ struct Monitor {
|
|||||||
#if PERTAG_PATCH
|
#if PERTAG_PATCH
|
||||||
Pertag *pertag;
|
Pertag *pertag;
|
||||||
#endif // PERTAG_PATCH
|
#endif // PERTAG_PATCH
|
||||||
|
#if INSETS_PATCH
|
||||||
|
Inset inset;
|
||||||
|
#endif // INSETS_PATCH
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -1387,6 +1399,9 @@ createmon(void)
|
|||||||
#endif // VANITYGAPS_PATCH
|
#endif // VANITYGAPS_PATCH
|
||||||
}
|
}
|
||||||
#endif // PERTAG_PATCH
|
#endif // PERTAG_PATCH
|
||||||
|
#if INSETS_PATCH
|
||||||
|
m->inset = default_inset;
|
||||||
|
#endif // INSETS_PATCH
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3516,7 +3531,9 @@ updatebars(void)
|
|||||||
void
|
void
|
||||||
updatebarpos(Monitor *m)
|
updatebarpos(Monitor *m)
|
||||||
{
|
{
|
||||||
|
m->wx = m->mx;
|
||||||
m->wy = m->my;
|
m->wy = m->my;
|
||||||
|
m->ww = m->mw;
|
||||||
m->wh = m->mh;
|
m->wh = m->mh;
|
||||||
int num_bars;
|
int num_bars;
|
||||||
Bar *bar;
|
Bar *bar;
|
||||||
@ -3528,8 +3545,17 @@ updatebarpos(Monitor *m)
|
|||||||
int x_pad = 0;
|
int x_pad = 0;
|
||||||
#endif // BAR_PADDING_PATCH
|
#endif // BAR_PADDING_PATCH
|
||||||
|
|
||||||
|
#if INSETS_PATCH
|
||||||
|
// Custom insets
|
||||||
|
Inset inset = m->inset;
|
||||||
|
m->wx += inset.x;
|
||||||
|
m->wy += inset.y;
|
||||||
|
m->ww -= inset.w + inset.x;
|
||||||
|
m->wh -= inset.h + inset.y;
|
||||||
|
#endif // INSETS_PATCH
|
||||||
|
|
||||||
for (bar = m->bar; bar; bar = bar->next) {
|
for (bar = m->bar; bar; bar = bar->next) {
|
||||||
bar->bx = m->mx + x_pad;
|
bar->bx = m->wx + x_pad;
|
||||||
bar->bw = m->ww - 2 * x_pad;
|
bar->bw = m->ww - 2 * x_pad;
|
||||||
bar->bh = bh;
|
bar->bh = bh;
|
||||||
}
|
}
|
||||||
@ -3542,7 +3568,7 @@ updatebarpos(Monitor *m)
|
|||||||
|
|
||||||
for (num_bars = 0, bar = m->bar; bar; bar = bar->next, num_bars++)
|
for (num_bars = 0, bar = m->bar; bar; bar = bar->next, num_bars++)
|
||||||
if (bar->topbar)
|
if (bar->topbar)
|
||||||
m->wy = m->my + bh + y_pad;
|
m->wy = m->wy + bh + y_pad;
|
||||||
m->wh = m->wh - y_pad * num_bars - bh * num_bars;
|
m->wh = m->wh - y_pad * num_bars - bh * num_bars;
|
||||||
|
|
||||||
for (bar = m->bar; bar; bar = bar->next)
|
for (bar = m->bar; bar; bar = bar->next)
|
||||||
|
@ -111,6 +111,9 @@
|
|||||||
#if INPLACEROTATE_PATCH
|
#if INPLACEROTATE_PATCH
|
||||||
#include "inplacerotate.c"
|
#include "inplacerotate.c"
|
||||||
#endif
|
#endif
|
||||||
|
#if INSETS_PATCH
|
||||||
|
#include "insets.c"
|
||||||
|
#endif
|
||||||
#if KEYMODES_PATCH
|
#if KEYMODES_PATCH
|
||||||
#include "keymodes.c"
|
#include "keymodes.c"
|
||||||
#endif
|
#endif
|
||||||
|
@ -111,6 +111,9 @@
|
|||||||
#if INPLACEROTATE_PATCH
|
#if INPLACEROTATE_PATCH
|
||||||
#include "inplacerotate.h"
|
#include "inplacerotate.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if INSETS_PATCH
|
||||||
|
#include "insets.h"
|
||||||
|
#endif
|
||||||
#if KEYMODES_PATCH
|
#if KEYMODES_PATCH
|
||||||
#include "keymodes.h"
|
#include "keymodes.h"
|
||||||
#endif
|
#endif
|
||||||
|
18
patch/insets.c
Normal file
18
patch/insets.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
void
|
||||||
|
setinset(Monitor *m, Inset inset)
|
||||||
|
{
|
||||||
|
Bar *bar;
|
||||||
|
m->inset = inset;
|
||||||
|
updatebarpos(m);
|
||||||
|
for (bar = m->bar; bar; bar = bar->next)
|
||||||
|
XMoveResizeWindow(dpy, bar->win, bar->bx, bar->by, bar->bw, bar->bh);
|
||||||
|
arrange(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
updateinset(const Arg *arg)
|
||||||
|
{
|
||||||
|
Inset *inset = (Inset *)arg->v;
|
||||||
|
for (Monitor *m = mons; m; m = m->next)
|
||||||
|
setinset(m, *inset);
|
||||||
|
}
|
2
patch/insets.h
Normal file
2
patch/insets.h
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
static void setinset(Monitor *m, Inset inset);
|
||||||
|
static void updateinset(const Arg *arg);
|
@ -458,6 +458,12 @@
|
|||||||
*/
|
*/
|
||||||
#define INPLACEROTATE_PATCH 0
|
#define INPLACEROTATE_PATCH 0
|
||||||
|
|
||||||
|
/* This patch lets you define custom insets from each edge of the screen. One use case would be
|
||||||
|
* to arrange space for an external bar.
|
||||||
|
* https://dwm.suckless.org/patches/insets/
|
||||||
|
*/
|
||||||
|
#define INSETS_PATCH 0
|
||||||
|
|
||||||
/* Adds rule option for clients to avoid accidental termination by killclient for sticky windows.
|
/* Adds rule option for clients to avoid accidental termination by killclient for sticky windows.
|
||||||
* https://dwm.suckless.org/patches/ispermanent/
|
* https://dwm.suckless.org/patches/ispermanent/
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user