Added possibility to extend number of clickable blocks
This commit is contained in:
parent
5ec0e8ab9c
commit
1e61822f8e
50
blocks.h
50
blocks.h
|
@ -1,32 +1,42 @@
|
|||
#define PATH(name) "/home/ashish/.local/projects/dwmblocks/blocks/"name
|
||||
|
||||
/* If interval of a block is set to 0, the block will only be updated once at startup.
|
||||
* If interval is set to a negative value, the block will never be updated in the main loop.
|
||||
* Set pathc to NULL if clickability is not required for the block.
|
||||
* Set signal to 0 if both clickability and signaling are not required for the block.
|
||||
* Signal must be less than 10 for clickable blocks.
|
||||
* If multiple signals are pending, then the lowest numbered one will be delivered first. */
|
||||
/* At max, DELIMITERENDCHAR - 1 number of clickable blocks will be allowed.
|
||||
* DELIMITERENDCHAR must be less than 32.
|
||||
* Raw characters larger than DELIMITERENDCHAR and smaller than ' ' in ASCII
|
||||
character set can be used for signaling color change in status.
|
||||
* The character corresponding to DELIMITERENDCHAR + 1 ('\x0b' when
|
||||
DELIMITERENDCHAR is 10) will switch the active colorscheme to the first one
|
||||
defined in colors array in dwm and so on.
|
||||
* If you change this, don't forget to update its value in dwm.c and color
|
||||
codes in your pathu programs. */
|
||||
|
||||
/* pathu - path of the program whose output is to be used for status text
|
||||
* output of the program should have a null or newline character at the end
|
||||
* pathc - path of the program to be executed on clicks */
|
||||
#define DELIMITERENDCHAR 10
|
||||
|
||||
/* If interval of a block is set to 0, the block will only be updated once at
|
||||
startup.
|
||||
* If interval is set to a negative value, the block will never be updated in
|
||||
the main loop.
|
||||
* Set pathc to NULL if clickability is not required for the block.
|
||||
* Set signal to 0 if both clickability and signaling are not required for the
|
||||
block.
|
||||
* Signal must be less than DELIMITERENDCHAR for clickable blocks.
|
||||
* If multiple signals are pending, then the lowest numbered one will be
|
||||
delivered first. */
|
||||
|
||||
/* pathu - path of the program whose output is used as status text of the block
|
||||
(output of the program should end in a null or newline character)
|
||||
* pathc - path of the program used for handling clicks on the block */
|
||||
|
||||
/* 1 interval = INTERVALs seconds, INTERVALn nanoseconds */
|
||||
#define INTERVALs 1
|
||||
#define INTERVALn 0
|
||||
|
||||
static Block blocks[] = {
|
||||
/* pathu pathc interval signal */
|
||||
{ PATH("time.sh"), NULL, 30, 10},
|
||||
|
||||
{ PATH("calendar.sh"), NULL, 30, 3},
|
||||
|
||||
{ PATH("volume.sh"), PATH("volume_button.sh"), 0, 1},
|
||||
|
||||
{ PATH("cpu_temp.sh"), PATH("cpu_temp_button.sh"), 1, 4},
|
||||
|
||||
{ PATH("battery.sh"), PATH("battery_button.sh"), 30, 2},
|
||||
|
||||
/* pathu pathc interval signal */
|
||||
{ PATH("calendar.sh"), NULL, 30, 1},
|
||||
{ PATH("volume.sh"), PATH("volume_button.sh"), 0, 2},
|
||||
{ PATH("cpu_temp.sh"), PATH("cpu_temp_button.sh"), 1, 4},
|
||||
{ PATH("battery.sh"), PATH("battery_button.sh"), 30, 3},
|
||||
{ NULL } /* just to mark the end of the array */
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
ICON=""
|
||||
echo "${ICON}$(date '+%H:%M')"
|
|
@ -295,7 +295,7 @@ update1:
|
|||
d = delim;
|
||||
while (*d != '\0')
|
||||
*(s++) = *(d++);
|
||||
*(s++) = '\n'; /* to mark the end of delimiter */
|
||||
*(s++) = DELIMITERENDCHAR;
|
||||
/* skip over empty blocks */
|
||||
} else {
|
||||
*block->cmdoutprv = *block->cmdoutcur;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h
|
||||
--- dwm-6.2-ori/config.def.h 2019-02-02 18:25:28.000000000 +0530
|
||||
+++ dwm-6.2/config.def.h 2020-08-18 03:43:45.933763395 +0530
|
||||
@@ -12,10 +12,34 @@
|
||||
+++ dwm-6.2/config.def.h 2020-12-27 19:52:54.790231420 +0530
|
||||
@@ -12,10 +12,26 @@
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
static const char col_gray4[] = "#eeeeee";
|
||||
static const char col_cyan[] = "#005577";
|
||||
|
@ -11,12 +11,10 @@ diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h
|
|||
+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";
|
||||
+
|
||||
+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 },
|
||||
|
@ -28,17 +26,11 @@ diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h
|
|||
+ [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 */
|
||||
@@ -103,7 +127,9 @@
|
||||
@@ -103,7 +119,9 @@
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
|
@ -51,7 +43,7 @@ diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h
|
|||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||
diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
||||
--- dwm-6.2-ori/dwm.c 2019-02-02 18:25:28.000000000 +0530
|
||||
+++ dwm-6.2/dwm.c 2020-12-05 03:57:52.643158573 +0530
|
||||
+++ dwm-6.2/dwm.c 2020-12-27 19:55:32.771263008 +0530
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#endif /* XINERAMA */
|
||||
|
@ -60,7 +52,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
|
||||
#include "drw.h"
|
||||
#include "util.h"
|
||||
@@ -56,10 +57,16 @@
|
||||
@@ -56,10 +57,14 @@
|
||||
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
|
||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||
|
@ -68,18 +60,16 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+
|
||||
+#define STATUSLENGTH 256
|
||||
+#define DWMBLOCKSLOCKFILE "/tmp/dwmblocks.pid"
|
||||
+#define DELIMITERENDCHAR 10
|
||||
|
||||
/* 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,
|
||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||
@@ -205,6 +212,7 @@
|
||||
@@ -205,6 +210,7 @@
|
||||
static void seturgent(Client *c, int urg);
|
||||
static void showhide(Client *c);
|
||||
static void sigchld(int unused);
|
||||
|
@ -87,7 +77,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
static void spawn(const Arg *arg);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
@@ -219,6 +227,7 @@
|
||||
@@ -219,6 +225,7 @@
|
||||
static void updatebarpos(Monitor *m);
|
||||
static void updatebars(void);
|
||||
static void updateclientlist(void);
|
||||
|
@ -95,7 +85,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
static int updategeom(void);
|
||||
static void updatenumlockmask(void);
|
||||
static void updatesizehints(Client *c);
|
||||
@@ -236,12 +245,16 @@
|
||||
@@ -236,12 +243,16 @@
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
|
@ -114,12 +104,12 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
static unsigned int numlockmask = 0;
|
||||
static void (*handler[LASTEvent]) (XEvent *) = {
|
||||
[ButtonPress] = buttonpress,
|
||||
@@ -416,13 +429,13 @@
|
||||
@@ -416,13 +427,13 @@
|
||||
void
|
||||
buttonpress(XEvent *e)
|
||||
{
|
||||
- unsigned int i, x, click;
|
||||
+ int i, x;
|
||||
+ int i, x;
|
||||
+ unsigned int click;
|
||||
Arg arg = {0};
|
||||
Client *c;
|
||||
|
@ -130,7 +120,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
/* focus monitor if necessary */
|
||||
if ((m = wintomon(ev->window)) && m != selmon) {
|
||||
unfocus(selmon->sel, 1);
|
||||
@@ -430,25 +443,30 @@
|
||||
@@ -430,25 +441,30 @@
|
||||
focus(NULL);
|
||||
}
|
||||
if (ev->window == selmon->barwin) {
|
||||
|
@ -162,7 +152,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+ else if ((x = selmon->ww - lrpad / 2 - ev->x) > 0 && (x -= wstext - lrpad) <= 0) {
|
||||
+ updatedwmblockssig(x);
|
||||
+ click = ClkStatusText;
|
||||
+ } else
|
||||
+ } else
|
||||
+ return;
|
||||
} else if ((c = wintoclient(ev->window))) {
|
||||
focus(c);
|
||||
|
@ -175,7 +165,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
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))
|
||||
@@ -695,7 +713,7 @@
|
||||
@@ -695,7 +711,7 @@
|
||||
void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
|
@ -184,7 +174,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
int boxs = drw->fonts->h / 9;
|
||||
int boxw = drw->fonts->h / 6 + 2;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
@@ -703,9 +721,30 @@
|
||||
@@ -703,9 +719,30 @@
|
||||
|
||||
/* draw status first so it can be overdrawn by tags later */
|
||||
if (m == selmon) { /* status is only drawn on selected monitor */
|
||||
|
@ -199,7 +189,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+ x = m->ww - wstext;
|
||||
+ drw_rect(drw, x, 0, lrpad / 2, bh, 1, 1); x += lrpad / 2; /* to keep left padding clean */
|
||||
+ for (;;) {
|
||||
+ if ((unsigned char)*ts > LENGTH(colors) + 10) {
|
||||
+ if ((unsigned char)*ts > LENGTH(colors) + DELIMITERENDCHAR) {
|
||||
+ ts++;
|
||||
+ continue;
|
||||
+ }
|
||||
|
@ -209,7 +199,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+ x = drw_text(drw, x, 0, TTEXTW(tp), bh, 0, tp, 0);
|
||||
+ if (ctmp == '\0')
|
||||
+ break;
|
||||
+ drw_setscheme(drw, scheme[ctmp - 11]);
|
||||
+ drw_setscheme(drw, scheme[ctmp - DELIMITERENDCHAR - 1]);
|
||||
+ *ts = ctmp;
|
||||
+ tp = ++ts;
|
||||
+ }
|
||||
|
@ -218,7 +208,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
}
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
@@ -724,11 +763,17 @@
|
||||
@@ -724,11 +761,17 @@
|
||||
urg & 1 << i);
|
||||
x += w;
|
||||
}
|
||||
|
@ -238,7 +228,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
if (m->sel) {
|
||||
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||
@@ -1122,14 +1167,24 @@
|
||||
@@ -1122,14 +1165,24 @@
|
||||
Monitor *m;
|
||||
XMotionEvent *ev = &e->xmotion;
|
||||
|
||||
|
@ -271,7 +261,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
}
|
||||
|
||||
void
|
||||
@@ -1564,6 +1619,7 @@
|
||||
@@ -1564,6 +1617,7 @@
|
||||
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
|
||||
/* init cursors */
|
||||
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
|
||||
|
@ -279,7 +269,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
||||
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
|
||||
/* init appearance */
|
||||
@@ -1637,6 +1693,28 @@
|
||||
@@ -1637,6 +1691,28 @@
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -287,11 +277,11 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+{
|
||||
+ int fd;
|
||||
+ struct flock fl;
|
||||
+ union sigval sv;
|
||||
+ union sigval sv;
|
||||
+
|
||||
+ if (!dwmblockssig)
|
||||
+ return;
|
||||
+ sv.sival_int = (dwmblockssig << 8) | arg->i;
|
||||
+ sv.sival_int = (dwmblockssig << 8) | arg->i;
|
||||
+ fd = open(DWMBLOCKSLOCKFILE, O_RDONLY);
|
||||
+ if (fd == -1)
|
||||
+ return;
|
||||
|
@ -308,7 +298,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
spawn(const Arg *arg)
|
||||
{
|
||||
if (arg->v == dmenucmd)
|
||||
@@ -1805,7 +1883,7 @@
|
||||
@@ -1805,7 +1881,7 @@
|
||||
XSetWindowAttributes wa = {
|
||||
.override_redirect = True,
|
||||
.background_pixmap = ParentRelative,
|
||||
|
@ -317,7 +307,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
};
|
||||
XClassHint ch = {"dwm", "dwm"};
|
||||
for (m = mons; m; m = m->next) {
|
||||
@@ -1847,6 +1925,42 @@
|
||||
@@ -1847,6 +1923,42 @@
|
||||
(unsigned char *) &(c->win), 1);
|
||||
}
|
||||
|
||||
|
@ -329,7 +319,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+ char ctmp;
|
||||
+
|
||||
+ while (*ts != '\0') {
|
||||
+ if ((unsigned char)*ts > 10) {
|
||||
+ if ((unsigned char)*ts > DELIMITERENDCHAR) {
|
||||
+ ts++;
|
||||
+ continue;
|
||||
+ }
|
||||
|
@ -338,7 +328,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+ x += TTEXTW(tp);
|
||||
+ *ts = ctmp;
|
||||
+ if (x >= 0) {
|
||||
+ if (ctmp == 10)
|
||||
+ if (ctmp == DELIMITERENDCHAR)
|
||||
+ goto cursorondelim;
|
||||
+ if (!statushandcursor) {
|
||||
+ statushandcursor = 1;
|
||||
|
@ -360,7 +350,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
int
|
||||
updategeom(void)
|
||||
{
|
||||
@@ -1987,9 +2101,27 @@
|
||||
@@ -1987,9 +2099,27 @@
|
||||
void
|
||||
updatestatus(void)
|
||||
{
|
||||
|
@ -376,7 +366,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+ for (char *rst = rawstext; *rst != '\0'; rst++)
|
||||
+ if ((unsigned char)*rst >= ' ')
|
||||
+ *(stp++) = *(stc++) = *(sts++) = *rst;
|
||||
+ else if ((unsigned char)*rst > 10)
|
||||
+ else if ((unsigned char)*rst > DELIMITERENDCHAR)
|
||||
+ *(stc++) = *rst;
|
||||
+ else
|
||||
+ *(sts++) = *rst;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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 @@
|
||||
+++ dwm-6.2/config.def.h 2020-12-27 20:01:15.106831834 +0530
|
||||
@@ -16,10 +16,26 @@
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
static const char col_gray4[] = "#eeeeee";
|
||||
static const char col_cyan[] = "#005577";
|
||||
|
@ -11,12 +11,10 @@ diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h
|
|||
+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";
|
||||
+
|
||||
+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 },
|
||||
|
@ -28,17 +26,11 @@ diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h
|
|||
+ [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 @@
|
||||
@@ -107,7 +123,9 @@
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
|
@ -51,7 +43,7 @@ diff -ruN dwm-6.2-ori/config.def.h dwm-6.2/config.def.h
|
|||
{ 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
|
||||
+++ dwm-6.2/dwm.c 2020-12-05 04:02:31.417493808 +0530
|
||||
+++ dwm-6.2/dwm.c 2020-12-27 20:04:13.757998389 +0530
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#endif /* XINERAMA */
|
||||
|
@ -60,7 +52,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
|
||||
#include "drw.h"
|
||||
#include "util.h"
|
||||
@@ -56,6 +57,10 @@
|
||||
@@ -56,6 +57,11 @@
|
||||
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
|
||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||
|
@ -68,23 +60,21 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+
|
||||
+#define STATUSLENGTH 256
|
||||
+#define DWMBLOCKSLOCKFILE "/tmp/dwmblocks.pid"
|
||||
+#define DELIMITERENDCHAR 10
|
||||
|
||||
#define SYSTEM_TRAY_REQUEST_DOCK 0
|
||||
|
||||
@@ -74,8 +79,10 @@
|
||||
@@ -74,8 +80,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 { 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 +241,7 @@
|
||||
@@ -234,6 +239,7 @@
|
||||
static void seturgent(Client *c, int urg);
|
||||
static void showhide(Client *c);
|
||||
static void sigchld(int unused);
|
||||
|
@ -92,7 +82,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
static void spawn(const Arg *arg);
|
||||
static Monitor *systraytomon(Monitor *m);
|
||||
static void tag(const Arg *arg);
|
||||
@@ -249,6 +257,7 @@
|
||||
@@ -249,6 +255,7 @@
|
||||
static void updatebarpos(Monitor *m);
|
||||
static void updatebars(void);
|
||||
static void updateclientlist(void);
|
||||
|
@ -100,7 +90,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
static int updategeom(void);
|
||||
static void updatenumlockmask(void);
|
||||
static void updatesizehints(Client *c);
|
||||
@@ -269,14 +278,17 @@
|
||||
@@ -269,14 +276,17 @@
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
|
@ -123,7 +113,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
static unsigned int numlockmask = 0;
|
||||
static void (*handler[LASTEvent]) (XEvent *) = {
|
||||
[ButtonPress] = buttonpress,
|
||||
@@ -303,6 +315,7 @@
|
||||
@@ -303,6 +313,7 @@
|
||||
static Drw *drw;
|
||||
static Monitor *mons, *selmon;
|
||||
static Window root, wmcheckwin;
|
||||
|
@ -131,12 +121,12 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
|
||||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
@@ -452,13 +465,13 @@
|
||||
@@ -452,13 +463,13 @@
|
||||
void
|
||||
buttonpress(XEvent *e)
|
||||
{
|
||||
- unsigned int i, x, click;
|
||||
+ int i, x;
|
||||
+ int i, x;
|
||||
+ unsigned int click;
|
||||
Arg arg = {0};
|
||||
Client *c;
|
||||
|
@ -147,7 +137,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
/* focus monitor if necessary */
|
||||
if ((m = wintomon(ev->window)) && m != selmon) {
|
||||
unfocus(selmon->sel, 1);
|
||||
@@ -466,25 +479,34 @@
|
||||
@@ -466,25 +477,34 @@
|
||||
focus(NULL);
|
||||
}
|
||||
if (ev->window == selmon->barwin) {
|
||||
|
@ -196,7 +186,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
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 +811,44 @@
|
||||
@@ -789,23 +809,44 @@
|
||||
void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
|
@ -226,7 +216,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+ x = wbar - wstext;
|
||||
+ drw_rect(drw, x, 0, lrpad / 2, bh, 1, 1); x += lrpad / 2; /* to keep left padding clean */
|
||||
+ for (;;) {
|
||||
+ if ((unsigned char)*ts > LENGTH(colors) + 10) {
|
||||
+ if ((unsigned char)*ts > LENGTH(colors) + DELIMITERENDCHAR) {
|
||||
+ ts++;
|
||||
+ continue;
|
||||
+ }
|
||||
|
@ -236,7 +226,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+ x = drw_text(drw, x, 0, TTEXTW(tp), bh, 0, tp, 0);
|
||||
+ if (ctmp == '\0')
|
||||
+ break;
|
||||
+ drw_setscheme(drw, scheme[ctmp - 11]);
|
||||
+ drw_setscheme(drw, scheme[ctmp - DELIMITERENDCHAR - 1]);
|
||||
+ *ts = ctmp;
|
||||
+ tp = ++ts;
|
||||
+ }
|
||||
|
@ -248,7 +238,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
for (c = m->clients; c; c = c->next) {
|
||||
occ |= c->tags;
|
||||
if (c->isurgent)
|
||||
@@ -822,11 +865,17 @@
|
||||
@@ -822,11 +863,17 @@
|
||||
urg & 1 << i);
|
||||
x += w;
|
||||
}
|
||||
|
@ -268,7 +258,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
if (m->sel) {
|
||||
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||
@@ -837,7 +886,9 @@
|
||||
@@ -837,7 +884,9 @@
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
}
|
||||
}
|
||||
|
@ -279,7 +269,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
}
|
||||
|
||||
void
|
||||
@@ -1246,14 +1297,25 @@
|
||||
@@ -1246,14 +1295,25 @@
|
||||
Monitor *m;
|
||||
XMotionEvent *ev = &e->xmotion;
|
||||
|
||||
|
@ -313,7 +303,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
}
|
||||
|
||||
void
|
||||
@@ -1750,6 +1812,7 @@
|
||||
@@ -1750,6 +1810,7 @@
|
||||
xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
|
||||
/* init cursors */
|
||||
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
|
||||
|
@ -321,7 +311,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
||||
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
|
||||
/* init appearance */
|
||||
@@ -1825,6 +1888,28 @@
|
||||
@@ -1825,6 +1886,28 @@
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -329,11 +319,11 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+{
|
||||
+ int fd;
|
||||
+ struct flock fl;
|
||||
+ union sigval sv;
|
||||
+ union sigval sv;
|
||||
+
|
||||
+ if (!dwmblockssig)
|
||||
+ return;
|
||||
+ sv.sival_int = (dwmblockssig << 8) | arg->i;
|
||||
+ sv.sival_int = (dwmblockssig << 8) | arg->i;
|
||||
+ fd = open(DWMBLOCKSLOCKFILE, O_RDONLY);
|
||||
+ if (fd == -1)
|
||||
+ return;
|
||||
|
@ -350,7 +340,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
spawn(const Arg *arg)
|
||||
{
|
||||
if (arg->v == dmenucmd)
|
||||
@@ -2011,7 +2096,7 @@
|
||||
@@ -2011,7 +2094,7 @@
|
||||
XSetWindowAttributes wa = {
|
||||
.override_redirect = True,
|
||||
.background_pixmap = ParentRelative,
|
||||
|
@ -359,7 +349,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
};
|
||||
XClassHint ch = {"dwm", "dwm"};
|
||||
for (m = mons; m; m = m->next) {
|
||||
@@ -2058,6 +2143,42 @@
|
||||
@@ -2058,6 +2141,42 @@
|
||||
(unsigned char *) &(c->win), 1);
|
||||
}
|
||||
|
||||
|
@ -371,7 +361,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+ char ctmp;
|
||||
+
|
||||
+ while (*ts != '\0') {
|
||||
+ if ((unsigned char)*ts > 10) {
|
||||
+ if ((unsigned char)*ts > DELIMITERENDCHAR) {
|
||||
+ ts++;
|
||||
+ continue;
|
||||
+ }
|
||||
|
@ -380,7 +370,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+ x += TTEXTW(tp);
|
||||
+ *ts = ctmp;
|
||||
+ if (x >= 0) {
|
||||
+ if (ctmp == 10)
|
||||
+ if (ctmp == DELIMITERENDCHAR)
|
||||
+ goto cursorondelim;
|
||||
+ if (!statushandcursor) {
|
||||
+ statushandcursor = 1;
|
||||
|
@ -402,7 +392,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
int
|
||||
updategeom(void)
|
||||
{
|
||||
@@ -2198,10 +2319,27 @@
|
||||
@@ -2198,10 +2317,27 @@
|
||||
void
|
||||
updatestatus(void)
|
||||
{
|
||||
|
@ -419,7 +409,7 @@ diff -ruN dwm-6.2-ori/dwm.c dwm-6.2/dwm.c
|
|||
+ for (char *rst = rawstext; *rst != '\0'; rst++)
|
||||
+ if ((unsigned char)*rst >= ' ')
|
||||
+ *(stp++) = *(stc++) = *(sts++) = *rst;
|
||||
+ else if ((unsigned char)*rst > 10)
|
||||
+ else if ((unsigned char)*rst > DELIMITERENDCHAR)
|
||||
+ *(stc++) = *rst;
|
||||
+ else
|
||||
+ *(sts++) = *rst;
|
||||
|
|
Loading…
Reference in a new issue