mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 12:05:45 +00:00
Adding dwmblocks patch
This commit is contained in:
parent
5c1e09688f
commit
f028377c98
@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
|
||||
### Changelog:
|
||||
|
||||
2020-05-02 - Added dwmblocks patch
|
||||
|
||||
2020-04-27 - Upgraded the tagmonfixfs patch to better support moving fullscreen windows to adjacent monitors
|
||||
|
||||
2020-04-26 - Expanded monitor rules patch to include nmaster, showbar and topbar options
|
||||
@ -169,6 +171,10 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
- lets you resize the split in layouts (i.e. modify mfact) by holding the modkey + shift + left-click and dragging the mouse
|
||||
- this is a bespoke patch that supports vertical and horizontal layout splits as well as centered master variants
|
||||
|
||||
- [dwmblocks](https://gist.github.com/danbyl/54f7c1d57fc6507242a95b71c3d8fdea)
|
||||
- signal integration to use dwm with a patched [dwmblocks](https://github.com/torrinfail/dwmblocks)
|
||||
- combined with the statuscmd patch this gives a clickable statusbar
|
||||
|
||||
- [dwmc](http://dwm.suckless.org/patches/dwmc/)
|
||||
- a simple dwmc client using a fork of fsignal to communicate with dwm
|
||||
|
||||
|
@ -977,7 +977,11 @@ static Button buttons[] = {
|
||||
{ ClkWinTitle, 0, Button3, showhideclient, {0} },
|
||||
#endif // AWESOMEBAR_PATCH
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
#if STATUSCMD_PATCH
|
||||
#if STATUSCMD_PATCH && DWMBLOCKS_PATCH
|
||||
{ ClkStatusText, 0, Button1, sigdwmblocks, {.i = 1 } },
|
||||
{ ClkStatusText, 0, Button2, sigdwmblocks, {.i = 2 } },
|
||||
{ ClkStatusText, 0, Button3, sigdwmblocks, {.i = 3 } },
|
||||
#elif STATUSCMD_PATCH
|
||||
{ ClkStatusText, 0, Button1, spawn, {.v = statuscmd } },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = statuscmd } },
|
||||
{ ClkStatusText, 0, Button3, spawn, {.v = statuscmd } },
|
||||
|
16
dwm.c
16
dwm.c
@ -797,7 +797,11 @@ buttonpress(XEvent *e)
|
||||
char *text = rawstext;
|
||||
int i = -1;
|
||||
char ch;
|
||||
#if DWMBLOCKS_PATCH
|
||||
dwmblockssig = 0;
|
||||
#else
|
||||
statuscmdn = 0;
|
||||
#endif // DWMBLOCKS_PATCH
|
||||
while (text[++i]) {
|
||||
if ((unsigned char)text[i] < ' ') {
|
||||
ch = text[i];
|
||||
@ -808,8 +812,12 @@ buttonpress(XEvent *e)
|
||||
i = -1;
|
||||
if (xc >= ev->x)
|
||||
break;
|
||||
#if DWMBLOCKS_PATCH
|
||||
dwmblockssig = ch;
|
||||
#else
|
||||
if (ch <= LENGTH(statuscmds))
|
||||
statuscmdn = ch - 1;
|
||||
#endif // DWMBLOCKS_PATCH
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -886,7 +894,11 @@ buttonpress(XEvent *e)
|
||||
char *text = rawstext;
|
||||
int i = -1;
|
||||
char ch;
|
||||
#if DWMBLOCKS_PATCH
|
||||
dwmblockssig = 0;
|
||||
#else
|
||||
statuscmdn = 0;
|
||||
#endif // DWMBLOCKS_PATCH
|
||||
while (text[++i]) {
|
||||
if ((unsigned char)text[i] < ' ') {
|
||||
ch = text[i];
|
||||
@ -897,8 +909,12 @@ buttonpress(XEvent *e)
|
||||
i = -1;
|
||||
if (xc >= ev->x)
|
||||
break;
|
||||
#if DWMBLOCKS_PATCH
|
||||
dwmblockssig = ch;
|
||||
#else
|
||||
if (ch <= LENGTH(statuscmds))
|
||||
statuscmdn = ch - 1;
|
||||
#endif // DWMBLOCKS_PATCH
|
||||
}
|
||||
}
|
||||
}
|
||||
|
31
patch/dwmblocks.c
Normal file
31
patch/dwmblocks.c
Normal file
@ -0,0 +1,31 @@
|
||||
static int dwmblockssig;
|
||||
pid_t dwmblockspid = 0;
|
||||
|
||||
int
|
||||
getdwmblockspid()
|
||||
{
|
||||
char buf[16];
|
||||
FILE *fp = popen("pidof -s dwmblocks", "r");
|
||||
if (fgets(buf, sizeof(buf), fp));
|
||||
pid_t pid = strtoul(buf, NULL, 10);
|
||||
pclose(fp);
|
||||
dwmblockspid = pid;
|
||||
return pid != 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
void
|
||||
sigdwmblocks(const Arg *arg)
|
||||
{
|
||||
union sigval sv;
|
||||
sv.sival_int = (dwmblockssig << 8) | arg->i;
|
||||
if (!dwmblockspid)
|
||||
if (getdwmblockspid() == -1)
|
||||
return;
|
||||
|
||||
if (sigqueue(dwmblockspid, SIGUSR1, sv) == -1) {
|
||||
if (errno == ESRCH) {
|
||||
if (!getdwmblockspid())
|
||||
sigqueue(dwmblockspid, SIGUSR1, sv);
|
||||
}
|
||||
}
|
||||
}
|
2
patch/dwmblocks.h
Normal file
2
patch/dwmblocks.h
Normal file
@ -0,0 +1,2 @@
|
||||
static int getdwmblockspid();
|
||||
static void sigdwmblocks(const Arg *arg);
|
@ -29,6 +29,9 @@
|
||||
#if DRAGCFACT_PATCH && CFACTS_PATCH
|
||||
#include "dragcfact.c"
|
||||
#endif
|
||||
#if DWMBLOCKS_PATCH && STATUSCMD_PATCH
|
||||
#include "dwmblocks.c"
|
||||
#endif
|
||||
#if DWMC_PATCH
|
||||
#include "dwmc.c"
|
||||
#elif FSIGNAL_PATCH
|
||||
|
@ -32,6 +32,9 @@
|
||||
#if DRAGMFACT_PATCH
|
||||
#include "dragmfact.h"
|
||||
#endif
|
||||
#if DWMBLOCKS_PATCH && STATUSCMD_PATCH
|
||||
#include "dwmblocks.h"
|
||||
#endif
|
||||
#if DWMC_PATCH
|
||||
#include "dwmc.h"
|
||||
#elif FSIGNAL_PATCH
|
||||
|
@ -140,6 +140,13 @@
|
||||
*/
|
||||
#define DRAGMFACT_PATCH 0
|
||||
|
||||
/* This patch depends on statuscmd patch and adds integration with a (patched) dwmblocks
|
||||
* instance to give a clickable status bar.
|
||||
* Patch: https://gist.github.com/danbyl/54f7c1d57fc6507242a95b71c3d8fdea
|
||||
* dwmblocks: https://github.com/torrinfail/dwmblocks
|
||||
*/
|
||||
#define DWMBLOCKS_PATCH 0
|
||||
|
||||
/* Simple dwmc client using a fork of fsignal to communicate with dwm.
|
||||
* To use this either copy the patch/dwmc shell script to somewhere in your path or
|
||||
* uncomment the following line in Makefile:
|
||||
|
Loading…
x
Reference in New Issue
Block a user