Skip to content

Instantly share code, notes, and snippets.

@p4p1
Last active December 7, 2021 10:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p4p1/234b0a27b5968226cf5c1df918e4ed28 to your computer and use it in GitHub Desktop.
Save p4p1/234b0a27b5968226cf5c1df918e4ed28 to your computer and use it in GitHub Desktop.
📱📱📱📱
/* diff file to add gui menu support to dwm */
diff -up a/config.def.h b/config.def.h
--- a/config.def.h 2021-11-05 20:35:26.145640275 +0000
+++ b/config.def.h 2021-11-07 03:00:47.647102598 +0000
@@ -5,6 +5,7 @@ static const unsigned int borderpx = 1;
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
+static const char *panel_str = "tint2";
static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10";
static const char col_gray1[] = "#222222";
@@ -29,6 +30,7 @@ static const Rule rules[] = {
/* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
+ { "Tint2", NULL, NULL, 511, 0, -1 }, // Show tint2 on every page
};
/* layout(s) */
diff -up a/dwm.c b/dwm.c
--- a/dwm.c 2021-11-05 20:35:26.145640275 +0000
+++ b/dwm.c 2021-12-05 05:28:06.014421495 +0000
@@ -709,7 +709,8 @@ drawbar(Monitor *m)
}
for (c = m->clients; c; c = c->next) {
- occ |= c->tags;
+ if (strcmp(c->name, panel_str))
+ occ |= c->tags;
if (c->isurgent)
urg |= c->tags;
}
@@ -729,7 +730,7 @@ drawbar(Monitor *m)
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
if ((w = m->ww - sw - x) > bh) {
- if (m->sel) {
+ if (m->sel && strcmp(m->sel->name, panel_str)) {
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)
@@ -783,8 +784,11 @@ expose(XEvent *e)
void
focus(Client *c)
{
- if (!c || !ISVISIBLE(c))
+ if (!c || !ISVISIBLE(c)) {
for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
+ if (c && !strcmp(c->name, panel_str))
+ c = NULL;
+ }
if (selmon->sel && selmon->sel != c)
unfocus(selmon->sel, 0);
if (c) {
@@ -1001,7 +1005,7 @@ keypress(XEvent *e)
void
killclient(const Arg *arg)
{
- if (!selmon->sel)
+ if (!selmon->sel || !strcmp(selmon->sel->name, panel_str))
return;
if (!sendevent(selmon->sel, wmatom[WMDelete])) {
XGrabServer(dpy);
@@ -1047,7 +1051,10 @@ manage(Window w, XWindowAttributes *wa)
/* only fix client y-offset, if the client center might cover the bar */
c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
- c->bw = borderpx;
+ if (!strcmp(c->name, panel_str))
+ c->bw = 0;
+ else
+ c->bw = borderpx;
wc.border_width = c->bw;
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
@@ -1624,7 +1631,10 @@ showhide(Client *c)
} else {
/* hide clients bottom up */
showhide(c->snext);
- XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
+ /* don't hide window if name match panel_str */
+ if (strcmp(c->name, panel_str)) {
+ XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
+ }
}
}
@@ -1655,6 +1665,8 @@ spawn(const Arg *arg)
void
tag(const Arg *arg)
{
+ if (selmon && selmon->sel && !strcmp(selmon->sel->name, panel_str))
+ return;
if (selmon->sel && arg->ui & TAGMASK) {
selmon->sel->tags = arg->ui & TAGMASK;
focus(NULL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment