aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/dwm
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-06-07 15:29:42 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-06-07 15:29:42 -0700
commit75eece6dd52aa49705bf59a6f5b6197b7a14f5db (patch)
tree3aafe0581b8a6cca95467f26334668c1e914f32e /sys/cmd/dwm
parent13ebf171dd7c7cf3fdba6d89c184a644fc37ac38 (diff)
feat: working dispatch menu
Diffstat (limited to 'sys/cmd/dwm')
-rw-r--r--sys/cmd/dwm/client.c3
-rw-r--r--sys/cmd/dwm/config.h26
-rw-r--r--sys/cmd/dwm/dwm.c32
-rw-r--r--sys/cmd/dwm/dwm.h1
-rw-r--r--sys/cmd/dwm/hook.c8
5 files changed, 35 insertions, 35 deletions
diff --git a/sys/cmd/dwm/client.c b/sys/cmd/dwm/client.c
index 1401677..106082c 100644
--- a/sys/cmd/dwm/client.c
+++ b/sys/cmd/dwm/client.c
@@ -9,10 +9,11 @@ applyrules(Client *c)
Monitor *m;
XClassHint ch = { nil, nil };
- /* rule matching */
c->isfloating = 0;
c->tags = 0;
c->noswallow = -1;
+
+ /* rule matching */
XGetClassHint(dpy, c->win, &ch);
class = ch.res_class ? ch.res_class : broken;
instance = ch.res_name ? ch.res_name : broken;
diff --git a/sys/cmd/dwm/config.h b/sys/cmd/dwm/config.h
index 2f58151..a35e4e6 100644
--- a/sys/cmd/dwm/config.h
+++ b/sys/cmd/dwm/config.h
@@ -8,13 +8,12 @@ static uint snap = 32; /* snap pixel */
static int swallowfloating = 0; /* 1 will swallow floating by default */
static int showbar = 1; /* 0 means no bar */
static int topbar = 1; /* 0 means bottom bar */
-static char *fonts[] = { "consolas:size=14" };
-static char dmenufont[] = "consolas:size=14";
-static char col_gray1[] = "#222222";
+static char *fonts[] = { "consolas:size=12" };
+static char col_gray1[] = "#323232";
static char col_gray2[] = "#444444";
static char col_gray3[] = "#bbbbbb";
static char col_gray4[] = "#eeeeee";
-static char col_cyan[] = "#005577";
+static char col_cyan[] = "#24aed8";
static char *colors[][3] =
{
/* fg bg border */
@@ -30,10 +29,11 @@ static Rule rules[] = {
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
- /* class instance title tags mask isfloating isterminal noswallow monitor */
- { "Gimp", nil, nil, 1 << 8, 1, 0, 0, -1 },
- { "qutebrowser", nil, nil, 0, 0, 0, 0, -1 },
- { "term", nil, nil, 0, 0, 0, -1, -1 },
+ /* class instance title tags mask isfloating isterminal noswallow monitor */
+ { "Gimp", nil, nil, 0, 1, 0, 0, -1 },
+ { "Inkscape", nil, nil, 0, 1, 0, 0, -1 },
+ { "qutebrowser", nil, nil, 0, 0, 0, 0, -1 },
+ { "term-256color", nil, nil, 0, 0, 1, -1, -1 },
};
/* layout(s) */
@@ -56,18 +56,16 @@ static Layout layouts[] = {
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
-/* helper for spawning shell commands in the pre dwm-5.0 fashion */
-#define SHCMD(cmd) { .v = (char*[]){ "/bin/sh", "-c", cmd, nil } }
-
/* commands */
-static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
-static char *dmenucmd[] = { "menu_dispatch", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, nil };
+static char *menucmd[] = { "menu_run", nil };
static char *termcmd[] = { "term", nil };
+static char *webscmd[] = { "qutebrowser", nil };
static Key keys[] = {
/* modifier key function argument */
- { MODKEY, XK_d, spawn, {.v = dmenucmd } },
+ { MODKEY, XK_d, spawn, {.v = menucmd } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
+ { MODKEY|ShiftMask, XK_q, spawn, {.v = webscmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_f, togglefocus, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
diff --git a/sys/cmd/dwm/dwm.c b/sys/cmd/dwm/dwm.c
index a3b01bd..a943ed7 100644
--- a/sys/cmd/dwm/dwm.c
+++ b/sys/cmd/dwm/dwm.c
@@ -270,7 +270,6 @@ createmon(void)
m->nmaster = nmaster;
m->showbar = showbar;
m->topbar = topbar;
- m->gapx = gapx;
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % arrlen(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
@@ -758,10 +757,10 @@ setup(void)
/* init screen */
screen = DefaultScreen(dpy);
- sw = DisplayWidth(dpy, screen);
- sh = DisplayHeight(dpy, screen);
+ sw = DisplayWidth(dpy, screen);
+ sh = DisplayHeight(dpy, screen);
root = RootWindow(dpy, screen);
- drw = drw_create(dpy, screen, root, sw, sh);
+ drw = drw_create(dpy, screen, root, sw, sh);
if (!drw_fontset_create(drw, fonts, arrlen(fonts)))
fatal("no fonts could be loaded.");
lrpad = drw->fonts->h;
@@ -844,7 +843,7 @@ swallowing(Window w)
void
tile(Monitor *m)
{
- uint i, n, h, mw, my, ty;
+ uint i, n, h, r, mw, my, ty;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
@@ -852,20 +851,23 @@ tile(Monitor *m)
return;
if (n > m->nmaster)
- mw = m->nmaster ? m->ww * m->mfact : 0;
+ mw = m->nmaster ? (m->ww+gapx) * 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) - m->gapx;
- resize(c, m->wx, m->wy + my, mw - (2*c->bw) - m->gapx, h - (2*c->bw), 0);
- if (my + HEIGHT(c) + m->gapx < m->wh)
- my += HEIGHT(c) + m->gapx;
+ r = MIN(n, m->nmaster) - i;
+ h = (m->wh - my - gapx*(r-1))/r;
+ resize(c, m->wx + gapx, m->wy + my + gapx, mw - (2*c->bw) - gapx, h - (2*c->bw), 0);
+ if (my + HEIGHT(c) + gapx < m->wh)
+ my += HEIGHT(c) + gapx;
} else {
- h = (m->wh - ty) / (n - i) - m->gapx;
- resize(c, m->wx + mw + m->gapx, m->wy + ty, m->ww - mw - (2*c->bw) - (2*m->gapx), h - (2*c->bw), 0);
- if (ty + HEIGHT(c) + m->gapx < m->wh)
- ty += HEIGHT(c) + m->gapx;
+ r = (n-i);
+ h = ((m->wh - ty) - gapx*(r-1))/r;
+ resize(c, m->wx + mw + gapx, m->wy + ty, m->ww - mw - (2*c->bw) - (2*gapx), h - (2*c->bw), 0);
+ if (ty + HEIGHT(c) + gapx < m->wh)
+ ty += HEIGHT(c) + gapx;
}
}
@@ -965,7 +967,7 @@ updategeom(void)
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|| unique[i].width != m->mw || unique[i].height != m->mh)
{
- dirty = 1;
+ dirty = 1;
m->num = i;
m->mx = m->wx = unique[i].x_org;
m->my = m->wy = unique[i].y_org;
diff --git a/sys/cmd/dwm/dwm.h b/sys/cmd/dwm/dwm.h
index 070717e..0061e74 100644
--- a/sys/cmd/dwm/dwm.h
+++ b/sys/cmd/dwm/dwm.h
@@ -156,7 +156,6 @@ struct Monitor {
int by; /* bar geometry */
int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */
- int gapx; /* gaps */
uint seltags;
uint sellt;
uint tagset[2];
diff --git a/sys/cmd/dwm/hook.c b/sys/cmd/dwm/hook.c
index 71bb160..1ad45df 100644
--- a/sys/cmd/dwm/hook.c
+++ b/sys/cmd/dwm/hook.c
@@ -254,8 +254,6 @@ setmfact(Arg *arg)
void
spawn(Arg *arg)
{
- if (arg->v == dmenucmd)
- dmenumon[0] = '0' + selmon->num;
if (fork() == 0) {
if (dpy)
close(ConnectionNumber(dpy));
@@ -312,14 +310,14 @@ void
toggletag(Arg *arg)
{
uint newtags;
-
if (!selmon->sel)
return;
+
newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
if (newtags) {
selmon->sel->tags = newtags;
focus(nil);
- arrange(selmon);
+ arrange(selmon);
}
}
@@ -328,6 +326,8 @@ togglefocus(Arg *arg)
{
if (selmon->sel)
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
+
+ togglebar(arg);
}
void