Compare commits

...

10 Commits

Author SHA1 Message Date
bc86c745c4 remove warp behavior when using togglewin func
only affects awsome bar
2024-07-20 01:41:12 -04:00
7c9be5fa71 added deck layout 2024-07-20 01:28:43 -04:00
794d700043 add protections to movestack function - prevents crash 2024-07-20 01:13:38 -04:00
47484739cf Revert "windo map patch"
This reverts commit cd218b417b.
patch causes a bug with hidding windows
2024-07-20 00:44:39 -04:00
9d7f40b41d remove underline styling from awsome bar - full color tabs 2024-07-20 00:37:33 -04:00
e53eb79457 Revert "hide vacant tags patch"
This reverts commit 3fd2ae71f3.
2024-07-17 17:12:35 -04:00
75d9a51a9c Revert "underline tages patch"
This reverts commit 7424a27ffc.
2024-07-11 21:24:18 -04:00
667beb1ae3 window follow icon & layout icon color schemes 2024-07-11 21:15:19 -04:00
4594e13a77 rainbow tags patch 2024-07-11 17:03:51 -04:00
2094b25a29 always on top patch 2024-07-11 02:52:04 -04:00
10 changed files with 416 additions and 253 deletions

View File

@ -26,12 +26,16 @@ static const char *colors[][3] = {
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
[SchemeHid] = { col_cyan, col_gray1, col_cyan },
[SchemeLay] = { col_cyan, "#00ff00", col_cyan },
[SchemeWf] = { col_cyan, "#00ffff", col_cyan },
};
static const unsigned int alphas[][3] = {
/* fg bg border*/
[SchemeNorm] = { OPAQUE, baralpha, borderalpha },
[SchemeSel] = { OPAQUE, baralpha, borderalpha },
[SchemeHid] = { OPAQUE, baralpha, borderalpha },
[SchemeLay] = { OPAQUE, baralpha, borderalpha },
[SchemeWf] = { OPAQUE, baralpha, borderalpha },
};
static const char *const autostart[] = {
@ -58,6 +62,20 @@ static const unsigned int ulinestroke = 2; /* thickness / height of the underlin
static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
static const char *tagsel[][2] = {
{ "#ffffff", "#ff0000" },
{ "#ffffff", "#ff7f00" },
{ "#000000", "#ffff00" },
{ "#000000", "#00ff00" },
{ "#ffffff", "#0000ff" },
{ "#ffffff", "#4b0082" },
{ "#ffffff", "#9400d3" },
{ "#000000", "#ffffff" },
{ "#ffffff", "#000000" },
};
static const unsigned int tagalpha[] = { OPAQUE, baralpha };
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
@ -70,6 +88,9 @@ static const Rule rules[] = {
{ NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, -1 }, /* xev */
};
static const char topicon[128] = "\uf435";
/* icon to indicate always on top floating windows */
/* window following */
#define WFACTIVE '>'
#define WFINACTIVE 'v'
@ -86,6 +107,7 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
{ "[D]", deck },
};
/* key definitions */
@ -130,8 +152,10 @@ static const Key keys[] = {
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_r, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY|ShiftMask, XK_t, togglealwaysontop, {0} },
{ MODKEY, XK_Down, moveresize, {.v = "0x 25y 0w 0h" } },
{ MODKEY, XK_Up, moveresize, {.v = "0x -25y 0w 0h" } },
{ MODKEY, XK_Right, moveresize, {.v = "25x 0y 0w 0h" } },

190
dwm.c
View File

