Added patches for 6.3
This commit is contained in:
parent
4427b3f133
commit
353dae3c41
1217
patches/dwm-dwmblocks-6.3.diff
Normal file
1217
patches/dwm-dwmblocks-6.3.diff
Normal file
File diff suppressed because it is too large
Load diff
472
patches/dwm-systray-dwmblocks-6.3.diff
Normal file
472
patches/dwm-systray-dwmblocks-6.3.diff
Normal file
|
@ -0,0 +1,472 @@
|
|||
diff -ruN dwm-6.3-ori/config.def.h dwm-6.3/config.def.h
|
||||
--- dwm-6.3-ori/config.def.h 2022-02-16 00:26:13.967478771 +0530
|
||||
+++ dwm-6.3/config.def.h 2022-02-16 00:39:47.033030382 +0530
|
||||
@@ -4,7 +4,6 @@
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
|
||||
-static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */
|
||||
static const unsigned int systrayspacing = 2; /* systray spacing */
|
||||
static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
|
||||
static const int showsystray = 1; /* 0 means no systray */
|
||||
@@ -17,10 +16,26 @@
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
static const char col_gray4[] = "#eeeeee";
|
||||
static const char col_cyan[] = "#005577";
|
||||
+static const char col1[] = "#ffffff";
|
||||
+static const char col2[] = "#ffffff";
|
||||
+static const char col3[] = "#ffffff";
|
||||
+static const char col4[] = "#ffffff";
|
||||
+static const char col5[] = "#ffffff";
|
||||
+static const char col6[] = "#ffffff";
|
||||
+
|
||||
+enum { SchemeNorm, SchemeCol1, SchemeCol2, SchemeCol3, SchemeCol4,
|
||||
+ SchemeCol5, SchemeCol6, SchemeSel }; /* color schemes */
|
||||
+
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
- [SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
+ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
+ [SchemeCol1] = { col1, col_gray1, col_gray2 },
|
||||
+ [SchemeCol2] = { col2, col_gray1, col_gray2 },
|
||||
+ [SchemeCol3] = { col3, col_gray1, col_gray2 },
|
||||
+ [SchemeCol4] = { col4, col_gray1, col_gray2 },
|
||||
+ [SchemeCol5] = { col5, col_gray1, col_gray2 },
|
||||
+ [SchemeCol6] = { col6, col_gray1, col_gray2 },
|
||||
+ [SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
@@ -109,7 +124,9 @@
|
||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
- { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||
+ { ClkStatusText, 0, Button1, sigdwmblocks, {.i = 1} },
|
||||
+ { ClkStatusText, 0, Button2, sigdwmblocks, {.i = 2} },
|
||||
+ { ClkStatusText, 0, Button3, sigdwmblocks, {.i = 3} },
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||
diff -ruN dwm-6.3-ori/dwm.c dwm-6.3/dwm.c
|
||||
--- dwm-6.3-ori/dwm.c 2022-02-16 00:26:13.970812142 +0530
|
||||
+++ dwm-6.3/dwm.c 2022-02-16 00:40:50.847058491 +0530
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#endif /* XINERAMA */
|
||||
#include <X11/Xft/Xft.h>
|
||||
+#include <fcntl.h>
|
||||
|
||||
#include "drw.h"
|
||||
#include "util.h"
|
||||
@@ -56,6 +57,13 @@
|
||||
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
|
||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||
+#define TTEXTW(X) (drw_fontset_getwidth(drw, (X)))
|
||||
+
|
||||
+#define STATUSLENGTH 256
|
||||
+#define DWMBLOCKSLOCKFILE "/var/local/dwmblocks/dwmblocks.pid"
|
||||
+#define DELIMITERENDCHAR 10
|
||||
+#define LSPAD (lrpad / 2) /* padding on left side of status text */
|
||||
+#define RSPAD (lrpad / 2) /* padding on right side of status text */
|
||||
|
||||
#define SYSTEM_TRAY_REQUEST_DOCK 0
|
||||
/* XEMBED messages */
|
||||
@@ -71,8 +79,7 @@
|
||||
#define XEMBED_EMBEDDED_VERSION (VERSION_MAJOR << 16) | VERSION_MINOR
|
||||
|
||||
/* enums */
|
||||
-enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||
-enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||
+enum { CurNormal, CurHand, CurResize, CurMove, CurLast }; /* cursor */
|
||||
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||
NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz,
|
||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||
@@ -139,6 +146,7 @@
|
||||
unsigned int tagset[2];
|
||||
int showbar;
|
||||
int topbar;
|
||||
+ int statushandcursor;
|
||||
Client *clients;
|
||||
Client *sel;
|
||||
Client *stack;
|
||||
@@ -231,6 +239,7 @@
|
||||
static void seturgent(Client *c, int urg);
|
||||
static void showhide(Client *c);
|
||||
static void sigchld(int unused);
|
||||
+static void sigdwmblocks(const Arg *arg);
|
||||
static void spawn(const Arg *arg);
|
||||
static Monitor *systraytomon(Monitor *m);
|
||||
static void tag(const Arg *arg);
|
||||
@@ -246,6 +255,7 @@
|
||||
static void updatebarpos(Monitor *m);
|
||||
static void updatebars(void);
|
||||
static void updateclientlist(void);
|
||||
+static void updatedwmblockssig(int x);
|
||||
static int updategeom(void);
|
||||
static void updatenumlockmask(void);
|
||||
static void updatesizehints(Client *c);
|
||||
@@ -266,14 +276,17 @@
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
-static Systray *systray = NULL;
|
||||
static const char broken[] = "broken";
|
||||
-static char stext[256];
|
||||
+static char stextc[STATUSLENGTH];
|
||||
+static char stexts[STATUSLENGTH];
|
||||
static int screen;
|
||||
static int sw, sh; /* X display screen geometry width, height */
|
||||
-static int bh, blw = 0; /* bar geometry */
|
||||
+static int bh, blw, ble; /* bar geometry */
|
||||
+static int wsbar; /* width of selmon bar */
|
||||
+static int wstext; /* width of status text */
|
||||
static int lrpad; /* sum of left and right padding for text */
|
||||
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||
+static unsigned int dwmblockssig;
|
||||
static unsigned int numlockmask = 0;
|
||||
static void (*handler[LASTEvent]) (XEvent *) = {
|
||||
[ButtonPress] = buttonpress,
|
||||
@@ -300,6 +313,7 @@
|
||||
static Drw *drw;
|
||||
static Monitor *mons, *selmon;
|
||||
static Window root, wmcheckwin;
|
||||
+static Systray *systray = NULL;
|
||||
|
||||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
@@ -449,13 +463,13 @@
|
||||
void
|
||||
buttonpress(XEvent *e)
|
||||
{
|
||||
- unsigned int i, x, click;
|
||||
+ int i, x;
|
||||
+ unsigned int click;
|
||||
Arg arg = {0};
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
XButtonPressedEvent *ev = &e->xbutton;
|
||||
|
||||
- click = ClkRootWin;
|
||||
/* focus monitor if necessary */
|
||||
if ((m = wintomon(ev->window)) && m != selmon) {
|
||||
unfocus(selmon->sel, 1);
|
||||
@@ -463,25 +477,29 @@
|
||||
focus(NULL);
|
||||
}
|
||||
if (ev->window == selmon->barwin) {
|
||||
- i = x = 0;
|
||||
- do
|
||||
- x += TEXTW(tags[i]);
|
||||
- while (ev->x >= x && ++i < LENGTH(tags));
|
||||
- if (i < LENGTH(tags)) {
|
||||
- click = ClkTagBar;
|
||||
- arg.ui = 1 << i;
|
||||
- } else if (ev->x < x + blw)
|
||||
- click = ClkLtSymbol;
|
||||
- else if (ev->x > selmon->ww - (int)TEXTW(stext) - getsystraywidth())
|
||||
- click = ClkStatusText;
|
||||
- else
|
||||
- click = ClkWinTitle;
|
||||
+ if (ev->x < ble - blw) {
|
||||
+ i = -1, x = -ev->x;
|
||||
+ do
|
||||
+ x += TEXTW(tags[++i]);
|
||||
+ while (x <= 0);
|
||||
+ click = ClkTagBar;
|
||||
+ arg.ui = 1 << i;
|
||||
+ } else if (ev->x < ble)
|
||||
+ click = ClkLtSymbol;
|
||||
+ else if (ev->x < wsbar - wstext)
|
||||
+ click = ClkWinTitle;
|
||||
+ else if ((x = wsbar - RSPAD - ev->x) > 0 && (x -= wstext - LSPAD - RSPAD) <= 0) {
|
||||
+ updatedwmblockssig(x);
|
||||
+ click = ClkStatusText;
|
||||
+ } else
|
||||
+ return;
|
||||
} else if ((c = wintoclient(ev->window))) {
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
XAllowEvents(dpy, ReplayPointer, CurrentTime);
|
||||
click = ClkClientWin;
|
||||
- }
|
||||
+ } else
|
||||
+ click = ClkRootWin;
|
||||
for (i = 0; i < LENGTH(buttons); i++)
|
||||
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
|
||||
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
|
||||
@@ -789,7 +807,8 @@
|
||||
void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
- int x, w, tw = 0, stw = 0;
|
||||
+ int x, w;
|
||||
+ int wbar = m->ww;
|
||||
int boxs = drw->fonts->h / 9;
|
||||
int boxw = drw->fonts->h / 6 + 2;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
@@ -798,17 +817,40 @@
|
||||
if (!m->showbar)
|
||||
return;
|
||||
|
||||
- if(showsystray && m == systraytomon(m) && !systrayonleft)
|
||||
- stw = getsystraywidth();
|
||||
+ if (showsystray && m == systraytomon(m))
|
||||
+ wbar -= getsystraywidth();
|
||||
|
||||
/* draw status first so it can be overdrawn by tags later */
|
||||
if (m == selmon) { /* status is only drawn on selected monitor */
|
||||
- drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
- tw = TEXTW(stext) - lrpad / 2 + 2; /* 2px extra right padding */
|
||||
- drw_text(drw, m->ww - tw - stw, 0, tw, bh, lrpad / 2 - 2, stext, 0);
|
||||
+ char *stc = stextc;
|
||||
+ char *stp = stextc;
|
||||
+ char tmp;
|
||||
+
|
||||
+ wsbar = wbar;
|
||||
+ drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
+ x = wbar - wstext;
|
||||
+ drw_rect(drw, x, 0, LSPAD, bh, 1, 1); x += LSPAD; /* to keep left padding clean */
|
||||
+ for (;;) {
|
||||
+ if ((unsigned char)*stc >= ' ') {
|
||||
+ stc++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ tmp = *stc;
|
||||
+ if (stp != stc) {
|
||||
+ *stc = '\0';
|
||||
+ x = drw_text(drw, x, 0, TTEXTW(stp), bh, 0, stp, 0);
|
||||
+ }
|
||||
+ if (tmp == '\0')
|
||||
+ break;
|
||||
+ if (tmp - DELIMITERENDCHAR - 1 < LENGTH(colors))
|
||||
+ drw_setscheme(drw, scheme[tmp - DELIMITERENDCHAR - 1]);
|
||||
+ *stc = tmp;
|
||||
+ stp = ++stc;
|
||||
+ }
|
||||
+ drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
+ drw_rect(drw, x, 0, wbar - x, bh, 1, 1); /* to keep right padding clean */
|
||||
}
|
||||
|
||||
- resizebarwin(m);
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
occ |= c->tags;
|
||||
if (c->isurgent)
|
||||
@@ -825,11 +867,17 @@
|
||||
urg & 1 << i);
|
||||
x += w;
|
||||
}
|
||||
- w = blw = TEXTW(m->ltsymbol);
|
||||
+ w = TEXTW(m->ltsymbol);
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||
|
||||
- if ((w = m->ww - tw - stw - x) > bh) {
|
||||
+ if (m == selmon) {
|
||||
+ blw = w, ble = x;
|
||||
+ w = wbar - wstext - x;
|
||||
+ } else
|
||||
+ w = wbar - x;
|
||||
+
|
||||
+ if (w > bh) {
|
||||
if (m->sel) {
|
||||
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||
@@ -840,7 +888,9 @@
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
}
|
||||
}
|
||||
- drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
|
||||
+
|
||||
+ XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, wbar, bh);
|
||||
+ drw_map(drw, m->barwin, 0, 0, wbar, bh);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1249,17 +1299,24 @@
|
||||
motionnotify(XEvent *e)
|
||||
{
|
||||
static Monitor *mon = NULL;
|
||||
+ int x;
|
||||
Monitor *m;
|
||||
XMotionEvent *ev = &e->xmotion;
|
||||
|
||||
- if (ev->window != root)
|
||||
- return;
|
||||
- if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
|
||||
- unfocus(selmon->sel, 1);
|
||||
- selmon = m;
|
||||
- focus(NULL);
|
||||
- }
|
||||
- mon = m;
|
||||
+ if (ev->window == root) {
|
||||
+ if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
|
||||
+ unfocus(selmon->sel, 1);
|
||||
+ selmon = m;
|
||||
+ focus(NULL);
|
||||
+ }
|
||||
+ mon = m;
|
||||
+ } else if (ev->window == selmon->barwin && (x = wsbar - RSPAD - ev->x) > 0
|
||||
+ && (x -= wstext - LSPAD - RSPAD) <= 0)
|
||||
+ updatedwmblockssig(x);
|
||||
+ else if (selmon->statushandcursor) {
|
||||
+ selmon->statushandcursor = 0;
|
||||
+ XDefineCursor(dpy, selmon->barwin, cursor[CurNormal]->cursor);
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1429,7 +1486,7 @@
|
||||
void
|
||||
resizebarwin(Monitor *m) {
|
||||
unsigned int w = m->ww;
|
||||
- if (showsystray && m == systraytomon(m) && !systrayonleft)
|
||||
+ if (showsystray && m == systraytomon(m))
|
||||
w -= getsystraywidth();
|
||||
XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh);
|
||||
}
|
||||
@@ -1757,6 +1814,7 @@
|
||||
xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
|
||||
/* init cursors */
|
||||
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
|
||||
+ cursor[CurHand] = drw_cur_create(drw, XC_hand2);
|
||||
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
||||
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
|
||||
/* init appearance */
|
||||
@@ -1832,6 +1890,37 @@
|
||||
}
|
||||
|
||||
void
|
||||
+sigdwmblocks(const Arg *arg)
|
||||
+{
|
||||
+ static int fd = -1;
|
||||
+ struct flock fl;
|
||||
+ union sigval sv;
|
||||
+
|
||||
+ if (!dwmblockssig)
|
||||
+ return;
|
||||
+ fl.l_type = F_WRLCK;
|
||||
+ fl.l_whence = SEEK_SET;
|
||||
+ fl.l_start = 0;
|
||||
+ fl.l_len = 0;
|
||||
+ if (fd != -1) {
|
||||
+ if (fcntl(fd, F_GETLK, &fl) != -1 && fl.l_type == F_WRLCK)
|
||||
+ goto signal;
|
||||
+ close(fd);
|
||||
+ fl.l_type = F_WRLCK;
|
||||
+ }
|
||||
+ if ((fd = open(DWMBLOCKSLOCKFILE, O_RDONLY | O_CLOEXEC)) == -1)
|
||||
+ return;
|
||||
+ if (fcntl(fd, F_GETLK, &fl) == -1 || fl.l_type != F_WRLCK) {
|
||||
+ close(fd);
|
||||
+ fd = -1;
|
||||
+ return;
|
||||
+ }
|
||||
+signal:
|
||||
+ sv.sival_int = (dwmblockssig << 8) | arg->i;
|
||||
+ sigqueue(fl.l_pid, SIGRTMIN, sv);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
spawn(const Arg *arg)
|
||||
{
|
||||
if (arg->v == dmenucmd)
|
||||
@@ -2020,7 +2109,7 @@
|
||||
XSetWindowAttributes wa = {
|
||||
.override_redirect = True,
|
||||
.background_pixmap = ParentRelative,
|
||||
- .event_mask = ButtonPressMask|ExposureMask
|
||||
+ .event_mask = ButtonPressMask|ExposureMask|PointerMotionMask
|
||||
};
|
||||
XClassHint ch = {"dwm", "dwm"};
|
||||
for (m = mons; m; m = m->next) {
|
||||
@@ -2067,6 +2156,41 @@
|
||||
(unsigned char *) &(c->win), 1);
|
||||
}
|
||||
|
||||
+void
|
||||
+updatedwmblockssig(int x)
|
||||
+{
|
||||
+ char *sts = stexts;
|
||||
+ char *stp = stexts;
|
||||
+ char tmp;
|
||||
+
|
||||
+ while (*sts != '\0') {
|
||||
+ if ((unsigned char)*sts >= ' ') {
|
||||
+ sts++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ tmp = *sts;
|
||||
+ *sts = '\0';
|
||||
+ x += TTEXTW(stp);
|
||||
+ *sts = tmp;
|
||||
+ if (x > 0) {
|
||||
+ if (tmp == DELIMITERENDCHAR)
|
||||
+ break;
|
||||
+ if (!selmon->statushandcursor) {
|
||||
+ selmon->statushandcursor = 1;
|
||||
+ XDefineCursor(dpy, selmon->barwin, cursor[CurHand]->cursor);
|
||||
+ }
|
||||
+ dwmblockssig = tmp;
|
||||
+ return;
|
||||
+ }
|
||||
+ stp = ++sts;
|
||||
+ }
|
||||
+ if (selmon->statushandcursor) {
|
||||
+ selmon->statushandcursor = 0;
|
||||
+ XDefineCursor(dpy, selmon->barwin, cursor[CurNormal]->cursor);
|
||||
+ }
|
||||
+ dwmblockssig = 0;
|
||||
+}
|
||||
+
|
||||
int
|
||||
updategeom(void)
|
||||
{
|
||||
@@ -2207,10 +2331,27 @@
|
||||
void
|
||||
updatestatus(void)
|
||||
{
|
||||
- if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
|
||||
- strcpy(stext, "dwm-"VERSION);
|
||||
- drawbar(selmon);
|
||||
- updatesystray();
|
||||
+ char rawstext[STATUSLENGTH];
|
||||
+
|
||||
+ if (gettextprop(root, XA_WM_NAME, rawstext, sizeof rawstext)) {
|
||||
+ char stextp[STATUSLENGTH];
|
||||
+ char *stp = stextp, *stc = stextc, *sts = stexts;
|
||||
+
|
||||
+ for (char *rst = rawstext; *rst != '\0'; rst++)
|
||||
+ if ((unsigned char)*rst >= ' ')
|
||||
+ *(stp++) = *(stc++) = *(sts++) = *rst;
|
||||
+ else if ((unsigned char)*rst > DELIMITERENDCHAR)
|
||||
+ *(stc++) = *rst;
|
||||
+ else
|
||||
+ *(sts++) = *rst;
|
||||
+ *stp = *stc = *sts = '\0';
|
||||
+ wstext = TTEXTW(stextp) + LSPAD + RSPAD;
|
||||
+ } else {
|
||||
+ strcpy(stextc, "dwm-"VERSION);
|
||||
+ strcpy(stexts, stextc);
|
||||
+ wstext = TTEXTW(stextc) + LSPAD + RSPAD;
|
||||
+ }
|
||||
+ drawbar(selmon);
|
||||
}
|
||||
|
||||
|
||||
@@ -2273,13 +2414,10 @@
|
||||
Client *i;
|
||||
Monitor *m = systraytomon(NULL);
|
||||
unsigned int x = m->mx + m->mw;
|
||||
- unsigned int sw = TEXTW(stext) - lrpad + systrayspacing;
|
||||
unsigned int w = 1;
|
||||
|
||||
if (!showsystray)
|
||||
return;
|
||||
- if (systrayonleft)
|
||||
- x -= sw + lrpad / 2;
|
||||
if (!systray) {
|
||||
/* init systray */
|
||||
if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
|
Loading…
Reference in a new issue