2020-08-17 22:20:25 +00:00
|
|
|
diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h
|
|
|
|
--- dwm-6.2-ori/config.def.h 2020-08-17 23:51:19.053910127 +0530
|
|
|
|
+++ dwm-6.2/config.def.h 2020-08-18 03:44:20.360800879 +0530
|
|
|
|
@@ -16,10 +16,34 @@
|
|
|
|
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";
|
|
|
|
+static const char col7[] = "#ffffff";
|
|
|
|
+static const char col8[] = "#ffffff";
|
|
|
|
+static const char col9[] = "#ffffff";
|
|
|
|
+static const char col10[] = "#ffffff";
|
|
|
|
+static const char col11[] = "#ffffff";
|
|
|
|
+static const char col12[] = "#ffffff";
|
|
|
|
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 },
|
|
|
|
+ [SchemeCol7] = { col7, col_gray1, col_gray2 },
|
|
|
|
+ [SchemeCol8] = { col8, col_gray1, col_gray2 },
|
|
|
|
+ [SchemeCol9] = { col8, col_gray1, col_gray2 },
|
|
|
|
+ [SchemeCol10] = { col10, col_gray1, col_gray2 },
|
|
|
|
+ [SchemeCol11] = { col11, col_gray1, col_gray2 },
|
|
|
|
+ [SchemeCol12] = { col12, col_gray1, col_gray2 },
|
|
|
|
+ [SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
|
|
|
};
|
|
|
|
|
|
|
|
/* tagging */
|
|
|
|
@@ -107,7 +131,9 @@
|
|
|
|
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
|
|
|
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
|
|
|
{ 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.2-ori/dwm.c dwm-6.2/dwm.c
|
|
|
|
--- dwm-6.2-ori/dwm.c 2020-08-17 23:51:19.057243495 +0530
|
2020-11-08 15:43:08 +00:00
|
|
|
+++ dwm-6.2/dwm.c 2020-11-08 21:08:31.006162648 +0530
|
|
|
|
@@ -40,6 +40,7 @@
|
2020-08-17 22:20:25 +00:00
|
|
|
#include <X11/extensions/Xinerama.h>
|
|
|
|
#endif /* XINERAMA */
|
|
|
|
#include <X11/Xft/Xft.h>
|
|
|
|
+#include <fcntl.h>
|
|
|
|
|
|
|
|
#include "drw.h"
|
|
|
|
#include "util.h"
|
2020-11-08 15:43:08 +00:00
|
|
|
@@ -56,6 +57,9 @@
|
2020-08-17 22:20:25 +00:00
|
|
|
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
|
|
|
|
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
|
|
|
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
2020-08-21 18:22:43 +00:00
|
|
|
+#define TTEXTW(X) (drw_fontset_getwidth(drw, (X)))
|
2020-08-17 22:20:25 +00:00
|
|
|
+
|
|
|
|
+#define DWMBLOCKSLOCKFILE "/tmp/dwmblocks.pid"
|
|
|
|
|
|
|
|
#define SYSTEM_TRAY_REQUEST_DOCK 0
|
|
|
|
|
2020-11-08 15:43:08 +00:00
|
|
|
@@ -74,8 +78,10 @@
|
2020-08-17 22:20:25 +00:00
|
|
|
#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 { SchemeNorm, SchemeCol1, SchemeCol2, SchemeCol3, SchemeCol4,
|
|
|
|
+ SchemeCol5, SchemeCol6, SchemeCol7, SchemeCol8, SchemeCol9,
|
|
|
|
+ SchemeCol10, SchemeCol11, SchemeCol12, SchemeSel }; /* color schemes */
|
|
|
|
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
|
|
|
NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz,
|
|
|
|
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
|
|
|
@@ -234,6 +240,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);
|
2020-09-23 15:07:49 +00:00
|
|
|
@@ -249,6 +256,7 @@
|
2020-08-17 22:20:25 +00:00
|
|
|
static void updatebarpos(Monitor *m);
|
|
|
|
static void updatebars(void);
|
|
|
|
static void updateclientlist(void);
|
2020-09-23 15:07:49 +00:00
|
|
|
+static void updatedwmblockssig(int x);
|
2020-08-17 22:20:25 +00:00
|
|
|
static int updategeom(void);
|
|
|
|
static void updatenumlockmask(void);
|
|
|
|
static void updatesizehints(Client *c);
|
2020-11-08 15:43:08 +00:00
|
|
|
@@ -269,14 +277,17 @@
|
|
|
|
static void zoom(const Arg *arg);
|
|
|
|
|
2020-08-17 22:20:25 +00:00
|
|
|
/* variables */
|
2020-11-08 15:43:08 +00:00
|
|
|
-static Systray *systray = NULL;
|
2020-08-17 22:20:25 +00:00
|
|
|
static const char broken[] = "broken";
|
|
|
|
-static char stext[256];
|
|
|
|
+static char stextc[256];
|
|
|
|
+static char stexts[256];
|
|
|
|
static int screen;
|
2020-11-08 15:43:08 +00:00
|
|
|
-static int sw, sh; /* X display screen geometry width, height */
|
2020-08-17 22:20:25 +00:00
|
|
|
-static int bh, blw = 0; /* bar geometry */
|
2020-11-08 15:43:08 +00:00
|
|
|
-static int lrpad; /* sum of left and right padding for text */
|
|
|
|
+static int sw, sh; /* X display screen geometry width, height */
|
|
|
|
+static int bh, blw, ble, stw; /* bar geometry */
|
|
|
|
+static int lrpad; /* sum of left and right padding for text */
|
2020-08-17 22:20:25 +00:00
|
|
|
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
2020-11-08 15:43:08 +00:00
|
|
|
+static int statushandcursor;
|
|
|
|
+static int wstext;
|
|
|
|
+static unsigned int dwmblockssig;
|
2020-08-17 22:20:25 +00:00
|
|
|
static unsigned int numlockmask = 0;
|
2020-11-08 15:43:08 +00:00
|
|
|
static void (*handler[LASTEvent]) (XEvent *) = {
|
|
|
|
[ButtonPress] = buttonpress,
|
|
|
|
@@ -303,6 +314,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"
|
|
|
|
@@ -452,13 +464,13 @@
|
2020-09-30 16:29:06 +00:00
|
|
|
void
|
|
|
|
buttonpress(XEvent *e)
|
|
|
|
{
|
|
|
|
- unsigned int i, x, click;
|
2020-11-08 15:43:08 +00:00
|
|
|
+ int i, x;
|
|
|
|
+ unsigned int click;
|
2020-09-30 16:29:06 +00:00
|
|
|
Arg arg = {0};
|
|
|
|
Client *c;
|
|
|
|
Monitor *m;
|
2020-11-08 15:43:08 +00:00
|
|
|
XButtonPressedEvent *ev = &e->xbutton;
|
|
|
|
|
|
|
|
- click = ClkRootWin;
|
|
|
|
/* focus monitor if necessary */
|
|
|
|
if ((m = wintomon(ev->window)) && m != selmon) {
|
|
|
|
unfocus(selmon->sel, 1);
|
|
|
|
@@ -466,25 +478,34 @@
|
2020-09-30 16:29:06 +00:00
|
|
|
focus(NULL);
|
|
|
|
}
|
|
|
|
if (ev->window == selmon->barwin) {
|
|
|
|
- i = x = 0;
|
2020-11-08 15:43:08 +00:00
|
|
|
- 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;
|
2020-08-17 22:20:25 +00:00
|
|
|
- else if (ev->x > selmon->ww - TEXTW(stext) - getsystraywidth())
|
|
|
|
- click = ClkStatusText;
|
|
|
|
- else
|
|
|
|
- click = ClkWinTitle;
|
2020-11-08 15:43:08 +00:00
|
|
|
+ if (ev->x < ble) {
|
|
|
|
+ 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
|
|
|
|
+ click = ClkLtSymbol;
|
|
|
|
+ } else {
|
|
|
|
+ int wbar = showsystray && selmon == systraytomon(selmon) ? selmon->ww - stw : selmon->ww;
|
|
|
|
+
|
|
|
|
+ if (ev->x < wbar - wstext)
|
|
|
|
+ click = ClkWinTitle;
|
|
|
|
+ else if ((x = wbar - lrpad / 2 - ev->x) > 0 && (x -= wstext - lrpad) <= 0) {
|
|
|
|
+ updatedwmblockssig(x);
|
|
|
|
+ click = ClkStatusText;
|
|
|
|
+ } else
|
|
|
|
+ return;
|
|
|
|
+ }
|
2020-08-17 22:20:25 +00:00
|
|
|
} else if ((c = wintoclient(ev->window))) {
|
|
|
|
focus(c);
|
|
|
|
restack(selmon);
|
2020-11-08 15:43:08 +00:00
|
|
|
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,23 +810,44 @@
|
2020-08-17 22:20:25 +00:00
|
|
|
void
|
|
|
|
drawbar(Monitor *m)
|
|
|
|
{
|
|
|
|
- int x, w, sw = 0, stw = 0;
|
2020-11-08 15:43:08 +00:00
|
|
|
+ int x, w;
|
|
|
|
+ int wbar = m->ww;
|
2020-08-17 22:20:25 +00:00
|
|
|
int boxs = drw->fonts->h / 9;
|
|
|
|
int boxw = drw->fonts->h / 6 + 2;
|
|
|
|
unsigned int i, occ = 0, urg = 0;
|
|
|
|
Client *c;
|
|
|
|
|
|
|
|
- if(showsystray && m == systraytomon(m))
|
|
|
|
- stw = getsystraywidth();
|
2020-11-08 15:43:08 +00:00
|
|
|
+ if (showsystray && m == systraytomon(m))
|
|
|
|
+ wbar -= (stw = getsystraywidth());
|
|
|
|
|
2020-08-17 22:20:25 +00:00
|
|
|
/* 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]);
|
|
|
|
- sw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */
|
|
|
|
- drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2 - 2, stext, 0);
|
|
|
|
+ char *ts = stextc;
|
|
|
|
+ char *tp = stextc;
|
|
|
|
+ char ctmp;
|
|
|
|
+
|
|
|
|
+ drw_setscheme(drw, scheme[SchemeNorm]);
|
2020-11-08 15:43:08 +00:00
|
|
|
+ x = wbar - wstext;
|
|
|
|
+ drw_rect(drw, x, 0, lrpad / 2, bh, 1, 1); x += lrpad / 2; /* to keep left padding clean */
|
2020-08-17 22:20:25 +00:00
|
|
|
+ for (;;) {
|
|
|
|
+ if ((unsigned char)*ts > LENGTH(colors) + 10) {
|
|
|
|
+ ts++;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ ctmp = *ts;
|
|
|
|
+ *ts = '\0';
|
|
|
|
+ if (*tp != '\0')
|
|
|
|
+ x = drw_text(drw, x, 0, TTEXTW(tp), bh, 0, tp, 0);
|
|
|
|
+ if (ctmp == '\0')
|
|
|
|
+ break;
|
|
|
|
+ drw_setscheme(drw, scheme[ctmp - 11]);
|
|
|
|
+ *ts = ctmp;
|
|
|
|
+ tp = ++ts;
|
|
|
|
+ }
|
|
|
|
+ drw_setscheme(drw, scheme[SchemeNorm]);
|
2020-11-08 15:43:08 +00:00
|
|
|
+ drw_rect(drw, x, 0, wbar - x, bh, 1, 1); /* to keep right padding clean */
|
2020-08-17 22:20:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- resizebarwin(m);
|
|
|
|
for (c = m->clients; c; c = c->next) {
|
|
|
|
occ |= c->tags;
|
|
|
|
if (c->isurgent)
|
2020-11-08 15:43:08 +00:00
|
|
|
@@ -822,11 +864,17 @@
|
|
|
|
urg & 1 << i);
|
|
|
|
x += w;
|
|
|
|
}
|
|
|
|
- w = blw = TEXTW(m->ltsymbol);
|
|
|
|
+ w = TEXTW(m->ltsymbol);
|
2020-08-17 22:20:25 +00:00
|
|
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
|
|
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
|
|
|
|
|
|
|
- if ((w = m->ww - sw - stw - x) > bh) {
|
2020-11-08 15:43:08 +00:00
|
|
|
+ if (m == selmon) {
|
|
|
|
+ blw = w, ble = x;
|
|
|
|
+ w = wbar - wstext - x;
|
|
|
|
+ } else
|
|
|
|
+ w = wbar - x;
|
|
|
|
+
|
|
|
|
+ if (w > bh) {
|
2020-08-17 22:20:25 +00:00
|
|
|
if (m->sel) {
|
|
|
|
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
|
|
|
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
2020-11-08 15:43:08 +00:00
|
|
|
@@ -837,7 +885,9 @@
|
2020-08-17 22:20:25 +00:00
|
|
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
- drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
|
2020-11-08 15:43:08 +00:00
|
|
|
+
|
|
|
|
+ XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, wbar, bh);
|
2020-08-17 22:20:25 +00:00
|
|
|
+ drw_map(drw, m->barwin, 0, 0, wbar, bh);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-11-08 15:43:08 +00:00
|
|
|
@@ -1246,14 +1296,25 @@
|
2020-08-17 22:20:25 +00:00
|
|
|
Monitor *m;
|
|
|
|
XMotionEvent *ev = &e->xmotion;
|
|
|
|
|
|
|
|
- if (ev->window != root)
|
2020-11-08 15:43:08 +00:00
|
|
|
- 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) {
|
|
|
|
+ int x = selmon->ww - lrpad / 2 - ev->x;
|
2020-09-23 15:07:49 +00:00
|
|
|
+
|
2020-11-08 15:43:08 +00:00
|
|
|
+ if (showsystray && selmon == systraytomon(selmon))
|
|
|
|
+ x -= stw;
|
|
|
|
+ if (ev->x >= ble && x > 0 && (x -= wstext - lrpad) <= 0)
|
|
|
|
+ updatedwmblockssig(x);
|
|
|
|
+ else if (statushandcursor) {
|
|
|
|
+ statushandcursor = 0;
|
|
|
|
+ XDefineCursor(dpy, selmon->barwin, cursor[CurNormal]->cursor);
|
2020-09-23 15:07:49 +00:00
|
|
|
+ }
|
2020-08-17 22:20:25 +00:00
|
|
|
+ }
|
2020-11-08 15:43:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
@@ -1750,6 +1811,7 @@
|
2020-08-17 22:20:25 +00:00
|
|
|
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 */
|
2020-11-08 15:43:08 +00:00
|
|
|
@@ -1825,6 +1887,28 @@
|
2020-08-17 22:20:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
+sigdwmblocks(const Arg *arg)
|
|
|
|
+{
|
|
|
|
+ int fd;
|
|
|
|
+ struct flock fl;
|
|
|
|
+ union sigval sv;
|
|
|
|
+
|
|
|
|
+ if (!dwmblockssig)
|
|
|
|
+ return;
|
|
|
|
+ sv.sival_int = (dwmblockssig << 8) | arg->i;
|
|
|
|
+ fd = open(DWMBLOCKSLOCKFILE, O_RDONLY);
|
|
|
|
+ if (fd == -1)
|
|
|
|
+ return;
|
|
|
|
+ fl.l_type = F_WRLCK;
|
|
|
|
+ fl.l_start = 0;
|
|
|
|
+ fl.l_whence = SEEK_SET;
|
|
|
|
+ fl.l_len = 0;
|
|
|
|
+ if (fcntl(fd, F_GETLK, &fl) == -1 || fl.l_type == F_UNLCK)
|
|
|
|
+ return;
|
|
|
|
+ sigqueue(fl.l_pid, SIGRTMIN, sv);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void
|
|
|
|
spawn(const Arg *arg)
|
|
|
|
{
|
|
|
|
if (arg->v == dmenucmd)
|
2020-11-08 15:43:08 +00:00
|
|
|
@@ -2011,7 +2095,7 @@
|
2020-08-17 22:20:25 +00:00
|
|
|
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) {
|
2020-11-08 15:43:08 +00:00
|
|
|
@@ -2058,6 +2142,42 @@
|
2020-08-17 22:20:25 +00:00
|
|
|
(unsigned char *) &(c->win), 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
+void
|
2020-09-23 15:07:49 +00:00
|
|
|
+updatedwmblockssig(int x)
|
2020-08-17 22:20:25 +00:00
|
|
|
+{
|
|
|
|
+ char *ts = stexts;
|
|
|
|
+ char *tp = stexts;
|
|
|
|
+ char ctmp;
|
|
|
|
+
|
|
|
|
+ while (*ts != '\0') {
|
|
|
|
+ if ((unsigned char)*ts > 10) {
|
|
|
|
+ ts++;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ ctmp = *ts;
|
|
|
|
+ *ts = '\0';
|
|
|
|
+ x += TTEXTW(tp);
|
|
|
|
+ *ts = ctmp;
|
2020-09-23 15:07:49 +00:00
|
|
|
+ if (x >= 0) {
|
|
|
|
+ if (ctmp == 10)
|
2020-11-08 15:43:08 +00:00
|
|
|
+ goto cursorondelim;
|
2020-09-23 15:07:49 +00:00
|
|
|
+ if (!statushandcursor) {
|
|
|
|
+ statushandcursor = 1;
|
|
|
|
+ XDefineCursor(dpy, selmon->barwin, cursor[CurHand]->cursor);
|
|
|
|
+ }
|
|
|
|
+ dwmblockssig = ctmp;
|
2020-08-17 22:20:25 +00:00
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ tp = ++ts;
|
|
|
|
+ }
|
2020-11-08 15:43:08 +00:00
|
|
|
+cursorondelim:
|
2020-09-23 15:07:49 +00:00
|
|
|
+ if (statushandcursor) {
|
|
|
|
+ statushandcursor = 0;
|
|
|
|
+ XDefineCursor(dpy, selmon->barwin, cursor[CurNormal]->cursor);
|
|
|
|
+ }
|
2020-08-17 22:20:25 +00:00
|
|
|
+ dwmblockssig = 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
int
|
|
|
|
updategeom(void)
|
|
|
|
{
|
2020-11-08 15:43:08 +00:00
|
|
|
@@ -2198,10 +2318,27 @@
|
2020-08-17 22:20:25 +00:00
|
|
|
void
|
|
|
|
updatestatus(void)
|
|
|
|
{
|
|
|
|
- if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
|
|
|
|
- strcpy(stext, "dwm-"VERSION);
|
|
|
|
- drawbar(selmon);
|
|
|
|
- updatesystray();
|
|
|
|
+ char rawstext[256];
|
|
|
|
+
|
|
|
|
+ if (gettextprop(root, XA_WM_NAME, rawstext, sizeof rawstext)) {
|
|
|
|
+ char stextt[256];
|
|
|
|
+ char *stc = stextc, *sts = stexts, *stt = stextt;
|
|
|
|
+
|
|
|
|
+ for (char *rt = rawstext; *rt != '\0'; rt++)
|
|
|
|
+ if ((unsigned char)*rt >= ' ')
|
|
|
|
+ *(stc++) = *(sts++) = *(stt++) = *rt;
|
|
|
|
+ else if ((unsigned char)*rt > 10)
|
|
|
|
+ *(stc++) = *rt;
|
|
|
|
+ else
|
|
|
|
+ *(sts++) = *rt;
|
|
|
|
+ *stc = *sts = *stt = '\0';
|
|
|
|
+ wstext = TEXTW(stextt);
|
|
|
|
+ } else {
|
|
|
|
+ strcpy(stextc, "dwm-"VERSION);
|
|
|
|
+ strcpy(stexts, stextc);
|
|
|
|
+ wstext = TEXTW(stextc);
|
|
|
|
+ }
|
|
|
|
+ drawbar(selmon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|