Compare commits
1 Commits
f90eea39df
...
3afd11471c
Author | SHA1 | Date | |
---|---|---|---|
|
3afd11471c |
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
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 unsigned int snap = 32; /* snap pixel */
|
||||||
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
||||||
static const int showbar = 1; /* 0 means no standard bar */
|
static const int showbar = 1; /* 0 means no standard bar */
|
||||||
@ -10,8 +9,6 @@ static const int topbar = 1; /* 0 means standard bar at botto
|
|||||||
static const int extrabar = 1; /* 0 means no extra bar */
|
static const int extrabar = 1; /* 0 means no extra bar */
|
||||||
static const char statussep = ';'; /* separator between statuses */
|
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 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 *fonts[] = { "monospace:size=10" };
|
||||||
static const char dmenufont[] = "monospace:size=10";
|
static const char dmenufont[] = "monospace:size=10";
|
||||||
static const char col_gray1[] = "#222222";
|
static const char col_gray1[] = "#222222";
|
||||||
@ -110,7 +107,6 @@ static const Key keys[] = {
|
|||||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||||
{ MODKEY, XK_space, setlayout, {0} },
|
{ MODKEY, XK_space, setlayout, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
|
||||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
|
3
dwm.1
3
dwm.1
@ -120,9 +120,6 @@ Zooms/cycles focused window to/from master area (tiled layouts only).
|
|||||||
.B Mod1\-Shift\-c
|
.B Mod1\-Shift\-c
|
||||||
Close focused window.
|
Close focused window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-f
|
|
||||||
Toggle fullscreen for focused window.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-Shift\-space
|
.B Mod1\-Shift\-space
|
||||||
Toggle focused window between tiled and floating state.
|
Toggle focused window between tiled and floating state.
|
||||||
.TP
|
.TP
|
||||||
|
99
dwm.c
99
dwm.c
@ -239,13 +239,11 @@ static void showwin(Client *c);
|
|||||||
static void showhide(Client *c);
|
static void showhide(Client *c);
|
||||||
static void sighup(int unused);
|
static void sighup(int unused);
|
||||||
static void sigterm(int unused);
|
static void sigterm(int unused);
|
||||||
static int solitary(Client *c);
|
|
||||||
static void spawn(const Arg *arg);
|
static void spawn(const Arg *arg);
|
||||||
static void tag(const Arg *arg);
|
static void tag(const Arg *arg);
|
||||||
static void tagmon(const Arg *arg);
|
static void tagmon(const Arg *arg);
|
||||||
static void tile(Monitor *m);
|
static void tile(Monitor *m);
|
||||||
static void togglebar(const Arg *arg);
|
static void togglebar(const Arg *arg);
|
||||||
static void togglefullscr(const Arg *arg);
|
|
||||||
static void toggleextrabar(const Arg *arg);
|
static void toggleextrabar(const Arg *arg);
|
||||||
static void togglefloating(const Arg *arg);
|
static void togglefloating(const Arg *arg);
|
||||||
static void togglefollow(const Arg *arg);
|
static void togglefollow(const Arg *arg);
|
||||||
@ -291,8 +289,6 @@ static int screen;
|
|||||||
static int sw, sh; /* X display screen geometry width, height */
|
static int sw, sh; /* X display screen geometry width, height */
|
||||||
static int bh; /* bar height */
|
static int bh; /* bar height */
|
||||||
static int lrpad; /* sum of left and right padding for text */
|
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 int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||||
static unsigned int numlockmask = 0;
|
static unsigned int numlockmask = 0;
|
||||||
static void (*handler[LASTEvent]) (XEvent *) = {
|
static void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
@ -716,8 +712,8 @@ configurenotify(XEvent *e)
|
|||||||
for (c = m->clients; c; c = c->next)
|
for (c = m->clients; c; c = c->next)
|
||||||
if (c->isfullscreen)
|
if (c->isfullscreen)
|
||||||
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
||||||
XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh);
|
XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
|
||||||
XMoveResizeWindow(dpy, m->extrabarwin, m->wx + sp, m->eby - vp, m->ww - 2 * sp, bh);
|
XMoveResizeWindow(dpy, m->extrabarwin, m->wx, m->eby, m->ww, bh);
|
||||||
}
|
}
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
@ -879,7 +875,7 @@ drawbar(Monitor *m)
|
|||||||
/* draw status first so it can be overdrawn by tags later */
|
/* draw status first so it can be overdrawn by tags later */
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
||||||
drw_text(drw, m->ww - tw - 2 * sp, 0, tw, bh, 0, stext, 0);
|
drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
|
||||||
|
|
||||||
for (c = m->clients; c; c = c->next) {
|
for (c = m->clients; c; c = c->next) {
|
||||||
if (ISVISIBLE(c))
|
if (ISVISIBLE(c))
|
||||||
@ -900,15 +896,12 @@ drawbar(Monitor *m)
|
|||||||
drw_rect(drw, x + w * 0.0675, bh - ulinestroke - ulinevoffset, w * 0.875, ulinestroke, 1, 0);
|
drw_rect(drw, x + w * 0.0675, bh - ulinestroke - ulinevoffset, w * 0.875, ulinestroke, 1, 0);
|
||||||
} else if (occ & 1 << i) {
|
} else if (occ & 1 << i) {
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
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);
|
drw_rect(drw, x + w * 0.375, bh - ulinestroke - ulinevoffset, w * 0.25, ulinestroke, 1, 0);
|
||||||
}
|
}
|
||||||
x += w;
|
x += w;
|
||||||
}
|
}
|
||||||
w = TEXTW(m->ltsymbol);
|
w = TEXTW(m->ltsymbol);
|
||||||
drw_setscheme(drw, scheme[SchemeSel]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||||
|
|
||||||
w = TEXTW(wfsymbol);
|
w = TEXTW(wfsymbol);
|
||||||
@ -935,7 +928,7 @@ drawbar(Monitor *m)
|
|||||||
}
|
}
|
||||||
mid = (tabw - (int)TEXTW(c->name)) / 2;
|
mid = (tabw - (int)TEXTW(c->name)) / 2;
|
||||||
mid = mid >= lrpad / 2 ? mid : lrpad / 2;
|
mid = mid >= lrpad / 2 ? mid : lrpad / 2;
|
||||||
drw_text(drw, x, 0, tabw - 2 * sp, bh, mid, c->name, 0);
|
drw_text(drw, x, 0, tabw, bh, mid, c->name, 0);
|
||||||
|
|
||||||
if (!HIDDEN(c)) {
|
if (!HIDDEN(c)) {
|
||||||
if (m->sel == c) {
|
if (m->sel == c) {
|
||||||
@ -951,7 +944,7 @@ drawbar(Monitor *m)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1);
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m->bt = n;
|
m->bt = n;
|
||||||
@ -962,9 +955,9 @@ drawbar(Monitor *m)
|
|||||||
/* clear default bar draw buffer by drawing a blank rectangle */
|
/* clear default bar draw buffer by drawing a blank rectangle */
|
||||||
drw_rect(drw, 0, 0, m->ww, bh, 1, 1);
|
drw_rect(drw, 0, 0, m->ww, bh, 1, 1);
|
||||||
etwr = TEXTW(estextr) - lrpad + 2; /* 2px right padding */
|
etwr = TEXTW(estextr) - lrpad + 2; /* 2px right padding */
|
||||||
drw_text(drw, m->ww - etwr - 2 * sp, 0, etwr, bh, 0, estextr, 0);
|
drw_text(drw, m->ww - etwr, 0, etwr, bh, 0, estextr, 0);
|
||||||
etwl = TEXTW(estextl);
|
etwl = TEXTW(estextl);
|
||||||
drw_text(drw, 0, 0, etwl + 2 * sp, bh, 0, estextl, 0);
|
drw_text(drw, 0, 0, etwl, bh, 0, estextl, 0);
|
||||||
drw_map(drw, m->extrabarwin, 0, 0, m->ww, bh);
|
drw_map(drw, m->extrabarwin, 0, 0, m->ww, bh);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1039,11 +1032,7 @@ focus(Client *c)
|
|||||||
detachstack(c);
|
detachstack(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
grabbuttons(c, 1);
|
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);
|
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
|
||||||
}
|
|
||||||
setfocus(c);
|
setfocus(c);
|
||||||
} else {
|
} else {
|
||||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||||
@ -1463,7 +1452,7 @@ monocle(Monitor *m)
|
|||||||
if (n > 0) /* override layout symbol */
|
if (n > 0) /* override layout symbol */
|
||||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
|
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
|
||||||
for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
|
for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
|
||||||
resize(c, m->wx + gappx, m->wy + gappx, m->ww - 2 * c->bw - 2 * gappx, m->wh - 2 * c->bw - 2 * gappx, 0);
|
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1693,11 +1682,6 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
|||||||
c->oldw = c->w; c->w = wc.width = w;
|
c->oldw = c->w; c->w = wc.width = w;
|
||||||
c->oldh = c->h; c->h = wc.height = h;
|
c->oldh = c->h; c->h = wc.height = h;
|
||||||
wc.border_width = c->bw;
|
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);
|
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||||
configure(c);
|
configure(c);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
@ -1882,8 +1866,6 @@ sendmon(Client *c, Monitor *m)
|
|||||||
c->mon = m;
|
c->mon = m;
|
||||||
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||||
attachbottom(c);
|
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);
|
attachstack(c);
|
||||||
setclienttagprop(c);
|
setclienttagprop(c);
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
@ -2050,8 +2032,6 @@ setup(void)
|
|||||||
die("no fonts could be loaded.");
|
die("no fonts could be loaded.");
|
||||||
lrpad = drw->fonts->h;
|
lrpad = drw->fonts->h;
|
||||||
bh = drw->fonts->h + user_bh;
|
bh = drw->fonts->h + user_bh;
|
||||||
sp = sidepad;
|
|
||||||
vp = (topbar == 1) ? vertpad : - vertpad;
|
|
||||||
updategeom();
|
updategeom();
|
||||||
/* init atoms */
|
/* init atoms */
|
||||||
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
||||||
@ -2185,15 +2165,6 @@ sigterm(int unused)
|
|||||||
quit(&a);
|
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
|
void
|
||||||
spawn(const Arg *arg)
|
spawn(const Arg *arg)
|
||||||
{
|
{
|
||||||
@ -2252,31 +2223,28 @@ tagmon(const Arg *arg)
|
|||||||
void
|
void
|
||||||
tile(Monitor *m)
|
tile(Monitor *m)
|
||||||
{
|
{
|
||||||
unsigned int i, n, h, mw, my, ty, ns;
|
unsigned int i, n, h, mw, my, ty;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (n > m->nmaster) {
|
if (n > m->nmaster)
|
||||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
ns = m->nmaster > 0 ? 2 : 1;
|
else
|
||||||
} else {
|
|
||||||
mw = m->ww;
|
mw = m->ww;
|
||||||
ns = 1;
|
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
}
|
|
||||||
for(i = 0, my = ty = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
|
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||||
resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
|
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
|
||||||
if (my + HEIGHT(c) < m->wh)
|
if (my + HEIGHT(c) < m->wh)
|
||||||
my += HEIGHT(c) + gappx;
|
my += HEIGHT(c);
|
||||||
} else {
|
} else {
|
||||||
h = (m->wh - ty) / (n - i) - gappx;
|
h = (m->wh - ty) / (n - i);
|
||||||
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);
|
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||||
if (ty + HEIGHT(c) < m->wh)
|
if (ty + HEIGHT(c) < m->wh)
|
||||||
ty += HEIGHT(c) + gappx;
|
ty += HEIGHT(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2294,7 +2262,7 @@ togglebar(const Arg *arg)
|
|||||||
selmon->pertag->showbars[0] = selmon->showbar;
|
selmon->pertag->showbars[0] = selmon->showbar;
|
||||||
}
|
}
|
||||||
updatebarpos(selmon);
|
updatebarpos(selmon);
|
||||||
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh);
|
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2340,13 +2308,6 @@ togglefloating(const Arg *arg)
|
|||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
togglefullscr(const Arg *arg)
|
|
||||||
{
|
|
||||||
if(selmon->sel)
|
|
||||||
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
toggletag(const Arg *arg)
|
toggletag(const Arg *arg)
|
||||||
{
|
{
|
||||||
@ -2504,7 +2465,7 @@ updatebars(void)
|
|||||||
XClassHint ch = {"dwm", "dwm"};
|
XClassHint ch = {"dwm", "dwm"};
|
||||||
for (m = mons; m; m = m->next) {
|
for (m = mons; m; m = m->next) {
|
||||||
if (!m->barwin) {
|
if (!m->barwin) {
|
||||||
m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, depth,
|
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth,
|
||||||
InputOutput, visual,
|
InputOutput, visual,
|
||||||
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
|
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
|
||||||
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
||||||
@ -2512,7 +2473,7 @@ updatebars(void)
|
|||||||
XSetClassHint(dpy, m->barwin, &ch);
|
XSetClassHint(dpy, m->barwin, &ch);
|
||||||
}
|
}
|
||||||
if (!m->extrabarwin) {
|
if (!m->extrabarwin) {
|
||||||
m->extrabarwin = XCreateWindow(dpy, root, m->wx + sp, m->eby - vp, m->ww - 2 * sp, bh, 0, depth,
|
m->extrabarwin = XCreateWindow(dpy, root, m->wx, m->eby, m->ww, bh, 0, depth,
|
||||||
InputOutput, visual,
|
InputOutput, visual,
|
||||||
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
|
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
|
||||||
XDefineCursor(dpy, m->extrabarwin, cursor[CurNormal]->cursor);
|
XDefineCursor(dpy, m->extrabarwin, cursor[CurNormal]->cursor);
|
||||||
@ -2528,17 +2489,17 @@ updatebarpos(Monitor *m)
|
|||||||
m->wy = m->my;
|
m->wy = m->my;
|
||||||
m->wh = m->mh;
|
m->wh = m->mh;
|
||||||
if (m->showbar) {
|
if (m->showbar) {
|
||||||
m->wh = m->wh - vertpad - bh;
|
m->wh -= bh;
|
||||||
m->by = m->topbar ? m->wy : m->wy + m->wh + vertpad;
|
m->by = m->topbar ? m->wy : m->wy + m->wh;
|
||||||
m->wy = m->topbar ? m->wy + bh + vp: m->wy;
|
m->wy = m->topbar ? m->wy + bh : m->wy;
|
||||||
} else
|
} else
|
||||||
m->by = -bh - vp;
|
m->by = -bh;
|
||||||
if (m->extrabar) {
|
if (m->extrabar) {
|
||||||
m->wh = m-> wh - vertpad - bh;
|
m->wh -= bh;
|
||||||
m->eby = !m->topbar ? m->wy : m->wy + m->wh + vertpad;
|
m->eby = !m->topbar ? m->wy : m->wy + m->wh;
|
||||||
m->wy = !m->topbar ? m->wy + bh + vp : m->wy;
|
m->wy = !m->topbar ? m->wy + bh : m->wy;
|
||||||
} else
|
} else
|
||||||
m->eby = -bh - vp;
|
m->eby = -bh;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
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)
|
|
||||||
{
|
|
@ -1,77 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,118 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
|||||||
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