aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h62
-rw-r--r--drw.c2
-rw-r--r--dwm.c64
3 files changed, 87 insertions, 41 deletions
diff --git a/config.h b/config.h
index 873b580..2c20323 100644
--- a/config.h
+++ b/config.h
@@ -6,24 +6,24 @@ static const int gapsize = 10;
/* appearance */
static const Gap default_gap = {.isgap = 1, .realgap = gapsize, .gappx = gapsize};
-static unsigned int borderpx = 5; /* border pixel of windows */
-static unsigned int snap = 0; /* snap pixel */
-static int swallowfloating = 0; /* 1 means swallow floating windows by default */
-static int showbar = 1; /* 0 means no bar */
-static int topbar = 1; /* 0 means bottom bar */
+static unsigned int borderpx = gapsize / 2; /* border pixel of windows */
+static unsigned int snap = 0; /* snap pixel */
+static int swallowfloating = 0; /* 1 means swallow floating windows by default */
+static int showbar = 1; /* 0 means no bar */
+static int topbar = 1; /* 0 means bottom bar */
-static const int vertpad = gapsize; /* vertical padding of bar */
-static const int sidepad = gapsize; /* horizontal padding of bar */
+static const int vertpad = gapsize; /* vertical padding of bar */
+static const int sidepad = gapsize; /* horizontal padding of bar */
-static const int horizpadbar = gapsize; /* horizontal padding for statusbar */
-static const int vertpadbar = gapsize; /* vertical padding for statusbar */
+static const int horizpadbar = gapsize; /* horizontal padding for statusbar */
+static const int vertpadbar = gapsize; /* vertical padding for statusbar */
/* Display modes of the tab bar: never shown, always shown, shown only in */
/* monocle mode in presence of several windows. */
/* Modes after showtab_nmodes are disabled */
enum showtab_modes { showtab_never, showtab_auto, showtab_nmodes, showtab_always};
static const int showtab = showtab_auto; /* Default tab bar show mode */
-static const Bool toptab = False; /* False means bottom tab bar */
+static const Bool toptab = True; /* False means bottom tab bar */
static char font[] = "JetBrainsMono Nerd Font:size=19:pixelsize=24";
static char dmenufont[] = "JetBrainsMono Nerd Font:size=19:pixelsize=24";
@@ -55,21 +55,22 @@ static const Rule rules[] = {
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
- /* class instance title tags mask isfloating isterminal noswallow monitor */
- { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */
+ /* class instance title tags mask isfloating isterminal noswallow monitor */
+ { "st-256color", NULL, NULL, 0, 0, 1, 0, -1 },
+ { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */
};
/* layout(s) */
-static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
-static const int nmaster = 1; /* number of clients in master area */
-static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
-static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
+static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
+static const int nmaster = 1; /* number of clients in master area */
+static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
+static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
/* symbol arrange function */
{ "  ", tile }, /* first entry is default */
- { "  ", monocle },
{ "  ", NULL }, /* no layout function means floating behavior */
+ { "  ", monocle },
};
/* key definitions */
@@ -90,30 +91,37 @@ static const char *termcmd[] = { "st", NULL };
static const Key keys[] = {
/* modifier key function argument */
- { MODKEY, XK_space, spawn, {.v = dmenucmd } },
+ { MODKEY|Mod1Mask, XK_BackSpace, quit, {0} },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
+ { MODKEY, XK_space, spawn, {.v = dmenucmd } },
{ MODKEY, XK_r, xrdb, {.v = NULL } },
- { MODKEY|Mod1Mask, XK_BackSpace, quit, {0} },
+ { MODKEY, XK_q, killclient, {0} },
- { MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
- { MODKEY|ShiftMask, XK_d, incnmaster, {.i = +1 } },
- { MODKEY, XK_d, incnmaster, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_j, pushdown, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_k, pushup, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
+
+ { MODKEY, XK_d, incnmaster, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_d, incnmaster, {.i = +1 } },
+ { MODKEY, XK_z, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
- { MODKEY, XK_q, killclient, {0} },
- { MODKEY, XK_f, setlayout, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
- { MODKEY, XK_z, zoom, {0} },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
- { MODKEY, XK_w, tabmode, {-1} },
- { MODKEY|ShiftMask, XK_space, togglealwaysontop, {0} },
+ { MODKEY, XK_b, togglebar, {0} },
+ { MODKEY|ShiftMask, XK_b, tabmode, {-1} },
+
+ { MODKEY, XK_f, cyclelayout, {.i = +1} },
+ { MODKEY|ShiftMask, XK_f, cyclelayout, {.i = -1} },
+
+ { MODKEY, XK_7, togglesticky, {0} },
+ { MODKEY, XK_8, togglealwaysontop, {0} },
{ MODKEY, XK_a, spawn, SHCMD("passmenu") },
{ MODKEY, XK_Escape, spawn, SHCMD("powermenu") },
diff --git a/drw.c b/drw.c
index f8a82f5..01ed356 100644
--- a/drw.c
+++ b/drw.c
@@ -190,6 +190,8 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
DefaultColormap(drw->dpy, drw->screen),
clrname, dest))
die("error, cannot allocate color '%s'", clrname);
+
+ dest->pixel |= 0xff << 24;
}
/* Wrapper to create color schemes. The caller has to call free(3) on the
diff --git a/dwm.c b/dwm.c
index ae71522..18d0341 100644
--- a/dwm.c
+++ b/dwm.c
@@ -173,6 +173,7 @@ struct Monitor {
int ntabs;
int tab_widths[MAXTABS];
const Layout *lt[2];
+ int ltcur;
Pertag *pertag;
};
@@ -203,10 +204,12 @@ static void configure(Client *c);
static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e);
static Monitor *createmon(void);
+static void cyclelayout(const Arg *arg);
static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
static Monitor *dirtomon(int dir);
+static void drawcentered(Monitor *m, int x, int y, int w, int h, int lrpad, char* text);
static void drawbar(Monitor *m);
static void drawbars(void);
static int drawstatusbar(Monitor *m, int bh, char* text);
@@ -401,6 +404,9 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
int baseismin;
Monitor *m = c->mon;
+ if (&monocle == c->mon->lt[c->mon->sellt]->arrange)
+ return 1;
+
/* set minimum possible */
*w = MAX(1, *w);
*h = MAX(1, *h);
@@ -793,6 +799,7 @@ createmon(void)
m = ecalloc(1, sizeof(Monitor));
m->tagset[0] = m->tagset[1] = 1;
+ m->ltcur = 0;
m->mfact = mfact;
m->nmaster = nmaster;
m->showbar = showbar;
@@ -830,6 +837,27 @@ createmon(void)
}
void
+cyclelayout(const Arg *arg)
+{
+ if (!arg || !arg->i)
+ return;
+ int switchto = selmon->ltcur + arg->i;
+ int l = LENGTH(layouts);
+
+ if (switchto == l)
+ switchto = 0;
+ else if(switchto < 0)
+ switchto = l - 1;
+
+ if (switchto != 1)
+ togglebar(0);
+
+ selmon->ltcur = switchto;
+ Arg arg2 = {.v= &layouts[switchto] };
+ setlayout(&arg2);
+}
+
+void
destroynotify(XEvent *e)
{
Client *c;
@@ -992,7 +1020,6 @@ void
drawbar(Monitor *m)
{
int x, w, tw = 0;
- int tlpad;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
@@ -1026,25 +1053,33 @@ drawbar(Monitor *m)
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
- if ((w = m->ww + m->gap->gappx * 2 - tw - x) > bh) {
+ if ((w = m->ww - tw -x) > bh) {
if (m->sel) {
- drw_setscheme(drw, SchemeNorm);
- tlpad = MAX((m->ww - ((int)TEXTW(m->sel->name) - lrpad)) / 2 - x, lrpad / 2);
- drw_text(drw, x, 0, w - 2 * sp, bh, tlpad, m->sel->name, 0);
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ drawcentered(m, x, 0, w, bh, lrpad, m->sel->name);
if (m->sel->isfloating) {
- drw_rect(drw, x + boxs + tlpad - lrpad / 2, boxs, boxw, boxw, m->sel->isfixed, 0);
+ drw_rect(drw, x + boxs - lrpad / 2, boxs, boxw, boxw, m->sel->isfixed, 0);
if (m->sel->isalwaysontop)
- drw_rect(drw, x + boxs + tlpad - lrpad / 2, bh - boxw, boxw, boxw, 0, 0);
+ drw_rect(drw, x + boxs - lrpad / 2, bh - boxw, boxw, boxw, 0, 0);
}
} else {
drw_setscheme(drw, scheme[SchemeNorm]);
- drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1);
+ drawcentered(m, x, 0, w, bh, lrpad, "Enjoying the desktop");
}
}
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
}
void
+drawcentered(Monitor *m, int x, int y, int w, int h, int lrpad, char* text)
+{
+ if (TEXTW(text) > w)
+ drw_text(drw, x, y, w, h, lrpad / 2, text, 0);
+ else
+ drw_text(drw, x, y, w, h, (w - TEXTW(text)) / 2, text, 0);
+}
+
+void
drawbars(void)
{
Monitor *m;
@@ -1560,14 +1595,8 @@ maprequest(XEvent *e)
void
monocle(Monitor *m)
{
- unsigned int n = 0;
Client *c;
- for (c = m->clients; c; c = c->next)
- if (ISVISIBLE(c))
- n++;
- 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);
}
@@ -1811,6 +1840,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 ((&monocle == c->mon->lt[c->mon->sellt]->arrange) && (!c->isfloating)) {
+ wc.border_width = 0;
+ c->w = wc.width += c->bw * 2;
+ c->h = wc.height += c->bw * 2;
+ }
+
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
XSync(dpy, False);