1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-11-22 16:31:26 +00:00

patch dwm

This commit is contained in:
Horhik 2020-11-18 05:55:01 +02:00
parent 36fca14a03
commit eb31a58408
12 changed files with 424 additions and 52 deletions

View file

@ -70,7 +70,8 @@ static const Rule rules[] = {
{ NULL, NULL, "scratchpad", 0, 1, -1, 's' }, { NULL, NULL, "scratchpad", 0, 1, -1, 's' },
{ NULL, NULL, "sp_volume", 0, 1, -1, 'v' }, { NULL, NULL, "sp_volume", 0, 1, -1, 'v' },
{ NULL, NULL, "ScratchEmacs", 0, 1, -1, 'e' }, { NULL, NULL, "ScratchEmacs", 0, 1, -1, 'e' },
{ "Evolution", NULL, "Tasks - Evolution", 0, 1, -1, 't' },
{ NULL, NULL, "Task - No Summary", 0, 1, -1, 0 }
}; };
/* layout(s) */ /* layout(s) */
@ -100,13 +101,13 @@ static const Layout layouts[] = {
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, "-c", "-l", "20", NULL}; static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, "-c", "-l", "20", NULL};
static const char *termcmd[] = { "alacritty", NULL }; static const char *termcmd[] = { "alacritty", NULL };
static const char *flameshot[] = { "flameshot","gui", NULL }; static const char *flameshot[] = { "flameshot","gui", NULL };
/*First arg only serves to match against key in rules*/ /*First arg only serves to match against key in rules*/
static const char *scratchpadcmd[] = {"s", "alacritty", "-t", "scratchpad", NULL}; static const char *scratchpadcmd[] = {"s", "alacritty", "-t", "scratchpad", NULL};
static const char *sp_emacs[] = {"e", "emacs", "-T", "ScratchEmacs", NULL}; static const char *sp_emacs[] = {"e", "emacs", "-T", "ScratchEmacs", NULL};
static const char *sp_volume_control[] = {"v","alacritty", "-t", "sp_volume","-e", "pulsemixer", NULL}; static const char *sp_volume_control[] = {"v","alacritty", "-t", "sp_volume","-e", "pulsemixer", NULL};
static const char *tasks[] = {"t","evolution", NULL};
static Key keys[] = { static Key keys[] = {
@ -129,6 +130,7 @@ static 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 } },
@ -142,6 +144,7 @@ static Key keys[] = {
{ MODKEY, XK_u, togglescratch, {.v = scratchpadcmd } }, { MODKEY, XK_u, togglescratch, {.v = scratchpadcmd } },
{ MODKEY|ShiftMask, XK_m, togglescratch, {.v = sp_volume_control } }, { MODKEY|ShiftMask, XK_m, togglescratch, {.v = sp_volume_control } },
{ MODKEY, XK_e, togglescratch, {.v = sp_emacs } }, { MODKEY, XK_e, togglescratch, {.v = sp_emacs } },
{ MODKEY, XK_t, togglescratch, {.v = tasks } },
{ MODKEY, XK_n, togglealttag, {0} }, { MODKEY, XK_n, togglealttag, {0} },
TAGKEYS( XK_1, 0) TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1) TAGKEYS( XK_2, 1)

View file