@ -67,7 +67,7 @@
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel, SchemeHid }; /* color schemes */
enum { SchemeNorm, SchemeSel, SchemeHid, SchemeLay, SchemeWf }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetClientInfo, NetLast }; /* EWMH atoms */
@ -102,7 +102,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
int bw, oldbw;
unsigned int tags;
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isfakefullscreen, isterminal, noswallow;
int isfixed, isfloating, isalwaysontop, isurgent, neverfocus, oldstate, isfullscreen, isfakefullscreen, isterminal, noswallow;
pid_t pid;
Client *next;
Client *snext;
@ -187,6 +187,7 @@ static void configure(Client *c);
static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e);
static Monitor *createmon(void);
static void deck(Monitor *m);
static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
@ -262,6 +263,7 @@ static void togglefakefullscr(const Arg *arg);
static void togglefullscr(const Arg *arg);
static void toggleextrabar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void togglealwaysontop(const Arg *arg);
static void togglefollow(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
@ -280,9 +282,6 @@ static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
static void window_set_state(Display *dpy, Window win, long state);
static void window_map(Display *dpy, Client *c, int deiconify);
static void window_unmap(Display *dpy, Window win, Window root, int iconify);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
@ -334,6 +333,7 @@ static int restart = 0;
static int running = 1;
static Cur *cursor[CurLast];
static Clr **scheme;
static Clr **tagscheme;
static Display *dpy;
static Drw *drw;
static Monitor *mons, *selmon;
@ -607,15 +607,9 @@ buttonpress(XEvent *e)
}
if (ev->window == selmon->barwin) {
i = x = 0;
unsigned int occ = 0;
for(c = m->clients; c; c=c->next)
occ |= c->tags == TAGMASK ? 0 : c->tags;
do {
/* Do not reserve space for vacant tags */
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
do
x += TEXTW(tags[i]);
} while (ev->x >= x && ++i < LENGTH(tags));
while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@ -892,6 +886,33 @@ destroynotify(XEvent *e)
unmanage(c->swallowing, 1);
}
void
deck(Monitor *m) {
unsigned int i, n, h, mw, my, ns;
Client *c;
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if(n == 0)
return;
if(n > m->nmaster) {
mw = m->nmaster ? m->ww * m->mfact : 0;
ns = m->nmaster > 0 ? 2 : 1;
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
} else {
mw = m->ww;
ns = 1;
}
for(i = 0, my = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if(i < m->nmaster) {
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
my += HEIGHT(c) + gappx;
}
else
resize(c, m->wx + mw + gappx/ns, m->wy + gappx, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, m->wh - (2*c->bw) - 2*gappx, False);
}
void
detach(Client *c)
{
@ -951,37 +972,27 @@ drawbar(Monitor *m)
for (c = m->clients; c; c = c->next) {
if (ISVISIBLE(c))
n++;
occ |= c->tags == TAGMASK ? 0 : c->tags;
occ |= c->tags;
if (c->isurgent)
urg |= c->tags;
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
/* Do not draw vacant tags */
if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeNorm : SchemeNorm]);
drw_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[SchemeNorm]));
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
if (ulineall || m->tagset[m->seltags] & 1 << i) { /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */
if (m == selmon)
drw_setscheme(drw, scheme[SchemeHid]);
drw_rect(drw, x + w * 0.0675, bh - ulinestroke - ulinevoffset, w * 0.875, ulinestroke, 1, 0);
} else if (occ & 1 << i) {
drw_setscheme(drw, scheme[SchemeNorm]);
if (urg)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m == selmon && selmon->sel && selmon->sel->tags & 1 << i, 1);
else
drw_rect(drw, x + w * 0.375, bh - ulinestroke - ulinevoffset, w * 0.25, ulinestroke, 1, 0);
}
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
urg & 1 << i);
x += w;
}
w = TEXTW(m->ltsymbol);
drw_setscheme(drw, scheme[SchemeSel]);
drw_setscheme(drw, scheme[SchemeLay]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
w = TEXTW(wfsymbol);
drw_setscheme(drw, scheme[SchemeWf]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, wfsymbol, 0);
if ((w = m->ww - tw - x) > bh) {
@ -991,11 +1002,13 @@ drawbar(Monitor *m)
for (c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c))
continue;
if (HIDDEN(c))
scm = SchemeHid;
if (m->sel == c && m == selmon)
drw_setscheme(drw, scheme[SchemeSel]);
else if (HIDDEN(c))
drw_setscheme(drw, scheme[SchemeHid]);
else
scm = SchemeNorm;
drw_setscheme(drw, scheme[scm]);
drw_setscheme(drw, scheme[SchemeNorm]);
if (remainder >= 0) {
if (remainder == 0) {
@ -1003,20 +1016,19 @@ drawbar(Monitor *m)
}
remainder--;
}
mid = (tabw - (int)TEXTW(c->name)) / 2;
mid = mid >= lrpad / 2 ? mid : lrpad / 2;
drw_text(drw, x, 0, tabw - 2 * sp, bh, mid, c->name, 0);
if (!HIDDEN(c)) {
if (m->sel == c) {
if (m == selmon)
drw_setscheme(drw, scheme[SchemeHid]);
drw_rect(drw, x + tabw * 0.0675, bh - ulinestroke - ulinevoffset, tabw * 0.875 - ulinepad * 2, ulinestroke, 1, 0);
} else {
drw_rect(drw, x + tabw * 0.375, bh - ulinestroke - ulinevoffset, tabw * 0.25 - ulinepad * 2, ulinestroke, 1, 0);
}
}
char name[512];
if (c->isalwaysontop && c->isfloating)
snprintf(name, sizeof name, "%s %s", topicon, c->name);
else
snprintf(name, sizeof name, c->name);
mid = ((tabw - (int)TEXTW(name)) / 2) + lrpad / 2;
if ( tabw < (int)TEXTW(name) + lrpad )
mid = lrpad / 2;
drw_text(drw, x, 0, tabw, bh, mid, name, 0);
x += tabw;
}
} else {
@ -1849,6 +1861,8 @@ nexttiled(Client *c)
void
movestack(const Arg *arg) {
Client *c = NULL, *p = NULL, *pc = NULL, *i;
if (!selmon->sel)
return;
if(arg->i > 0) {
/* find the client after selmon->sel */
@ -2178,6 +2192,16 @@ restack(Monitor *m)
return;
if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
XRaiseWindow(dpy, m->sel->win);
/* raise the aot window */
for(Monitor *m_search = mons; m_search; m_search = m_search->next){
for(c = m_search->clients; c; c = c->next){
if(c->isalwaysontop){
XRaiseWindow(dpy, c->win);
}
}
}
if (m->lt[m->sellt]->arrange) {
wc.stack_mode = Below;
wc.sibling = m->barwin;
@ -2487,9 +2511,14 @@ setup(void)
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */
if (LENGTH(tags) > LENGTH(tagsel))
die("too few color schemes for the tags");
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3);
tagscheme = ecalloc(LENGTH(tagsel), sizeof(Clr *));
for (i = 0; i < LENGTH(tagsel); i++)
tagscheme[i] = drw_scm_create(drw, tagsel[i], tagalpha, 2);
/* init bars */
updatebars();
updatestatus();
@ -2573,12 +2602,14 @@ showhide(Client *c)
return;
if (ISVISIBLE(c)) {
/* show clients top down */
window_map(dpy, c, 1);
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);
showhide(c->snext);
} else {
/* hide clients bottom up */
showhide(c->snext);
window_unmap(dpy, c->win, root, 1);
XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
}
}
@ -2724,6 +2755,7 @@ togglefloating(const Arg *arg)
if (selmon->sel->isfullscreen
&& !selmon->sel->isfakefullscreen) /* no support for fullscreen windows */
return;
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if (selmon->sel->isfloating)
/* restore last known float dimensions */
@ -2743,6 +2775,19 @@ togglefloating(const Arg *arg)
arrange(selmon);
}
void
togglealwaysontop(const Arg *arg)
{
Client *c;
if (!selmon->sel)
return;
if (selmon->sel->isfullscreen)
return;
selmon->sel->isalwaysontop = !selmon->sel->isalwaysontop;
arrange(selmon);
}
void
togglefakefullscr(const Arg *arg)
{
@ -2824,7 +2869,7 @@ togglewin(const Arg *arg)
showwin(c);
focus(c);
restack(selmon);
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
/* XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2); */
}
}
@ -3165,51 +3210,6 @@ updatewmhints(Client *c)
}
}
void
window_set_state(Display *dpy, Window win, long state)
{
long data[] = { state, None };
XChangeProperty(dpy, win, wmatom[WMState], wmatom[WMState], 32,
PropModeReplace, (unsigned char*)data, 2);
}
void
window_map(Display *dpy, Client *c, int deiconify)
{
Window win = c->win;
if (deiconify)
window_set_state(dpy, win, NormalState);
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
XMapWindow(dpy, win);
}
void
window_unmap(Display *dpy, Window win, Window root, int iconify)
{
static XWindowAttributes ca, ra;
XGrabServer(dpy);
XGetWindowAttributes(dpy, root, &ra);
XGetWindowAttributes(dpy, win, &ca);
/* Prevent UnmapNotify events */
XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask);
XSelectInput(dpy, win, ca.your_event_mask & ~StructureNotifyMask);
XUnmapWindow(dpy, win);
if (iconify)
window_set_state(dpy, win, IconicState);
XSelectInput(dpy, root, ra.your_event_mask);
XSelectInput(dpy, win, ca.your_event_mask);
XUngrabServer(dpy);
}
void
view(const Arg *arg)
{

View File

@ -1,48 +0,0 @@
:100644 100644 f1d86b2 0000000 M dwm.c
diff --git a/dwm.c b/dwm.c
index f1d86b2..d41cc14 100644
--- a/dwm.c
+++ b/dwm.c
@@ -433,9 +433,15 @@ buttonpress(XEvent *e)
}
if (ev->window == selmon->barwin) {
i = x = 0;
- do
+ unsigned int occ = 0;
+ for(c = m->clients; c; c=c->next)
+ occ |= c->tags == TAGMASK ? 0 : c->tags;
+ do {
+ /* Do not reserve space for vacant tags */
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
x += TEXTW(tags[i]);
- while (ev->x >= x && ++i < LENGTH(tags));
+ } while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@@ -715,19 +721,18 @@ drawbar(Monitor *m)
}
for (c = m->clients; c; c = c->next) {
- occ |= c->tags;
+ occ |= c->tags == TAGMASK ? 0 : c->tags;
if (c->isurgent)
urg |= c->tags;
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
+ /* Do not draw vacant tags */
+ if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
w = TEXTW(tags[i]);
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);
- if (occ & 1 << i)
- drw_rect(drw, x + boxs, boxs, boxw, boxw,
- m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
- urg & 1 << i);
x += w;
}
w = TEXTW(m->ltsymbol);

