mirror of
https://github.com/tiyn/dwm.git
synced 2025-10-15 20:31:18 +02:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
27410ff91e | |||
df1e7626e4 | |||
|
137c32d0f2 |
@@ -26,9 +26,9 @@ static const Rule rules[] = {
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
||||
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
||||
/* class instance title tags mask iscentered isfloating monitor */
|
||||
{ "Gimp", NULL, NULL, 0, 0, 1, -1 },
|
||||
{ "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@@ -41,7 +41,6 @@ static const Layout layouts[] = {
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
{ "[D]", deck },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
@@ -77,7 +76,6 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
|
58
dwm-center-6.1.diff
Normal file
58
dwm-center-6.1.diff
Normal file
@@ -0,0 +1,58 @@
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 7054c06..e0cdcf3 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -24,9 +24,9 @@ static const Rule rules[] = {
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
- /* class instance title tags mask isfloating monitor */
|
||||
- { "Gimp", NULL, NULL, 0, 1, -1 },
|
||||
- { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
||||
+ /* class instance title tags mask iscentered isfloating monitor */
|
||||
+ { "Gimp", NULL, NULL, 0, 0, 1, -1 },
|
||||
+ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 0362114..4aaaa60 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -92,7 +92,7 @@ struct Client {
|
||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||
int bw, oldbw;
|
||||
unsigned int tags;
|
||||
- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||
+ int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||
Client *next;
|
||||
Client *snext;
|
||||
Monitor *mon;
|
||||
@@ -137,6 +137,7 @@ typedef struct {
|
||||
const char *instance;
|
||||
const char *title;
|
||||
unsigned int tags;
|
||||
+ int iscentered;
|
||||
int isfloating;
|
||||
int monitor;
|
||||
} Rule;
|
||||
@@ -296,6 +297,7 @@ applyrules(Client *c)
|
||||
&& (!r->class || strstr(class, r->class))
|
||||
&& (!r->instance || strstr(instance, r->instance)))
|
||||
{
|
||||
+ c->iscentered = r->iscentered;
|
||||
c->isfloating = r->isfloating;
|
||||
c->tags |= r->tags;
|
||||
for (m = mons; m && m->num != r->monitor; m = m->next);
|
||||
@@ -1063,6 +1065,11 @@ manage(Window w, XWindowAttributes *wa)
|
||||
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
|
||||
c->bw = borderpx;
|
||||
|
||||
+ if(c->iscentered) {
|
||||
+ c->x = (c->mon->mw - WIDTH(c)) / 2;
|
||||
+ c->y = (c->mon->mh - HEIGHT(c)) / 2;
|
||||
+ }
|
||||
+
|
||||
wc.border_width = c->bw;
|
||||
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
|
||||
XSetWindowBorder(dpy, w, scheme[SchemeNorm].border->pix);
|
@@ -1,90 +0,0 @@
|
||||
From cb3cac91db32403bb581aecbc2957b00bb49c898 Mon Sep 17 00:00:00 2001
|
||||
From: aleks <aleks.stier@icloud.com>
|
||||
Date: Mon, 6 May 2019 16:34:58 +0200
|
||||
Subject: [PATCH] Add deck-layout
|
||||
|
||||
deck is a dwm-layout which is inspired by the TTWM window manager.
|
||||
It applies the monocle-layout to the clients in the stack.
|
||||
The master-client is still visible. The stacked clients are like
|
||||
a deck of cards, hence the name.
|
||||
|
||||
The vanilla patch doesn't work properly with patches which add gaps.
|
||||
This means that when the deck-layout is activated gaps are omitted.
|
||||
To make it work with the tilegap-patch apply the dwm-deck-tilegap patch
|
||||
on top of the dwm-deck patch.
|
||||
|
||||
The vanilla patch doesn't respect the master-area which is defined by
|
||||
the rmaster-patch. To make it work with the rmaster-patch apply the
|
||||
dwm-deck-rmaster patch on top of the dwm-deck patch.
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
dwm.c | 26 ++++++++++++++++++++++++++
|
||||
2 files changed, 28 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 77ff358..55d8a07 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -32,6 +32,7 @@ static const Layout layouts[] = {
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
+ { "[D]", deck },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
@@ -66,6 +67,7 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
+ { MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 1d78655..356ab44 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -171,6 +171,7 @@ static void configure(Client *c);
|
||||
static void configurenotify(XEvent *e);
|
||||
static void configurerequest(XEvent *e);
|
||||
static Monitor *createmon(void);
|
||||
+static void deck(Monitor *m);
|
||||
static void destroynotify(XEvent *e);
|
||||
static void detach(Client *c);
|
||||
static void detachstack(Client *c);
|
||||
@@ -669,6 +670,31 @@ destroynotify(XEvent *e) {
|
||||
unmanage(c, True);
|
||||
}
|
||||
|
||||
+void
|
||||
+deck(Monitor *m) {
|
||||
+ unsigned int i, n, h, mw, my;
|
||||
+ Client *c;
|
||||
+
|
||||
+ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
+ if(n == 0)
|
||||
+ return;
|
||||
+
|
||||
+ if(n > m->nmaster) {
|
||||
+ mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
|
||||
+ }
|
||||
+ else
|
||||
+ mw = m->ww;
|
||||
+ for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
+ if(i < m->nmaster) {
|
||||
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||
+ resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
|
||||
+ my += HEIGHT(c);
|
||||
+ }
|
||||
+ else
|
||||
+ resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
|
||||
+}
|
||||
+
|
||||
void
|
||||
detach(Client *c) {
|
||||
Client **tc;
|
||||
--
|
||||
2.21.0
|
||||
|
35
dwm.c
35
dwm.c
@@ -92,7 +92,7 @@ struct Client {
|
||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||
int bw, oldbw;
|
||||
unsigned int tags;
|
||||
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||
int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||
Client *next;
|
||||
Client *snext;
|
||||
Monitor *mon;
|
||||
@@ -137,6 +137,7 @@ typedef struct {
|
||||
const char *instance;
|
||||
const char *title;
|
||||
unsigned int tags;
|
||||
int iscentered;
|
||||
int isfloating;
|
||||
int monitor;
|
||||
} Rule;
|
||||
@@ -157,7 +158,6 @@ static void configure(Client *c);
|
||||
static void configurenotify(XEvent *e);
|
||||
static void configurerequest(XEvent *e);
|
||||
static Monitor *createmon(void);
|
||||
static void deck(Monitor *m);
|
||||
static void destroynotify(XEvent *e);
|
||||
static void detach(Client *c);
|
||||
static void detachstack(Client *c);
|
||||
@@ -298,6 +298,7 @@ applyrules(Client *c)
|
||||
&& (!r->class || strstr(class, r->class))
|
||||
&& (!r->instance || strstr(instance, r->instance)))
|
||||
{
|
||||
c->iscentered = r->iscentered;
|
||||
c->isfloating = r->isfloating;
|
||||
c->tags |= r->tags;
|
||||
for (m = mons; m && m->num != r->monitor; m = m->next);
|
||||
@@ -655,31 +656,6 @@ destroynotify(XEvent *e)
|
||||
unmanage(c, 1);
|
||||
}
|
||||
|
||||
void
|
||||
deck(Monitor *m) {
|
||||
unsigned int i, n, h, mw, my;
|
||||
Client *c;
|
||||
|
||||
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if(n == 0)
|
||||
return;
|
||||
|
||||
if(n > m->nmaster) {
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
|
||||
}
|
||||
else
|
||||
mw = m->ww;
|
||||
for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if(i < m->nmaster) {
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
|
||||
my += HEIGHT(c);
|
||||
}
|
||||
else
|
||||
resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
|
||||
}
|
||||
|
||||
void
|
||||
detach(Client *c)
|
||||
{
|
||||
@@ -1075,6 +1051,11 @@ manage(Window w, XWindowAttributes *wa)
|
||||
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
|
||||
c->bw = borderpx;
|
||||
|
||||
if(c->iscentered) {
|
||||
c->x = (c->mon->mw - WIDTH(c)) / 2;
|
||||
c->y = (c->mon->mh - HEIGHT(c)) / 2;
|
||||
}
|
||||
|
||||
wc.border_width = c->bw;
|
||||
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
|
||||
XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
|
||||
|
Reference in New Issue
Block a user