@ -12,12 +12,22 @@ static const char col_gray1[] = "#282828";
static const char col_gray2[] = "#928374"; static const char col_gray2[] = "#928374";
static const char col_gray3[] = "#d5c4a1"; static const char col_gray3[] = "#d5c4a1";
static const char col_gray4[] = "#ebdbb2"; static const char col_gray4[] = "#ebdbb2";
static const char col_cyan[] = "#d65d0e"; static const char col_cyan[] = "#3c3836";
//static const char col_cyan[] = "#d79921"; static const char col_norm[] = "#d65d0e";
static const char col_norm2[] = "#b16286";
static const char col_norm3[] = "#d79921";
static const char *colors[][3] = { static const char *colors[][3] = {
/* fg bg border */ /* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeNorm] = { col_norm, col_cyan, col_cyan},
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
[SchemeSel] = { col_gray4, col_norm2, col_norm3 },
[SchemeStatus] = { col_norm2, col_cyan, "#000000" }, // Statusbar right {text,background,not used but cannot be empty}
[SchemeTagsSel] = { col_gray1, col_norm3, "#000000" }, // Tagbar left selected {text,background,not used but cannot be empty}
[SchemeTagsNorm] = { col_norm2, col_cyan, "#000000" }, // Tagbar left unselected {text,background,not used but cannot be empty}
[SchemeInfoSel] = { col_gray4, col_cyan, "#000000" }, // infobar middle selected {text,background,not used but cannot be empty}
[SchemeInfoNorm] = { col_norm2, col_cyan, "#000000" }, // infobar middle unselected {text,background,not used but cannot be empty}
}; };
static const char *const autostart[] = { static const char *const autostart[] = {

View file

@ -70,7 +70,8 @@ static const Rule rules[] = {
{ NULL, NULL, "scratchpad", 0, 1, -1, 's' }, { NULL, NULL, "scratchpad", 0, 1, -1, 's' },
{ NULL, NULL, "sp_volume", 0, 1, -1, 'v' }, { NULL, NULL, "sp_volume", 0, 1, -1, 'v' },
{ NULL, NULL, "ScratchEmacs", 0, 1, -1, 'e' }, { NULL, NULL, "ScratchEmacs", 0, 1, -1, 'e' },
{ "Evolution", NULL, "Tasks - Evolution", 0, 1, -1, 't' },
{ NULL, NULL, "Task - No Summary", 0, 1, -1, 0 }
}; };
/* layout(s) */ /* layout(s) */
@ -100,13 +101,13 @@ static const Layout layouts[] = {
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, "-c", "-l", "20", NULL}; static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, "-c", "-l", "20", NULL};
static const char *termcmd[] = { "alacritty", NULL }; static const char *termcmd[] = { "alacritty", NULL };
static const char *flameshot[] = { "flameshot","gui", NULL }; static const char *flameshot[] = { "flameshot","gui", NULL };
/*First arg only serves to match against key in rules*/ /*First arg only serves to match against key in rules*/
static const char *scratchpadcmd[] = {"s", "alacritty", "-t", "scratchpad", NULL}; static const char *scratchpadcmd[] = {"s", "alacritty", "-t", "scratchpad", NULL};
static const char *sp_emacs[] = {"e", "emacs", "-T", "ScratchEmacs", NULL}; static const char *sp_emacs[] = {"e", "emacs", "-T", "ScratchEmacs", NULL};
static const char *sp_volume_control[] = {"v","alacritty", "-t", "sp_volume","-e", "pulsemixer", NULL}; static const char *sp_volume_control[] = {"v","alacritty", "-t", "sp_volume","-e", "pulsemixer", NULL};
static const char *tasks[] = {"t","evolution", NULL};
static Key keys[] = { static Key keys[] = {
@ -129,6 +130,7 @@ static 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 } },
@ -142,6 +144,7 @@ static Key keys[] = {
{ MODKEY, XK_u, togglescratch, {.v = scratchpadcmd } }, { MODKEY, XK_u, togglescratch, {.v = scratchpadcmd } },
{ MODKEY|ShiftMask, XK_m, togglescratch, {.v = sp_volume_control } }, { MODKEY|ShiftMask, XK_m, togglescratch, {.v = sp_volume_control } },
{ MODKEY, XK_e, togglescratch, {.v = sp_emacs } }, { MODKEY, XK_e, togglescratch, {.v = sp_emacs } },
{ MODKEY, XK_e, togglescratch, {.v = tasks } },
{ MODKEY, XK_n, togglealttag, {0} }, { MODKEY, XK_n, togglealttag, {0} },
TAGKEYS( XK_1, 0) TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1) TAGKEYS( XK_2, 1)

Binary file not shown.

View file

@ -227,6 +227,7 @@ static void tile(Monitor *);
static void togglealttag(); static void togglealttag();
static void togglebar(const Arg *arg); static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void togglefullscr(const Arg *arg);
static void togglescratch(const Arg *arg); static void togglescratch(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
@ -1380,6 +1381,13 @@ 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 (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|| &monocle == c->mon->lt[c->mon->sellt]->arrange)
&& !c->isfullscreen && !c->isfloating) {
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);
@ -1957,6 +1965,13 @@ togglescratch(const Arg *arg)
} }
} }
void
togglefullscr(const Arg *arg)
{
if(selmon->sel)
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
}
void void
toggletag(const Arg *arg) toggletag(const Arg *arg)
{ {

View file

@ -60,7 +60,7 @@
/* enums */ /* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel }; /* color schemes */ enum { SchemeNorm, SchemeSel, SchemeStatus, SchemeTagsSel, SchemeTagsNorm, SchemeInfoSel, SchemeInfoNorm }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck, enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
@ -227,6 +227,7 @@ static void tile(Monitor *);
static void togglealttag(); static void togglealttag();
static void togglebar(const Arg *arg); static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void togglefullscr(const Arg *arg);
static void togglescratch(const Arg *arg); static void togglescratch(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
@ -772,7 +773,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 */
if (m == selmon) { /* status is only drawn on selected monitor */ if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]); drw_setscheme(drw, scheme[SchemeStatus]);
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ 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, 0, tw, bh, 0, stext, 0);
} }
@ -786,7 +787,7 @@ drawbar(Monitor *m)
for (i = 0; i < LENGTH(tags); i++) { for (i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]); w = TEXTW(tags[i]);
wdelta = selmon->alttag ? abs(TEXTW(tags[i]) - TEXTW(tagsalt[i])) / 2 : 0; wdelta = selmon->alttag ? abs(TEXTW(tags[i]) - TEXTW(tagsalt[i])) / 2 : 0;
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeTagsSel : SchemeTagsNorm]);
drw_text(drw, x, 0, w, bh, wdelta + lrpad / 2, (selmon->alttag ? tagsalt[i] : tags[i]), urg & 1 << i); drw_text(drw, x, 0, w, bh, wdelta + lrpad / 2, (selmon->alttag ? tagsalt[i] : tags[i]), urg & 1 << i);
if (occ & 1 << i) if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw, drw_rect(drw, x + boxs, boxs, boxw, boxw,
@ -811,12 +812,12 @@ drawbar(Monitor *m)
int mid = (m->ww - (int)TEXTW(m->sel->name)) / 2 - x; int mid = (m->ww - (int)TEXTW(m->sel->name)) / 2 - x;
/* make sure name will not overlap on tags even when it is very long */ /* make sure name will not overlap on tags even when it is very long */
mid = mid >= lrpad / 2 ? mid : lrpad / 2; mid = mid >= lrpad / 2 ? mid : lrpad / 2;
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); drw_setscheme(drw, scheme[m == selmon ? SchemeInfoSel : SchemeInfoNorm]);
drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0); drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0);
if (m->sel->isfloating) if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
} else { } else {
drw_setscheme(drw, scheme[SchemeNorm]); drw_setscheme(drw, scheme[SchemeInfoNorm]);
drw_rect(drw, x, 0, w, bh, 1, 1); drw_rect(drw, x, 0, w, bh, 1, 1);
} }
} }
@ -1957,6 +1958,13 @@ togglescratch(const Arg *arg)
} }
} }
void
togglefullscr(const Arg *arg)
{
if(selmon->sel)
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
}
void void
toggletag(const Arg *arg) toggletag(const Arg *arg)
{ {

View file

@ -1,41 +1,10 @@
--- dwm.c --- dwm.c
+++ dwm.c +++ dwm.c
@@ -703,7 +703,7 @@ drawbar(Monitor *m) @@ -211,6 +211,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *);
/* draw status first so it can be overdrawn by tags later */ static void togglebar(const Arg *arg);
if (m == selmon) { /* status is only drawn on selected monitor */ static void togglefloating(const Arg *arg);
- drw_setscheme(drw, scheme[SchemeNorm]); +static void togglefullscr(const Arg *arg);
+ drw_setscheme(drw, scheme[SchemeStatus]); static void toggletag(const Arg *arg);
sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */ static void toggleview(const Arg *arg);
drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0); static void unfocus(Client *c, int setfocus);
}
@@ -716,7 +716,7 @@ drawbar(Monitor *m)
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]);
- drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
+ drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeTagsSel : SchemeTagsNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
@@ -725,17 +725,17 @@ drawbar(Monitor *m)
x += w;
}
w = blw = TEXTW(m->ltsymbol);
- drw_setscheme(drw, scheme[SchemeNorm]);
+ drw_setscheme(drw, scheme[SchemeTagsNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
if ((w = m->ww - sw - x) > bh) {
if (m->sel) {
- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
+ drw_setscheme(drw, scheme[m == selmon ? SchemeInfoSel : SchemeInfoNorm]);
drw_text(drw, x, 0, w, 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_setscheme(drw, scheme[SchemeInfoNorm]);
drw_rect(drw, x, 0, w, bh, 1, 1);
}
}

Binary file not shown.

View file

@ -0,0 +1,53 @@
From 3a16816a6f5d38014c2a06ce395873c545c8789a Mon Sep 17 00:00:00 2001
From: Soenke Lambert <s.lambert@mittwald.de>
Date: Tue, 12 Nov 2019 10:44:02 +0100
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.c | 8 ++++++++
2 files changed, 9 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.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.17.1

View file

@ -0,0 +1,56 @@
From 54719285bd1a984e2efce6e8a8eab184fec11abf Mon Sep 17 00:00:00 2001
From: Sermak <sermak@jarvis.com>
Date: Mon, 8 Jul 2019 01:06:44 +0200
Subject: [PATCH] Simulate toggleable fullscreen mode
---
config.def.h | 1 +
dwm.c | 14 ++++++++++++++
2 files changed, 15 insertions(+)
diff --git a/config.def.h b/config.def.h
index 1c0b587..f774cc5 100644
--- a/config.def.h
+++ b/config.def.h
@@ -76,6 +76,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|ShiftMask, XK_f, fullscreen, {0} },
{ 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 4465af1..04b1e06 100644
--- a/dwm.c
+++ b/dwm.c
@@ -199,6 +199,7 @@ static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
+static void fullscreen(const Arg *arg);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
@@ -1497,6 +1498,19 @@ setfullscreen(Client *c, int fullscreen)
}
}
+Layout *last_layout;
+void
+fullscreen(const Arg *arg)
+{
+ if (selmon->showbar) {
+ for(last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
+ setlayout(&((Arg) { .v = &layouts[2] }));
+ } else {
+ setlayout(&((Arg) { .v = last_layout }));
+ }
+ togglebar(arg);
+}
+
void
setlayout(const Arg *arg)
{
--
2.22.0

View file

@ -0,0 +1,30 @@
From 9102fdb9c670218373bbe83c891c8e8138d6a6f4 Mon Sep 17 00:00:00 2001
From: redacted <redacted@example.com>
Date: Tue, 23 Apr 2019 00:39:27 +0100
Subject: [PATCH] added noborder patch
---
dwm.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/dwm.c b/dwm.c
index 4465af1..685eca1 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1282,6 +1282,13 @@ 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 (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
+ || &monocle == c->mon->lt[c->mon->sellt]->arrange)
+ && !c->isfullscreen && !c->isfloating) {
+ 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);
--
2.21.0

View file

@ -0,0 +1,225 @@
diff --git a/dwm.c b/dwm.c
index 4465af1..3c94e4b 100644
--- a/dwm.c
+++ b/dwm.c
@@ -143,7 +143,7 @@ typedef struct {
/* function declarations */
static void applyrules(Client *c);
-static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
+static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw, int interact);
static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
@@ -188,8 +188,8 @@ static void pop(Client *);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
-static void resize(Client *c, int x, int y, int w, int h, int interact);
-static void resizeclient(Client *c, int x, int y, int w, int h);
+static void resize(Client *c, int x, int y, int w, int h, int bw, int interact);
+static void resizeclient(Client *c, int x, int y, int w, int h, int bw);
static void resizemouse(const Arg *arg);
static void restack(Monitor *m);
static void run(void);
@@ -312,7 +312,7 @@ applyrules(Client *c)
}
int
-applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
+applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw, int interact)
{
int baseismin;
Monitor *m = c->mon;
@@ -325,18 +325,18 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
*x = sw - WIDTH(c);
if (*y > sh)
*y = sh - HEIGHT(c);
- if (*x + *w + 2 * c->bw < 0)
+ if (*x + *w + 2 * *bw < 0)
*x = 0;
- if (*y + *h + 2 * c->bw < 0)
+ if (*y + *h + 2 * *bw < 0)
*y = 0;
} else {
if (*x >= m->wx + m->ww)
*x = m->wx + m->ww - WIDTH(c);
if (*y >= m->wy + m->wh)
*y = m->wy + m->wh - HEIGHT(c);
- if (*x + *w + 2 * c->bw <= m->wx)
+ if (*x + *w + 2 * *bw <= m->wx)
*x = m->wx;
- if (*y + *h + 2 * c->bw <= m->wy)
+ if (*y + *h + 2 * *bw <= m->wy)
*y = m->wy;
}
if (*h < bh)
@@ -374,7 +374,7 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
if (c->maxh)
*h = MIN(*h, c->maxh);
}
- return *x != c->x || *y != c->y || *w != c->w || *h != c->h;
+ return *x != c->x || *y != c->y || *w != c->w || *h != c->h || *bw != c->bw;
}
void
@@ -394,9 +394,16 @@ arrange(Monitor *m)
void
arrangemon(Monitor *m)
{
+ Client *c;
+
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
if (m->lt[m->sellt]->arrange)
m->lt[m->sellt]->arrange(m);
+ else
+ /* <>< case; rather than providing an arrange function and upsetting other logic that tests for its presence, simply add borders here */
+ for (c = selmon->clients; c; c = c->next)
+ if (ISVISIBLE(c) && c->bw == 0)
+ resize(c, c->x, c->y, c->w - 2*borderpx, c->h - 2*borderpx, borderpx, 0);
}
void
@@ -566,7 +573,7 @@ configurenotify(XEvent *e)
for (m = mons; m; m = m->next) {
for (c = m->clients; c; c = c->next)
if (c->isfullscreen)
- resizeclient(c, m->mx, m->my, m->mw, m->mh);
+ resizeclient(c, m->mx, m->my, m->mw, m->mh, 0);
XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
}
focus(NULL);
@@ -1112,7 +1119,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, m->wy, m->ww, m->wh, 0, 0);
}
void
@@ -1180,7 +1187,7 @@ movemouse(const Arg *arg)
&& (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
togglefloating(NULL);
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
- resize(c, nx, ny, c->w, c->h, 1);
+ resize(c, nx, ny, c->w, c->h, c->bw, 1);
break;
}
} while (ev.type != ButtonRelease);
@@ -1266,14 +1273,14 @@ recttomon(int x, int y, int w, int h)
}
void
-resize(Client *c, int x, int y, int w, int h, int interact)
+resize(Client *c, int x, int y, int w, int h, int bw, int interact)
{
- if (applysizehints(c, &x, &y, &w, &h, interact))
- resizeclient(c, x, y, w, h);
+ if (applysizehints(c, &x, &y, &w, &h, &bw, interact))
+ resizeclient(c, x, y, w, h, bw);
}
void
-resizeclient(Client *c, int x, int y, int w, int h)
+resizeclient(Client *c, int x, int y, int w, int h, int bw)
{
XWindowChanges wc;
@@ -1281,7 +1288,7 @@ resizeclient(Client *c, int x, int y, int w, int h)
c->oldy = c->y; c->y = wc.y = y;
c->oldw = c->w; c->w = wc.width = w;
c->oldh = c->h; c->h = wc.height = h;
- wc.border_width = c->bw;
+ c->oldbw = c->bw; c->bw = wc.border_width = bw;
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
XSync(dpy, False);
@@ -1330,7 +1337,7 @@ resizemouse(const Arg *arg)
togglefloating(NULL);
}
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
- resize(c, c->x, c->y, nw, nh, 1);
+ resize(c, c->x, c->y, nw, nh, c->bw, 1);
break;
}
} while (ev.type != ButtonRelease);
@@ -1477,22 +1484,20 @@ setfullscreen(Client *c, int fullscreen)
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
c->isfullscreen = 1;
c->oldstate = c->isfloating;
- c->oldbw = c->bw;
- c->bw = 0;
c->isfloating = 1;
- resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
+ resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh, 0);
XRaiseWindow(dpy, c->win);
} else if (!fullscreen && c->isfullscreen){
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)0, 0);
c->isfullscreen = 0;
c->isfloating = c->oldstate;
- c->bw = c->oldbw;
c->x = c->oldx;
c->y = c->oldy;
c->w = c->oldw;
c->h = c->oldh;
- resizeclient(c, c->x, c->y, c->w, c->h);
+ c->bw = c->oldbw;
+ resizeclient(c, c->x, c->y, c->w, c->h, c->bw);
arrange(c->mon);
}
}
@@ -1619,7 +1624,7 @@ showhide(Client *c)
/* show clients top down */
XMoveWindow(dpy, c->win, c->x, c->y);
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
- resize(c, c->x, c->y, c->w, c->h, 0);
+ resize(c, c->x, c->y, c->w, c->h, c->bw, 0);
showhide(c->snext);
} else {
/* hide clients bottom up */
@@ -1673,13 +1678,17 @@ tagmon(const Arg *arg)
void
tile(Monitor *m)
{
- unsigned int i, n, h, mw, my, ty;
+ unsigned int i, n, h, mw, my, ty, bw;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0)
return;
+ if (n == 1)
+ bw = 0;
+ else
+ bw = borderpx;
if (n > m->nmaster)
mw = m->nmaster ? m->ww * m->mfact : 0;
else
@@ -1687,11 +1696,11 @@ tile(Monitor *m)
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);
+ resize(c, m->wx, m->wy + my, mw - 2*bw, h - 2*bw, bw, 0);
my += HEIGHT(c);
} 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);
+ resize(c, m->wx + mw, m->wy + ty, m->ww - mw - 2*bw, h - 2*bw, bw, 0);
ty += HEIGHT(c);
}
}
@@ -1715,7 +1724,9 @@ togglefloating(const Arg *arg)
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if (selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
- selmon->sel->w, selmon->sel->h, 0);
+ selmon->sel->w - 2 * (borderpx - selmon->sel->bw),
+ selmon->sel->h - 2 * (borderpx - selmon->sel->bw),
+ borderpx, 0);
arrange(selmon);
}