View File

@ -0,0 +1,61 @@
diff --git a/config.def.h b/config.def.h
index 1c0b587..80d0e6e 100644
--- a/config.def.h
+++ b/config.def.h
@@ -21,6 +21,20 @@ static const char *colors[][3] = {
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+static const char *tagsel[][2] = {
+ { "#ffffff", "#ff0000" },
+ { "#ffffff", "#ff7f00" },
+ { "#000000", "#ffff00" },
+ { "#000000", "#00ff00" },
+ { "#ffffff", "#0000ff" },
+ { "#ffffff", "#4b0082" },
+ { "#ffffff", "#9400d3" },
+ { "#000000", "#ffffff" },
+ { "#ffffff", "#000000" },
+};
+
+static const unsigned int tagalpha[] = { OPAQUE, baralpha };
+
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
diff --git a/dwm.c b/dwm.c
index b0b3466..23d1c46 100644
--- a/dwm.c
+++ b/dwm.c
@@ -264,6 +264,7 @@ static Atom wmatom[WMLast], netatom[NetLast];
static int running = 1;
static Cur *cursor[CurLast];
static Clr **scheme;
+static Clr **tagscheme;
static Display *dpy;
static Drw *drw;
static Monitor *mons, *selmon;
@@ -717,7 +718,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, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[SchemeNorm]));
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,
@@ -1568,9 +1569,14 @@ setup(void)
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */
+ if (LENGTH(tags) > LENGTH(tagsel))
+ die("too few color schemes for the tags");
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], 3);
+ tagscheme = ecalloc(LENGTH(tagsel), sizeof(Clr *));
+ for (i = 0; i < LENGTH(tagsel); i++)
+ tagscheme[i] = drw_scm_create(drw, tagsel[i], tagalpha, 2);
/* init bars */
updatebars();
updatestatus();

