Compare commits
8 Commits
3afd11471c
...
f90eea39df
Author | SHA1 | Date | |
---|---|---|---|
|
f90eea39df | ||
|
0d9b76aa1a | ||
|
e6862bb55b | ||
|
bf75862bd1 | ||
|
3082e83593 | ||
|
e3b516bb90 | ||
|
9df2ed17a0 | ||
|
641ff6fb57 |
@ -2,6 +2,7 @@
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int gappx = 18; /* gap pixel between windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
||||
static const int showbar = 1; /* 0 means no standard bar */
|
||||
@ -9,6 +10,8 @@ static const int topbar = 1; /* 0 means standard bar at botto
|
||||
static const int extrabar = 1; /* 0 means no extra bar */
|
||||
static const char statussep = ';'; /* separator between statuses */
|
||||
static const int user_bh = 2; /* 2 is the default spacing around the bar's font */
|
||||
static const int vertpad = 10; /* vertical padding of bar */
|
||||
static const int sidepad = 10; /* horizontal padding of bar */
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
@ -107,6 +110,7 @@ static const Key keys[] = {
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
|
3
dwm.1
3
dwm.1
@ -120,6 +120,9 @@ Zooms/cycles focused window to/from master area (tiled layouts only).
|
||||
.B Mod1\-Shift\-c
|
||||
Close focused window.
|
||||
.TP
|
||||
.B Mod1\-Shift\-f
|
||||
Toggle fullscreen for focused window.
|
||||
.TP
|
||||
.B Mod1\-Shift\-space
|
||||
Toggle focused window between tiled and floating state.
|
||||
.TP
|
||||
|
138
dwm.c
138
dwm.c
@ -239,11 +239,13 @@ static void showwin(Client *c);
|
||||
static void showhide(Client *c);
|
||||
static void sighup(int unused);
|
||||
static void sigterm(int unused);
|
||||
static int solitary(Client *c);
|
||||
static void spawn(const Arg *arg);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
static void togglebar(const Arg *arg);
|
||||
static void togglefullscr(const Arg *arg);
|
||||
static void toggleextrabar(const Arg *arg);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefollow(const Arg *arg);
|
||||
@ -289,6 +291,8 @@ static int screen;
|
||||
static int sw, sh; /* X display screen geometry width, height */
|
||||
static int bh; /* bar height */
|
||||
static int lrpad; /* sum of left and right padding for text */
|
||||
static int vp; /* vertical padding for bar */
|
||||
static int sp; /* side padding for bar */
|
||||
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||
static unsigned int numlockmask = 0;
|
||||
static void (*handler[LASTEvent]) (XEvent *) = {
|
||||
@ -712,8 +716,8 @@ configurenotify(XEvent *e)
|
||||
for (c = m->clients; c; c = c->next)
|
||||
if (c->isfullscreen)
|
||||
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
||||
XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
|
||||
XMoveResizeWindow(dpy, m->extrabarwin, m->wx, m->eby, m->ww, bh);
|
||||
XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh);
|
||||
XMoveResizeWindow(dpy, m->extrabarwin, m->wx + sp, m->eby - vp, m->ww - 2 * sp, bh);
|
||||
}
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
@ -866,6 +870,7 @@ drawbar(Monitor *m)
|
||||
int boxs = drw->fonts->h / 9;
|
||||
int boxw = drw->fonts->h / 6 + 2;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
int mid;
|
||||
Client *c;
|
||||
|
||||
if (!m->showbar)
|
||||
@ -874,7 +879,7 @@ drawbar(Monitor *m)
|
||||
/* draw status first so it can be overdrawn by tags later */
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
||||
drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
|
||||
drw_text(drw, m->ww - tw - 2 * sp, 0, tw, bh, 0, stext, 0);
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
if (ISVISIBLE(c))
|
||||
@ -888,16 +893,22 @@ drawbar(Monitor *m)
|
||||
w = TEXTW(tags[i]);
|
||||
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeNorm : SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
|
||||
if (ulineall || m->tagset[m->seltags] & 1 << i) /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */
|
||||
drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0);
|
||||
if (occ & 1 << i)
|
||||
drw_rect(drw, x + boxs, boxs, boxw, boxw,
|
||||
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||
urg & 1 << i);
|
||||
|
||||
if (ulineall || m->tagset[m->seltags] & 1 << i) { /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */
|
||||
if (m == selmon)
|
||||
drw_setscheme(drw, scheme[SchemeHid]);
|
||||
drw_rect(drw, x + w * 0.0675, bh - ulinestroke - ulinevoffset, w * 0.875, ulinestroke, 1, 0);
|
||||
} else if (occ & 1 << i) {
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
if (urg)
|
||||
drw_rect(drw, x + boxs, boxs, boxw, boxw, m == selmon && selmon->sel && selmon->sel->tags & 1 << i, 1);
|
||||
else
|
||||
drw_rect(drw, x + w * 0.375, bh - ulinestroke - ulinevoffset, w * 0.25, ulinestroke, 1, 0);
|
||||
}
|
||||
x += w;
|
||||
}
|
||||
w = TEXTW(m->ltsymbol);
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_setscheme(drw, scheme[SchemeSel]);
|
||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||
|
||||
w = TEXTW(wfsymbol);
|
||||
@ -910,9 +921,7 @@ drawbar(Monitor *m)
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
if (!ISVISIBLE(c))
|
||||
continue;
|
||||
if (m->sel == c && m == selmon)
|
||||
scm = SchemeSel;
|
||||
else if (HIDDEN(c))
|
||||
if (HIDDEN(c))
|
||||
scm = SchemeHid;
|
||||
else
|
||||
scm = SchemeNorm;
|
||||
@ -924,12 +933,25 @@ drawbar(Monitor *m)
|
||||
}
|
||||
remainder--;
|
||||
}
|
||||
drw_text(drw, x, 0, tabw, bh, lrpad / 2, c->name, 0);
|
||||
mid = (tabw - (int)TEXTW(c->name)) / 2;
|
||||
mid = mid >= lrpad / 2 ? mid : lrpad / 2;
|
||||
drw_text(drw, x, 0, tabw - 2 * sp, bh, mid, c->name, 0);
|
||||
|
||||
if (!HIDDEN(c)) {
|
||||
if (m->sel == c) {
|
||||
if (m == selmon)
|
||||
drw_setscheme(drw, scheme[SchemeHid]);
|
||||
drw_rect(drw, x + tabw * 0.0675, bh - ulinestroke - ulinevoffset, tabw * 0.875 - ulinepad * 2, ulinestroke, 1, 0);
|
||||
} else {
|
||||
drw_rect(drw, x + tabw * 0.375, bh - ulinestroke - ulinevoffset, tabw * 0.25 - ulinepad * 2, ulinestroke, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
x += tabw;
|
||||
}
|
||||
} else {
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1);
|
||||
}
|
||||
}
|
||||
m->bt = n;
|
||||
@ -940,9 +962,9 @@ drawbar(Monitor *m)
|
||||
/* clear default bar draw buffer by drawing a blank rectangle */
|
||||
drw_rect(drw, 0, 0, m->ww, bh, 1, 1);
|
||||
etwr = TEXTW(estextr) - lrpad + 2; /* 2px right padding */
|
||||
drw_text(drw, m->ww - etwr, 0, etwr, bh, 0, estextr, 0);
|
||||
drw_text(drw, m->ww - etwr - 2 * sp, 0, etwr, bh, 0, estextr, 0);
|
||||
etwl = TEXTW(estextl);
|
||||
drw_text(drw, 0, 0, etwl, bh, 0, estextl, 0);
|
||||
drw_text(drw, 0, 0, etwl + 2 * sp, bh, 0, estextl, 0);
|
||||
drw_map(drw, m->extrabarwin, 0, 0, m->ww, bh);
|
||||
}
|
||||
|
||||
@ -1017,7 +1039,11 @@ focus(Client *c)
|
||||
detachstack(c);
|
||||
attachstack(c);
|
||||
grabbuttons(c, 1);
|
||||
/* Avoid flickering when another client appears and the border
|
||||
* is restored */
|
||||
if (!solitary(c)) {
|
||||
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
|
||||
}
|
||||
setfocus(c);
|
||||
} else {
|
||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||
@ -1437,7 +1463,7 @@ monocle(Monitor *m)
|
||||
if (n > 0) /* override layout symbol */
|
||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
|
||||
for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
|
||||
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||
resize(c, m->wx + gappx, m->wy + gappx, m->ww - 2 * c->bw - 2 * gappx, m->wh - 2 * c->bw - 2 * gappx, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1667,6 +1693,11 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
||||
c->oldw = c->w; c->w = wc.width = w;
|
||||
c->oldh = c->h; c->h = wc.height = h;
|
||||
wc.border_width = c->bw;
|
||||
if (solitary(c)) {
|
||||
c->w = wc.width += c->bw * 2;
|
||||
c->h = wc.height += c->bw * 2;
|
||||
wc.border_width = 0;
|
||||
}
|
||||
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||
configure(c);
|
||||
XSync(dpy, False);
|
||||
@ -1851,6 +1882,8 @@ sendmon(Client *c, Monitor *m)
|
||||
c->mon = m;
|
||||
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||
attachbottom(c);
|
||||
c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
|
||||
c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
|
||||
attachstack(c);
|
||||
setclienttagprop(c);
|
||||
focus(NULL);
|
||||
@ -2017,6 +2050,8 @@ setup(void)
|
||||
die("no fonts could be loaded.");
|
||||
lrpad = drw->fonts->h;
|
||||
bh = drw->fonts->h + user_bh;
|
||||
sp = sidepad;
|
||||
vp = (topbar == 1) ? vertpad : - vertpad;
|
||||
updategeom();
|
||||
/* init atoms */
|
||||
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
||||
@ -2150,6 +2185,15 @@ sigterm(int unused)
|
||||
quit(&a);
|
||||
}
|
||||
|
||||
int
|
||||
solitary(Client *c)
|
||||
{
|
||||
return ((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|
||||
|| &monocle == c->mon->lt[c->mon->sellt]->arrange)
|
||||
&& !c->isfullscreen && !c->isfloating
|
||||
&& NULL != c->mon->lt[c->mon->sellt]->arrange;
|
||||
}
|
||||
|
||||
void
|
||||
spawn(const Arg *arg)
|
||||
{
|
||||
@ -2208,28 +2252,31 @@ tagmon(const Arg *arg)
|
||||
void
|
||||
tile(Monitor *m)
|
||||
{
|
||||
unsigned int i, n, h, mw, my, ty;
|
||||
unsigned int i, n, h, mw, my, ty, ns;
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
if (n > m->nmaster)
|
||||
if (n > m->nmaster) {
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
else
|
||||
mw = m->ww;
|
||||
for (i = my = ty = 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), 0);
|
||||
if (my + HEIGHT(c) < m->wh)
|
||||
my += HEIGHT(c);
|
||||
ns = m->nmaster > 0 ? 2 : 1;
|
||||
} else {
|
||||
h = (m->wh - ty) / (n - i);
|
||||
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
mw = m->ww;
|
||||
ns = 1;
|
||||
}
|
||||
for(i = 0, my = ty = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
|
||||
resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
|
||||
if (my + HEIGHT(c) < m->wh)
|
||||
my += HEIGHT(c) + gappx;
|
||||
} else {
|
||||
h = (m->wh - ty) / (n - i) - gappx;
|
||||
resize(c, m->wx + mw + gappx/ns, m->wy + ty, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
|
||||
if (ty + HEIGHT(c) < m->wh)
|
||||
ty += HEIGHT(c);
|
||||
ty += HEIGHT(c) + gappx;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2247,7 +2294,7 @@ togglebar(const Arg *arg)
|
||||
selmon->pertag->showbars[0] = selmon->showbar;
|
||||
}
|
||||
updatebarpos(selmon);
|
||||
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
|
||||
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@ -2293,6 +2340,13 @@ togglefloating(const Arg *arg)
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
togglefullscr(const Arg *arg)
|
||||
{
|
||||
if(selmon->sel)
|
||||
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
|
||||
}
|
||||
|
||||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
@ -2450,7 +2504,7 @@ updatebars(void)
|
||||
XClassHint ch = {"dwm", "dwm"};
|
||||
for (m = mons; m; m = m->next) {
|
||||
if (!m->barwin) {
|
||||
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth,
|
||||
m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, depth,
|
||||
InputOutput, visual,
|
||||
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
|
||||
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
||||
@ -2458,7 +2512,7 @@ updatebars(void)
|
||||
XSetClassHint(dpy, m->barwin, &ch);
|
||||
}
|
||||
if (!m->extrabarwin) {
|
||||
m->extrabarwin = XCreateWindow(dpy, root, m->wx, m->eby, m->ww, bh, 0, depth,
|
||||
m->extrabarwin = XCreateWindow(dpy, root, m->wx + sp, m->eby - vp, m->ww - 2 * sp, bh, 0, depth,
|
||||
InputOutput, visual,
|
||||
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
|
||||
XDefineCursor(dpy, m->extrabarwin, cursor[CurNormal]->cursor);
|
||||
@ -2474,17 +2528,17 @@ updatebarpos(Monitor *m)
|
||||
m->wy = m->my;
|
||||
m->wh = m->mh;
|
||||
if (m->showbar) {
|
||||
m->wh -= bh;
|
||||
m->by = m->topbar ? m->wy : m->wy + m->wh;
|
||||
m->wy = m->topbar ? m->wy + bh : m->wy;
|
||||
m->wh = m->wh - vertpad - bh;
|
||||
m->by = m->topbar ? m->wy : m->wy + m->wh + vertpad;
|
||||
m->wy = m->topbar ? m->wy + bh + vp: m->wy;
|
||||
} else
|
||||
m->by = -bh;
|
||||
m->by = -bh - vp;
|
||||
if (m->extrabar) {
|
||||
m->wh -= bh;
|
||||
m->eby = !m->topbar ? m->wy : m->wy + m->wh;
|
||||
m->wy = !m->topbar ? m->wy + bh : m->wy;
|
||||
m->wh = m-> wh - vertpad - bh;
|
||||
m->eby = !m->topbar ? m->wy : m->wy + m->wh + vertpad;
|
||||
m->wy = !m->topbar ? m->wy + bh + vp : m->wy;
|
||||
} else
|
||||
m->eby = -bh;
|
||||
m->eby = -bh - vp;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -0,0 +1,53 @@
|
||||
diff --git dwm.c dwm.c
|
||||
index 0fc328a..4a767bd 100644
|
||||
--- dwm.c
|
||||
+++ dwm.c
|
||||
@@ -206,6 +206,7 @@ static void setup(void);
|
||||
static void seturgent(Client *c, int urg);
|
||||
static void showhide(Client *c);
|
||||
static void sigchld(int unused);
|
||||
+static int solitary(Client *c);
|
||||
static void spawn(const Arg *arg);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
@@ -802,7 +803,11 @@ focus(Client *c)
|
||||
detachstack(c);
|
||||
attachstack(c);
|
||||
grabbuttons(c, 1);
|
||||
- XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
|
||||
+ /* Avoid flickering when another client appears and the border
|
||||
+ * is restored */
|
||||
+ if (!solitary(c)) {
|
||||
+ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
|
||||
+ }
|
||||
setfocus(c);
|
||||
} else {
|
||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||
@@ -1288,6 +1293,11 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
||||
c->oldw = c->w; c->w = wc.width = w;
|
||||
c->oldh = c->h; c->h = wc.height = h;
|
||||
wc.border_width = c->bw;
|
||||
+ if (solitary(c)) {
|
||||
+ c->w = wc.width += c->bw * 2;
|
||||
+ c->h = wc.height += c->bw * 2;
|
||||
+ wc.border_width = 0;
|
||||
+ }
|
||||
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||
configure(c);
|
||||
XSync(dpy, False);
|
||||
@@ -1642,6 +1652,15 @@ sigchld(int unused)
|
||||
while (0 < waitpid(-1, NULL, WNOHANG));
|
||||
}
|
||||
|
||||
+int
|
||||
+solitary(Client *c)
|
||||
+{
|
||||
+ return ((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|
||||
+ || &monocle == c->mon->lt[c->mon->sellt]->arrange)
|
||||
+ && !c->isfullscreen && !c->isfloating
|
||||
+ && NULL != c->mon->lt[c->mon->sellt]->arrange;
|
||||
+}
|
||||
+
|
||||
void
|
||||
spawn(const Arg *arg)
|
||||
{
|
77
patches/appearance/dwm-tilegap-6.4.diff
Normal file
77
patches/appearance/dwm-tilegap-6.4.diff
Normal file
@ -0,0 +1,77 @@
|
||||
From e655302a4bd74c1f2778f94761c87381d1dfc0e2 Mon Sep 17 00:00:00 2001
|
||||
From: midspec <obleque@protonmail.com>
|
||||
Date: Sat, 4 Nov 2023 19:17:50 +0000
|
||||
Subject: [PATCH] Add window-gaps for the tile-layout
|
||||
|
||||
Adds gaps between windows in the tile-layout. The proposed advantage to some
|
||||
other patches which try to accomplish the same goal is that the gap-size between
|
||||
master and stack, window and window, and window and screen-edge is the
|
||||
same. The gap-size can be configured in the config.h with the
|
||||
gappx-variable.
|
||||
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwm.c | 23 +++++++++++++----------
|
||||
2 files changed, 14 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 9efa774..82ba41f 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
+static const unsigned int gappx = 18; /* gap pixel between windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index f1d86b2..fa8b3d6 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -1687,28 +1687,31 @@ tagmon(const Arg *arg)
|
||||
void
|
||||
tile(Monitor *m)
|
||||
{
|
||||
- unsigned int i, n, h, mw, my, ty;
|
||||
+ unsigned int i, n, h, mw, my, ty, ns;
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
- if (n > m->nmaster)
|
||||
+ if (n > m->nmaster) {
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
- else
|
||||
+ ns = m->nmaster > 0 ? 2 : 1;
|
||||
+ } else {
|
||||
mw = m->ww;
|
||||
- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
+ ns = 1;
|
||||
+ }
|
||||
+ for(i = 0, my = ty = gappx, 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), 0);
|
||||
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
|
||||
+ resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
|
||||
if (my + HEIGHT(c) < m->wh)
|
||||
- my += HEIGHT(c);
|
||||
+ my += HEIGHT(c) + gappx;
|
||||
} else {
|
||||
- h = (m->wh - ty) / (n - i);
|
||||
- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
+ h = (m->wh - ty) / (n - i) - gappx;
|
||||
+ resize(c, m->wx + mw + gappx/ns, m->wy + ty, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
|
||||
if (ty + HEIGHT(c) < m->wh)
|
||||
- ty += HEIGHT(c);
|
||||
+ ty += HEIGHT(c) + gappx;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.42.0
|
||||
|
118
patches/bar/appearance/dwm-barpadding-20211020-a786211.diff
Normal file
118
patches/bar/appearance/dwm-barpadding-20211020-a786211.diff
Normal file
@ -0,0 +1,118 @@
|
||||
From a3cfb215f7f647d83d67e33df8f33a73e43bd65f Mon Sep 17 00:00:00 2001
|
||||
From: Bakkeby <bakkeby@gmail.com>
|
||||
Date: Wed, 20 Oct 2021 09:14:07 +0200
|
||||
Subject: [PATCH] barpadding: adds space between the statusbar and the edge of
|
||||
the screen
|
||||
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
dwm.c | 25 +++++++++++++++----------
|
||||
2 files changed, 17 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a2ac963..f0b739f 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -5,6 +5,8 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
+static const int vertpad = 10; /* vertical padding of bar */
|
||||
+static const int sidepad = 10; /* horizontal padding of bar */
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 5e4d494..df6d0d7 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -242,6 +242,8 @@ static int screen;
|
||||
static int sw, sh; /* X display screen geometry width, height */
|
||||
static int bh, blw = 0; /* bar geometry */
|
||||
static int lrpad; /* sum of left and right padding for text */
|
||||
+static int vp; /* vertical padding for bar */
|
||||
+static int sp; /* side padding for bar */
|
||||
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||
static unsigned int numlockmask = 0;
|
||||
static void (*handler[LASTEvent]) (XEvent *) = {
|
||||
@@ -568,7 +570,7 @@ configurenotify(XEvent *e)
|
||||
for (c = m->clients; c; c = c->next)
|
||||
if (c->isfullscreen)
|
||||
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
||||
- XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
|
||||
+ XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh);
|
||||
}
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
@@ -706,7 +708,7 @@ drawbar(Monitor *m)
|
||||
if (m == selmon) { /* status is only drawn on selected monitor */
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
||||
- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
|
||||
+ drw_text(drw, m->ww - tw - 2 * sp, 0, tw, bh, 0, stext, 0);
|
||||
}
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
@@ -732,12 +734,12 @@ drawbar(Monitor *m)
|
||||
if ((w = m->ww - tw - x) > bh) {
|
||||
if (m->sel) {
|
||||
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
||||
- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||
+ drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2, m->sel->name, 0);
|
||||
if (m->sel->isfloating)
|
||||
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
||||
} else {
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
- drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
+ drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1);
|
||||
}
|
||||
}
|
||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||
@@ -1547,7 +1549,10 @@ setup(void)
|
||||
die("no fonts could be loaded.");
|
||||
lrpad = drw->fonts->h;
|
||||
bh = drw->fonts->h + 2;
|
||||
+ sp = sidepad;
|
||||
+ vp = (topbar == 1) ? vertpad : - vertpad;
|
||||
updategeom();
|
||||
+
|
||||
/* init atoms */
|
||||
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
||||
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
|
||||
@@ -1704,7 +1709,7 @@ togglebar(const Arg *arg)
|
||||
{
|
||||
selmon->showbar = !selmon->showbar;
|
||||
updatebarpos(selmon);
|
||||
- XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
|
||||
+ XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@@ -1814,7 +1819,7 @@ updatebars(void)
|
||||
for (m = mons; m; m = m->next) {
|
||||
if (m->barwin)
|
||||
continue;
|
||||
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
|
||||
+ m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, DefaultDepth(dpy, screen),
|
||||
CopyFromParent, DefaultVisual(dpy, screen),
|
||||
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
|
||||
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
||||
@@ -1829,11 +1834,11 @@ updatebarpos(Monitor *m)
|
||||
m->wy = m->my;
|
||||
m->wh = m->mh;
|
||||
if (m->showbar) {
|
||||
- m->wh -= bh;
|
||||
- m->by = m->topbar ? m->wy : m->wy + m->wh;
|
||||
- m->wy = m->topbar ? m->wy + bh : m->wy;
|
||||
+ m->wh = m->wh - vertpad - bh;
|
||||
+ m->by = m->topbar ? m->wy : m->wy + m->wh + vertpad;
|
||||
+ m->wy = m->topbar ? m->wy + bh + vp : m->wy;
|
||||
} else
|
||||
- m->by = -bh;
|
||||
+ m->by = -bh - vp;
|
||||
}
|
||||
|
||||
void
|
||||
--
|
||||
2.33.0
|
||||
|
28
patches/behavior/dwm-sendmoncenter-20210805-138b405f.diff
Normal file
28
patches/behavior/dwm-sendmoncenter-20210805-138b405f.diff
Normal file
@ -0,0 +1,28 @@
|
||||
From 449324adbe53240a734cb5f8f72763bb3419829a Mon Sep 17 00:00:00 2001
|
||||
From: Rizqi Nur Assyaufi <bandithijo@gmail.com>
|
||||
Date: Sat, 5 Aug 2021 00:04:32 +0800
|
||||
Subject: [PATCH] [sendmoncenter] Send floating window to another monitor will
|
||||
centered
|
||||
|
||||
This patch will allows you to send floating window client to another monitor
|
||||
will be centered position.
|
||||
---
|
||||
dwm.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 5e4d494..c20023e 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -1418,6 +1418,8 @@ sendmon(Client *c, Monitor *m)
|
||||
detachstack(c);
|
||||
c->mon = m;
|
||||
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||
+ c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
|
||||
+ c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
|
||||
attach(c);
|
||||
attachstack(c);
|
||||
focus(NULL);
|
||||
--
|
||||
2.31.1
|
||||
|
68
patches/functions/dwm-actualfullscreen-20211013-cb3f58a.diff
Normal file
68
patches/functions/dwm-actualfullscreen-20211013-cb3f58a.diff
Normal file
@ -0,0 +1,68 @@
|
||||
From eea13010ffc3983392857ee1e3804e3aa1064d7a Mon Sep 17 00:00:00 2001
|
||||
From: Soenke Lambert <s.lambert@mittwald.de>
|
||||
Date: Wed, 13 Oct 2021 18:21:09 +0200
|
||||
Subject: [PATCH] Fullscreen current window with [Alt]+[Shift]+[f]
|
||||
|
||||
This actually fullscreens a window, instead of just hiding the statusbar
|
||||
and applying the monocle layout.
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwm.1 | 3 +++
|
||||
dwm.c | 8 ++++++++
|
||||
3 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 1c0b587..8cd3204 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -78,6 +78,7 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
+ { MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
diff --git a/dwm.1 b/dwm.1
|
||||
index 13b3729..a368d05 100644
|
||||
--- a/dwm.1
|
||||
+++ b/dwm.1
|
||||
@@ -116,6 +116,9 @@ Zooms/cycles focused window to/from master area (tiled layouts only).
|
||||
.B Mod1\-Shift\-c
|
||||
Close focused window.
|
||||
.TP
|
||||
+.B Mod1\-Shift\-f
|
||||
+Toggle fullscreen for focused window.
|
||||
+.TP
|
||||
.B Mod1\-Shift\-space
|
||||
Toggle focused window between tiled and floating state.
|
||||
.TP
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 4465af1..c1b899a 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -211,6 +211,7 @@ static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *);
|
||||
static void togglebar(const Arg *arg);
|
||||
static void togglefloating(const Arg *arg);
|
||||
+static void togglefullscr(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void unfocus(Client *c, int setfocus);
|
||||
@@ -1719,6 +1720,13 @@ togglefloating(const Arg *arg)
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
+void
|
||||
+togglefullscr(const Arg *arg)
|
||||
+{
|
||||
+ if(selmon->sel)
|
||||
+ setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
|
||||
+}
|
||||
+
|
||||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.30.2
|
||||
|
Loading…
Reference in New Issue
Block a user