Compare commits
No commits in common. "348c914197784e6d1a58ea0aac231b1c64a4fa64" and "f06dfebcd676d6536cf24ea1fb66acf3f2ff7b1c" have entirely different histories.
348c914197
...
f06dfebcd6
|
@ -58,14 +58,11 @@ static const Layout layouts[] = {
|
||||||
/* commands */
|
/* commands */
|
||||||
static const char *dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
static const char *dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||||
static const char *termcmd[] = { "st", NULL };
|
static const char *termcmd[] = { "st", NULL };
|
||||||
static const char scratchpadname[] = "scratchpad";
|
|
||||||
static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
|
|
||||||
|
|
||||||
static const Key keys[] = {
|
static const Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||||
{ MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
|
|
||||||
{ MODKEY, XK_b, togglebar, {0} },
|
{ MODKEY, XK_b, togglebar, {0} },
|
||||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||||
|
@ -87,10 +84,6 @@ static const Key keys[] = {
|
||||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
{ MODKEY, XK_Right, viewnext, {0} },
|
|
||||||
{ MODKEY, XK_Left, viewprev, {0} },
|
|
||||||
{ MODKEY|ShiftMask, XK_Right, tagtonext, {0} },
|
|
||||||
{ MODKEY|ShiftMask, XK_Left, tagtoprev, {0} },
|
|
||||||
TAGKEYS( XK_1, 0)
|
TAGKEYS( XK_1, 0)
|
||||||
TAGKEYS( XK_2, 1)
|
TAGKEYS( XK_2, 1)
|
||||||
TAGKEYS( XK_3, 2)
|
TAGKEYS( XK_3, 2)
|
||||||
|
|
13
config.h
13
config.h
|
@ -15,8 +15,8 @@ static const char col_cyan[] = "#005577";
|
||||||
static const char col_pink[] = "#F8C8DC";
|
static const char col_pink[] = "#F8C8DC";
|
||||||
static const char *colors[][3] = {
|
static const char *colors[][3] = {
|
||||||
/* fg bg border */
|
/* fg bg border */
|
||||||
[SchemeNorm] = { col_gray1, col_pink, col_gray2 },
|
[SchemeNorm] = { col_gray1, col_pink, col_pink },
|
||||||
[SchemeSel] = { col_gray3, col_gray1, col_pink },
|
[SchemeSel] = { col_gray3, col_gray1, col_gray2 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
|
@ -46,7 +46,7 @@ static const Layout layouts[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* key definitions */
|
/* key definitions */
|
||||||
#define MODKEY Mod4Mask
|
#define MODKEY Mod1Mask
|
||||||
#define TAGKEYS(KEY,TAG) \
|
#define TAGKEYS(KEY,TAG) \
|
||||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
|
@ -61,15 +61,12 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn()
|
||||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_pink, "-nf", col_gray1, "-sb", col_gray1, "-sf", col_gray3, NULL };
|
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_pink, "-nf", col_gray1, "-sb", col_gray1, "-sf", col_gray3, NULL };
|
||||||
static const char *browsercmd[] = { "qutebrowser", NULL };
|
static const char *browsercmd[] = { "qutebrowser", NULL };
|
||||||
static const char *termcmd[] = { "kitty", NULL };
|
static const char *termcmd[] = { "kitty", NULL };
|
||||||
static const char scratchpadname[] = "scratchpad";
|
|
||||||
static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
|
|
||||||
|
|
||||||
static Key keys[] = {
|
static Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
{ MODKEY, XK_q, spawn, {.v = browsercmd } },
|
{ MODKEY, XK_q, spawn, {.v = browsercmd } },
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||||
{ MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
|
|
||||||
{ MODKEY, XK_b, togglebar, {0} },
|
{ MODKEY, XK_b, togglebar, {0} },
|
||||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||||
|
@ -91,10 +88,6 @@ static Key keys[] = {
|
||||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
{ MODKEY, XK_bracketright, viewnext, {0} },
|
|
||||||
{ MODKEY, XK_bracketleft, viewprev, {0} },
|
|
||||||
{ MODKEY|ShiftMask, XK_bracketright, tagtonext, {0} },
|
|
||||||
{ MODKEY|ShiftMask, XK_bracketleft, tagtoprev, {0} },
|
|
||||||
TAGKEYS( XK_1, 0)
|
TAGKEYS( XK_1, 0)
|
||||||
TAGKEYS( XK_2, 1)
|
TAGKEYS( XK_2, 1)
|
||||||
TAGKEYS( XK_3, 2)
|
TAGKEYS( XK_3, 2)
|
||||||
|
|
103
dwm.c
103
dwm.c
|
@ -184,10 +184,8 @@ static void maprequest(XEvent *e);
|
||||||
static void monocle(Monitor *m);
|
static void monocle(Monitor *m);
|
||||||
static void motionnotify(XEvent *e);
|
static void motionnotify(XEvent *e);
|
||||||
static void movemouse(const Arg *arg);
|
static void movemouse(const Arg *arg);
|
||||||
static unsigned int nexttag(void);
|
|
||||||
static Client *nexttiled(Client *c);
|
static Client *nexttiled(Client *c);
|
||||||
static void pop(Client *c);
|
static void pop(Client *c);
|
||||||
static unsigned int prevtag(void);
|
|
||||||
static void propertynotify(XEvent *e);
|
static void propertynotify(XEvent *e);
|
||||||
static void quit(const Arg *arg);
|
static void quit(const Arg *arg);
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
static Monitor *recttomon(int x, int y, int w, int h);
|
||||||
|
@ -211,12 +209,9 @@ static void sigchld(int unused);
|
||||||
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 tagtonext(const Arg *arg);
|
|
||||||
static void tagtoprev(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 togglefloating(const Arg *arg);
|
static void togglefloating(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);
|
||||||
static void unfocus(Client *c, int setfocus);
|
static void unfocus(Client *c, int setfocus);
|
||||||
|
@ -233,8 +228,6 @@ static void updatetitle(Client *c);
|
||||||
static void updatewindowtype(Client *c);
|
static void updatewindowtype(Client *c);
|
||||||
static void updatewmhints(Client *c);
|
static void updatewmhints(Client *c);
|
||||||
static void view(const Arg *arg);
|
static void view(const Arg *arg);
|
||||||
static void viewnext(const Arg *arg);
|
|
||||||
static void viewprev(const Arg *arg);
|
|
||||||
static Client *wintoclient(Window w);
|
static Client *wintoclient(Window w);
|
||||||
static Monitor *wintomon(Window w);
|
static Monitor *wintomon(Window w);
|
||||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
static int xerror(Display *dpy, XErrorEvent *ee);
|
||||||
|
@ -279,8 +272,6 @@ static Window root, wmcheckwin;
|
||||||
/* configuration, allows nested code to access above variables */
|
/* configuration, allows nested code to access above variables */
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static unsigned int scratchtag = 1 << LENGTH(tags);
|
|
||||||
|
|
||||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||||
|
|
||||||
|
@ -444,7 +435,7 @@ buttonpress(XEvent *e)
|
||||||
if (ev->window == selmon->barwin) {
|
if (ev->window == selmon->barwin) {
|
||||||
i = x = 0;
|
i = x = 0;
|
||||||
do
|
do
|
||||||
x += bh;
|
x += TEXTW(tags[i]);
|
||||||
while (ev->x >= x && ++i < LENGTH(tags));
|
while (ev->x >= x && ++i < LENGTH(tags));
|
||||||
if (i < LENGTH(tags)) {
|
if (i < LENGTH(tags)) {
|
||||||
click = ClkTagBar;
|
click = ClkTagBar;
|
||||||
|
@ -731,11 +722,11 @@ drawbar(Monitor *m)
|
||||||
}
|
}
|
||||||
x = 0;
|
x = 0;
|
||||||
for (i = 0; i < LENGTH(tags); i++) {
|
for (i = 0; i < LENGTH(tags); i++) {
|
||||||
w = bh;
|
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 ? SchemeSel : SchemeNorm]);
|
||||||
drw_text(drw, x, 0, bh, bh, 0, "", urg & 1 << i);
|
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
|
||||||
if (occ & 1 << i)
|
if (occ & 1 << i)
|
||||||
drw_rect(drw, x+boxw,boxw, w-boxw*2, w-boxw*2,
|
drw_rect(drw, x + boxs, boxs, boxw, boxw,
|
||||||
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||||
urg & 1 << i);
|
urg & 1 << i);
|
||||||
x += w;
|
x += w;
|
||||||
|
@ -746,6 +737,7 @@ drawbar(Monitor *m)
|
||||||
|
|
||||||
if ((w = m->ww - tw - x) > bh) {
|
if ((w = m->ww - tw - x) > bh) {
|
||||||
if (m->sel) {
|
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, bh, lrpad / 2, 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);
|
||||||
|
@ -1060,14 +1052,6 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
c->y = MAX(c->y, c->mon->wy);
|
c->y = MAX(c->y, c->mon->wy);
|
||||||
c->bw = borderpx;
|
c->bw = borderpx;
|
||||||
|
|
||||||
selmon->tagset[selmon->seltags] &= ~scratchtag;
|
|
||||||
if (!strcmp(c->name, scratchpadname)) {
|
|
||||||
c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag;
|
|
||||||
c->isfloating = True;
|
|
||||||
c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2);
|
|
||||||
c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
wc.border_width = c->bw;
|
wc.border_width = c->bw;
|
||||||
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
|
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
|
||||||
XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
|
XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
|
||||||
|
@ -1209,13 +1193,6 @@ movemouse(const Arg *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
|
||||||
nexttag(void)
|
|
||||||
{
|
|
||||||
unsigned int seltag = selmon->tagset[selmon->seltags];
|
|
||||||
return seltag == (1 << (LENGTH(tags) - 1)) ? 1 : seltag << 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Client *
|
Client *
|
||||||
nexttiled(Client *c)
|
nexttiled(Client *c)
|
||||||
{
|
{
|
||||||
|
@ -1232,13 +1209,6 @@ pop(Client *c)
|
||||||
arrange(c->mon);
|
arrange(c->mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
|
||||||
prevtag(void)
|
|
||||||
{
|
|
||||||
unsigned int seltag = selmon->tagset[selmon->seltags];
|
|
||||||
return seltag == 1 ? (1 << (LENGTH(tags) - 1)) : seltag >> 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
propertynotify(XEvent *e)
|
propertynotify(XEvent *e)
|
||||||
{
|
{
|
||||||
|
@ -1669,9 +1639,6 @@ sigchld(int unused)
|
||||||
void
|
void
|
||||||
spawn(const Arg *arg)
|
spawn(const Arg *arg)
|
||||||
{
|
{
|
||||||
if (arg->v == dmenucmd)
|
|
||||||
dmenumon[0] = '0' + selmon->num;
|
|
||||||
selmon->tagset[selmon->seltags] &= ~scratchtag;
|
|
||||||
if (fork() == 0) {
|
if (fork() == 0) {
|
||||||
if (dpy)
|
if (dpy)
|
||||||
close(ConnectionNumber(dpy));
|
close(ConnectionNumber(dpy));
|
||||||
|
@ -1699,32 +1666,6 @@ tagmon(const Arg *arg)
|
||||||
sendmon(selmon->sel, dirtomon(arg->i));
|
sendmon(selmon->sel, dirtomon(arg->i));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
tagtonext(const Arg *arg)
|
|
||||||
{
|
|
||||||
unsigned int tmp;
|
|
||||||
|
|
||||||
if (selmon->sel == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = nexttag();
|
|
||||||
tag(&(const Arg){.ui = tmp });
|
|
||||||
view(&(const Arg){.ui = tmp });
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
tagtoprev(const Arg *arg)
|
|
||||||
{
|
|
||||||
unsigned int tmp;
|
|
||||||
|
|
||||||
if (selmon->sel == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
tmp = prevtag();
|
|
||||||
tag(&(const Arg){.ui = tmp });
|
|
||||||
view(&(const Arg){.ui = tmp });
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
tile(Monitor *m)
|
tile(Monitor *m)
|
||||||
{
|
{
|
||||||
|
@ -1776,28 +1717,6 @@ togglefloating(const Arg *arg)
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
togglescratch(const Arg *arg)
|
|
||||||
{
|
|
||||||
Client *c;
|
|
||||||
unsigned int found = 0;
|
|
||||||
|
|
||||||
for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next);
|
|
||||||
if (found) {
|
|
||||||
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
|
|
||||||
if (newtagset) {
|
|
||||||
selmon->tagset[selmon->seltags] = newtagset;
|
|
||||||
focus(NULL);
|
|
||||||
arrange(selmon);
|
|
||||||
}
|
|
||||||
if (ISVISIBLE(c)) {
|
|
||||||
focus(c);
|
|
||||||
restack(selmon);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
spawn(arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
toggletag(const Arg *arg)
|
toggletag(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
@ -2125,18 +2044,6 @@ view(const Arg *arg)
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
viewnext(const Arg *arg)
|
|
||||||
{
|
|
||||||
view(&(const Arg){.ui = nexttag()});
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
viewprev(const Arg *arg)
|
|
||||||
{
|
|
||||||
view(&(const Arg){.ui = prevtag()});
|
|
||||||
}
|
|
||||||
|
|
||||||
Client *
|
Client *
|
||||||
wintoclient(Window w)
|
wintoclient(Window w)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,126 +0,0 @@
|
||||||
diff -up a/config.def.h b/config.def.h
|
|
||||||
--- a/config.def.h 2021-10-02 13:57:18.011307099 +0100
|
|
||||||
+++ b/config.def.h 2021-10-02 13:58:07.812080253 +0100
|
|
||||||
@@ -84,6 +84,10 @@ static Key keys[] = {
|
|
||||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
|
||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
|
||||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
|
||||||
+ { MODKEY, XK_Right, viewnext, {0} },
|
|
||||||
+ { MODKEY, XK_Left, viewprev, {0} },
|
|
||||||
+ { MODKEY|ShiftMask, XK_Right, tagtonext, {0} },
|
|
||||||
+ { MODKEY|ShiftMask, XK_Left, tagtoprev, {0} },
|
|
||||||
TAGKEYS( XK_1, 0)
|
|
||||||
TAGKEYS( XK_2, 1)
|
|
||||||
TAGKEYS( XK_3, 2)
|
|
||||||
diff -up a/dwm.c b/dwm.c
|
|
||||||
--- a/dwm.c 2021-10-02 13:57:18.011307099 +0100
|
|
||||||
+++ b/dwm.c 2021-10-02 14:21:17.063622953 +0100
|
|
||||||
@@ -183,8 +183,10 @@ static void maprequest(XEvent *e);
|
|
||||||
static void monocle(Monitor *m);
|
|
||||||
static void motionnotify(XEvent *e);
|
|
||||||
static void movemouse(const Arg *arg);
|
|
||||||
+static unsigned int nexttag(void);
|
|
||||||
static Client *nexttiled(Client *c);
|
|
||||||
static void pop(Client *);
|
|
||||||
+static unsigned int prevtag(void);
|
|
||||||
static void propertynotify(XEvent *e);
|
|
||||||
static void quit(const Arg *arg);
|
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
|
||||||
@@ -208,6 +210,8 @@ static void sigchld(int unused);
|
|
||||||
static void spawn(const Arg *arg);
|
|
||||||
static void tag(const Arg *arg);
|
|
||||||
static void tagmon(const Arg *arg);
|
|
||||||
+static void tagtonext(const Arg *arg);
|
|
||||||
+static void tagtoprev(const Arg *arg);
|
|
||||||
static void tile(Monitor *);
|
|
||||||
static void togglebar(const Arg *arg);
|
|
||||||
static void togglefloating(const Arg *arg);
|
|
||||||
@@ -227,6 +231,8 @@ static void updatetitle(Client *c);
|
|
||||||
static void updatewindowtype(Client *c);
|
|
||||||
static void updatewmhints(Client *c);
|
|
||||||
static void view(const Arg *arg);
|
|
||||||
+static void viewnext(const Arg *arg);
|
|
||||||
+static void viewprev(const Arg *arg);
|
|
||||||
static Client *wintoclient(Window w);
|
|
||||||
static Monitor *wintomon(Window w);
|
|
||||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
|
||||||
@@ -1192,6 +1198,13 @@ movemouse(const Arg *arg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+unsigned int
|
|
||||||
+nexttag(void)
|
|
||||||
+{
|
|
||||||
+ unsigned int seltag = selmon->tagset[selmon->seltags];
|
|
||||||
+ return seltag == (1 << (LENGTH(tags) - 1)) ? 1 : seltag << 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
Client *
|
|
||||||
nexttiled(Client *c)
|
|
||||||
{
|
|
||||||
@@ -1208,6 +1221,13 @@ pop(Client *c)
|
|
||||||
arrange(c->mon);
|
|
||||||
}
|
|
||||||
|
|
||||||
+unsigned int
|
|
||||||
+prevtag(void)
|
|
||||||
+{
|
|
||||||
+ unsigned int seltag = selmon->tagset[selmon->seltags];
|
|
||||||
+ return seltag == 1 ? (1 << (LENGTH(tags) - 1)) : seltag >> 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
propertynotify(XEvent *e)
|
|
||||||
{
|
|
||||||
@@ -1671,6 +1691,32 @@ tagmon(const Arg *arg)
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
+tagtonext(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ unsigned int tmp;
|
|
||||||
+
|
|
||||||
+ if (selmon->sel == NULL)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ tmp = nexttag();
|
|
||||||
+ tag(&(const Arg){.ui = tmp });
|
|
||||||
+ view(&(const Arg){.ui = tmp });
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+tagtoprev(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ unsigned int tmp;
|
|
||||||
+
|
|
||||||
+ if (selmon->sel == NULL)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ tmp = prevtag();
|
|
||||||
+ tag(&(const Arg){.ui = tmp });
|
|
||||||
+ view(&(const Arg){.ui = tmp });
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
tile(Monitor *m)
|
|
||||||
{
|
|
||||||
unsigned int i, n, h, mw, my, ty;
|
|
||||||
@@ -2044,6 +2090,18 @@ view(const Arg *arg)
|
|
||||||
arrange(selmon);
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+viewnext(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ view(&(const Arg){.ui = nexttag()});
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+viewprev(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ view(&(const Arg){.ui = prevtag()});
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
Client *
|
|
||||||
wintoclient(Window w)
|
|
||||||
{
|
|
|
@ -1,42 +0,0 @@
|
||||||
From 553c9f59f650c98d7782065b39725c9d2156c233 Mon Sep 17 00:00:00 2001
|
|
||||||
From: DogeyStamp <adeng.sean@gmail.com>
|
|
||||||
Date: Tue, 6 Apr 2021 18:28:50 -0400
|
|
||||||
Subject: [PATCH] Remove tag numbers and center tag indicator
|
|
||||||
|
|
||||||
This patch makes tags square, removes the tag numbers, and centers the
|
|
||||||
indicator showing a window is present so that the bar looks sleeker.
|
|
||||||
---
|
|
||||||
dwm.c | 8 ++++----
|
|
||||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/dwm.c b/dwm.c
|
|
||||||
index b0b3466..88aa701 100644
|
|
||||||
--- a/dwm.c
|
|
||||||
+++ b/dwm.c
|
|
||||||
@@ -433,7 +433,7 @@ buttonpress(XEvent *e)
|
|
||||||
if (ev->window == selmon->barwin) {
|
|
||||||
i = x = 0;
|
|
||||||
do
|
|
||||||
- x += TEXTW(tags[i]);
|
|
||||||
+ x += bh;
|
|
||||||
while (ev->x >= x && ++i < LENGTH(tags));
|
|
||||||
if (i < LENGTH(tags)) {
|
|
||||||
click = ClkTagBar;
|
|
||||||
@@ -716,11 +716,11 @@ drawbar(Monitor *m)
|
|
||||||
}
|
|
||||||
x = 0;
|
|
||||||
for (i = 0; i < LENGTH(tags); i++) {
|
|
||||||
- w = TEXTW(tags[i]);
|
|
||||||
+ w = bh;
|
|
||||||
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
|
||||||
- drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
|
|
||||||
+ drw_text(drw, x, 0, bh, bh, 0, "", urg & 1 << i);
|
|
||||||
if (occ & 1 << i)
|
|
||||||
- drw_rect(drw, x + boxs, boxs, boxw, boxw,
|
|
||||||
+ drw_rect(drw, x+boxw,boxw, w-boxw*2, w-boxw*2,
|
|
||||||
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
|
||||||
urg & 1 << i);
|
|
||||||
x += w;
|
|
||||||
--
|
|
||||||
2.31.1
|
|
||||||
|
|
|
@ -1,90 +0,0 @@
|
||||||
diff -up a/config.def.h b/config.def.h
|
|
||||||
--- a/config.def.h 2019-06-06 21:23:27.006661784 +0200
|
|
||||||
+++ b/config.def.h 2019-06-20 15:05:59.083102462 +0200
|
|
||||||
@@ -58,11 +58,14 @@ static const Layout layouts[] = {
|
|
||||||
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, NULL };
|
|
||||||
static const char *termcmd[] = { "st", NULL };
|
|
||||||
+static const char scratchpadname[] = "scratchpad";
|
|
||||||
+static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
|
|
||||||
|
|
||||||
static Key keys[] = {
|
|
||||||
/* modifier key function argument */
|
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
|
||||||
+ { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
|
|
||||||
{ MODKEY, XK_b, togglebar, {0} },
|
|
||||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
|
||||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
|
||||||
diff -up a/dwm.c b/dwm.c
|
|
||||||
--- a/dwm.c 2019-06-06 21:23:27.023328450 +0200
|
|
||||||
+++ b/dwm.c 2019-06-20 15:07:01.089767947 +0200
|
|
||||||
@@ -213,6 +213,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 togglescratch(const Arg *arg);
|
|
||||||
static void toggletag(const Arg *arg);
|
|
||||||
static void toggleview(const Arg *arg);
|
|
||||||
static void unfocus(Client *c, int setfocus);
|
|
||||||
@@ -273,6 +274,8 @@ static Window root, wmcheckwin;
|
|
||||||
/* configuration, allows nested code to access above variables */
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
+static unsigned int scratchtag = 1 << LENGTH(tags);
|
|
||||||
+
|
|
||||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
|
||||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
|
||||||
|
|
||||||
@@ -1052,6 +1055,14 @@ manage(Window w, XWindowAttributes *wa)
|
|
||||||
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
|
|
||||||
c->bw = borderpx;
|
|
||||||
|
|
||||||
+ selmon->tagset[selmon->seltags] &= ~scratchtag;
|
|
||||||
+ if (!strcmp(c->name, scratchpadname)) {
|
|
||||||
+ c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag;
|
|
||||||
+ c->isfloating = True;
|
|
||||||
+ c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2);
|
|
||||||
+ c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
wc.border_width = c->bw;
|
|
||||||
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
|
|
||||||
XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
|
|
||||||
@@ -1661,6 +1672,7 @@ spawn(const Arg *arg)
|
|
||||||
{
|
|
||||||
if (arg->v == dmenucmd)
|
|
||||||
dmenumon[0] = '0' + selmon->num;
|
|
||||||
+ selmon->tagset[selmon->seltags] &= ~scratchtag;
|
|
||||||
if (fork() == 0) {
|
|
||||||
if (dpy)
|
|
||||||
close(ConnectionNumber(dpy));
|
|
||||||
@@ -1748,6 +1760,28 @@ togglefloating(const Arg *arg)
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
+togglescratch(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ Client *c;
|
|
||||||
+ unsigned int found = 0;
|
|
||||||
+
|
|
||||||
+ for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next);
|
|
||||||
+ if (found) {
|
|
||||||
+ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
|
|
||||||
+ if (newtagset) {
|
|
||||||
+ selmon->tagset[selmon->seltags] = newtagset;
|
|
||||||
+ focus(NULL);
|
|
||||||
+ arrange(selmon);
|
|
||||||
+ }
|
|
||||||
+ if (ISVISIBLE(c)) {
|
|
||||||
+ focus(c);
|
|
||||||
+ restack(selmon);
|
|
||||||
+ }
|
|
||||||
+ } else
|
|
||||||
+ spawn(arg);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
toggletag(const Arg *arg)
|
|
||||||
{
|
|
||||||
unsigned int newtags;
|
|
Loading…
Reference in New Issue