View File

@ -1,27 +0,0 @@
diff -pu dwm.git/config.def.h dwm.underlinetags/config.def.h
--- dwm.git/config.def.h 2021-02-27 20:04:32.030570909 -0600
+++ dwm.underlinetags/config.def.h 2021-03-16 16:42:26.278703624 -0500
@@ -21,6 +21,11 @@ static const char *colors[][3] = {
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */
+static const unsigned int ulinestroke = 2; /* thickness / height of the underline */
+static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
+static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
+
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
diff -pu dwm.git/dwm.c dwm.underlinetags/dwm.c
--- dwm.git/dwm.c 2021-02-27 20:04:32.030570909 -0600
+++ dwm.underlinetags/dwm.c 2021-03-16 16:41:21.468077151 -0500
@@ -719,6 +719,8 @@ drawbar(Monitor *m)
w = TEXTW(tags[i]);
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);
+ if (ulineall || m->tagset[m->seltags] & 1 << i) /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */
+ drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0);
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,

View File

@ -1,83 +0,0 @@
diff --git a/dwm.c b/dwm.c
index e5efb6a..eaf0333 100644
--- a/dwm.c
+++ b/dwm.c
@@ -228,6 +228,9 @@ static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
+static void window_set_state(Display *dpy, Window win, long state);
+static void window_map(Display *dpy, Client *c, int deiconify);
+static void window_unmap(Display *dpy, Window win, Window root, int iconify);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
@@ -1617,14 +1620,12 @@ showhide(Client *c)
return;
if (ISVISIBLE(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);
+ window_map(dpy, c, 1);
showhide(c->snext);
} else {
/* hide clients bottom up */
showhide(c->snext);
- XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
+ window_unmap(dpy, c->win, root, 1);
}
}
@@ -2032,6 +2033,51 @@ updatewmhints(Client *c)
}
}
+void
+window_set_state(Display *dpy, Window win, long state)
+{
+ long data[] = { state, None };
+
+ XChangeProperty(dpy, win, wmatom[WMState], wmatom[WMState], 32,
+ PropModeReplace, (unsigned char*)data, 2);
+}
+
+void
+window_map(Display *dpy, Client *c, int deiconify)
+{
+ Window win = c->win;
+
+ if (deiconify)
+ window_set_state(dpy, win, NormalState);
+
+ XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
+ XSetInputFocus(dpy, win, RevertToPointerRoot, CurrentTime);
+ XMapWindow(dpy, win);
+}
+
+void
+window_unmap(Display *dpy, Window win, Window root, int iconify)
+{
+ static XWindowAttributes ca, ra;
+
+ XGrabServer(dpy);
+ XGetWindowAttributes(dpy, root, &ra);
+ XGetWindowAttributes(dpy, win, &ca);
+
+ /* Prevent UnmapNotify events */
+ XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask);
+ XSelectInput(dpy, win, ca.your_event_mask & ~StructureNotifyMask);
+
+ XUnmapWindow(dpy, win);
+
+ if (iconify)
+ window_set_state(dpy, win, IconicState);
+
+ XSelectInput(dpy, root, ra.your_event_mask);
+ XSelectInput(dpy, win, ca.your_event_mask);
+ XUngrabServer(dpy);
+}
+
void
view(const Arg *arg)
{

View File

@ -0,0 +1,103 @@
From 9cd160c4ba9c345c24644a7da77cc4f04fc93c4e Mon Sep 17 00:00:00 2001
From: Matt Quintanilla <matt@mattquintanilla.xyz>
Date: Fri, 13 Oct 2023 20:11:08 +0100
Subject: [PATCH] alwaysontop for all
---
config.def.h | 1 +
dwm.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..c3c7edd 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_space, togglealwaysontop, {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..8d54b26 100644
--- a/dwm.c
+++ b/dwm.c
@@ -92,7 +92,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int bw, oldbw;
unsigned int tags;
- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
+ int isfixed, iscentered, isfloating, isalwaysontop, isurgent, neverfocus, oldstate, isfullscreen;
Client *next;
Client *snext;
Monitor *mon;
@@ -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 togglealwaysontop(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unfocus(Client *c, int setfocus);
@@ -732,8 +733,11 @@ drawbar(Monitor *m)
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
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);
+ if (m->sel->isalwaysontop)
+ drw_rect(drw, x + boxs, bh - boxw, boxw, boxw, 0, 0);
+ }
} else {
drw_setscheme(drw, scheme[SchemeNorm]);
drw_rect(drw, x, 0, w, bh, 1, 1);
@@ -1356,6 +1360,17 @@ restack(Monitor *m)
return;
if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
XRaiseWindow(dpy, m->sel->win);
+
+ /* raise the aot window */
+ for(Monitor *m_search = mons; m_search; m_search = m_search->next){
+ for(c = m_search->clients; c; c = c->next){
+ if(c->isalwaysontop){
+ XRaiseWindow(dpy, c->win);
+ }
+ }
+ }
+
if (m->lt[m->sellt]->arrange) {
wc.stack_mode = Below;
wc.sibling = m->barwin;
@@ -1716,6 +1731,32 @@ togglefloating(const Arg *arg)
if (selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
selmon->sel->w, selmon->sel->h, 0);
+ else
+ selmon->sel->isalwaysontop = 0; /* disabled, turn this off too */
+ arrange(selmon);
+}
+
+void
+togglealwaysontop(const Arg *arg)
+{
+ if (!selmon->sel)
+ return;
+ if (selmon->sel->isfullscreen)
+ return;
+
+ if(selmon->sel->isalwaysontop){
+ selmon->sel->isalwaysontop = 0;
+ }else{
+ c->isalwaysontop = 0;
+
+ }
+
arrange(selmon);
}
--
2.31.1

View File

@ -0,0 +1,77 @@
From a071b060a1b9b94bcb167b988cf7774ceb870aad Mon Sep 17 00:00:00 2001
From: Jack Bird <jack.bird@durham.ac.uk>
Date: Mon, 2 Aug 2021 18:44:05 +0100
Subject: [PATCH] deck patch works with 6.2
---
config.def.h | 2 ++
dwm.c | 26 ++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/config.def.h b/config.def.h
index a2ac963..d865e18 100644
--- a/config.def.h
+++ b/config.def.h
@@ -42,6 +42,7 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "[D]", deck },
};
/* key definitions */
@@ -77,6 +78,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, XK_r, setlayout, {.v = &layouts[3]} },
{ 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 5e4d494..c67ff91 100644
--- a/dwm.c
+++ b/dwm.c
@@ -157,6 +157,7 @@ static void configure(Client *c);
static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e);
static Monitor *createmon(void);
+static void deck(Monitor *m);
static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
@@ -655,6 +656,31 @@ destroynotify(XEvent *e)
unmanage(c, 1);
}
+void
+deck(Monitor *m) {
+ unsigned int i, n, h, mw, my;
+ Client *c;
+
+ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ if(n == 0)
+ return;
+
+ if(n > m->nmaster) {
+ mw = m->nmaster ? m->ww * m->mfact : 0;
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
+ }
+ else
+ mw = m->ww;
+ for(i = my = 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), False);
+ my += HEIGHT(c);
+ }
+ else
+ resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
+}
+
void
detach(Client *c)
{
--
2.32.0

View File

@ -0,0 +1,55 @@
From a9e442ec18683e2255ffef74404c283bbb0b6381 Mon Sep 17 00:00:00 2001
From: aleks <aleks.stier@icloud.com>
Date: Thu, 23 May 2019 23:27:59 +0200
Subject: [PATCH] Make deck-patch work with the tilegap-patch
Apply this patch on top of the deck-patch to make it work with the
tilegap-patch.
---
dwm.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/dwm.c b/dwm.c
index 5b68242..1c17891 100644
--- a/dwm.c
+++ b/dwm.c
@@ -656,7 +656,7 @@ createmon(void)
void
deck(Monitor *m) {
- unsigned int i, n, h, mw, my;
+ unsigned int i, n, h, mw, my, ns;
Client *c;
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
@@ -665,18 +665,20 @@ deck(Monitor *m) {
if(n > m->nmaster) {
mw = m->nmaster ? m->ww * m->mfact : 0;
+ ns = m->nmaster > 0 ? 2 : 1;
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
- }
- else
+ } else {
mw = m->ww;
- for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ ns = 1;
+ }
+ for(i = 0, my = gappx, 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), False);
- my += HEIGHT(c);
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
+ resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
+ my += HEIGHT(c) + gappx;
}
else
- resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
+ resize(c, m->wx + mw + gappx/ns, m->wy + gappx, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, m->wh - (2*c->bw) - 2*gappx, False);
}
void
--
2.21.0

View File

@ -4,4 +4,5 @@ cat <<EOF | xmenu
[]= Tiled Layout 0
><> Floating Layout 1
[M] Monocle Layout 2
[D] Deck Layout 3
EOF