commit b35f1abc14f7b863dc193346c603a050fa72298f
parent 00ad78a08c95dce62688490b8bd242a06d962d25
Author: kocotian <kocotian@kocotian.pl>
Date: Sat, 12 Dec 2020 13:21:18 +0100
center, fullscreen
Diffstat:
7 files changed, 34 insertions(+), 23 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -100,6 +100,7 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_o, incnmaster, {.i = -1 } },
{ MODKEY, XK_d, spawn, {.v = dmenucmd } },
+ { MODKEY, XK_f, togglefullscr, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
diff --git a/config.def.h.orig b/config.def.h.orig
@@ -3,6 +3,7 @@
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of 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 bar */
static const int topbar = 1; /* 0 means bottom bar */
static const int barheight = 25; /* height of a bar; 0 equals autocalculation */
@@ -33,13 +34,13 @@ 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 },
- { "discord", NULL, NULL, 1 << 7, 0, -1 },
- { "qutebrowser", NULL, NULL, 1 << 1, 0, -1 },
- { "st-256color", NULL, NULL, 0 << 0, 0, -1 },
- { "Pulseeffects", NULL, NULL, 1 << 8, 0, 1 },
- { "TelegramDesktop", NULL, NULL, 1 << 6, 0, -1 },
+ /* class instance title tags mask isfloating isterminal noswallow monitor */
+ { "Gimp", NULL, NULL, 0, 1, 0, 0, -1 },
+ { "discord", NULL, NULL, 1 << 7, 0, 0, 0, -1 },
+ { "qutebrowser", NULL, NULL, 1 << 1, 0, 0, 0, -1 },
+ { "st-256color", NULL, NULL, 0 << 0, 0, 1, 0, -1 },
+ { "Pulseeffects", NULL, NULL, 1 << 8, 0, 0, 0, 1 },
+ { "TelegramDesktop", NULL, NULL, 1 << 6, 0, 0, 0, -1 },
};
/* layout(s) */
diff --git a/config.def.h.rej b/config.def.h.rej
@@ -1,17 +1,10 @@
--- config.def.h
+++ config.def.h
-@@ -27,9 +28,11 @@ 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 isfloating isterminal noswallow monitor */
-+ { "Gimp", NULL, NULL, 0, 1, 0, 0, -1 },
-+ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1, -1 },
-+ { "St", NULL, NULL, 0, 0, 1, 0, -1 },
-+ { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */
- };
-
- /* layout(s) */
+@@ -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
@@ -248,6 +248,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);
@@ -1265,6 +1266,8 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c);
updatesizehints(c);
updatewmhints(c);
+ c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
+ c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)
@@ -2060,6 +2063,13 @@ togglefloating(const Arg *arg)
}
void
+togglefullscr(const Arg *arg)
+{
+ if(selmon->sel)
+ setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
+}
+
+void
toggletag(const Arg *arg)
{
unsigned int newtags;
diff --git a/dwm.c.orig b/dwm.c.orig
@@ -932,8 +932,12 @@ drawbar(Monitor *m)
if ((w = m->ww - tw - x) > bh) {
if (m->sel) {
+ /* fix overflow when window name is bigger than window width */
+ 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 */
+ mid = mid >= lrpad / 2 ? mid : lrpad / 2;
drw_setscheme(drw, scheme[m == selmon ? SchemeInfoSel : SchemeInfoNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
+ drw_text(drw, x, 0, w, bh, mid, m->sel->name, 0);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
} else {
@@ -1261,6 +1265,8 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c);
updatesizehints(c);
updatewmhints(c);
+ c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
+ c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)
diff --git a/patches/dwm-actualfullscreen-20191112-cb3f58a.diff b/patches/dwm-actualfullscreen-20191112-cb3f58a.diff
diff --git a/patches/dwm-alwayscenter-20200625-f04cac6.diff b/patches/dwm-alwayscenter-20200625-f04cac6.diff