Adding ewmhtags patch

This commit is contained in:
bakkeby
2019-09-12 00:48:29 +02:00
parent 706e06be43
commit 9e17c55d95
8 changed files with 101 additions and 8 deletions

40
patch/ewmhtags.c Normal file
View File

@ -0,0 +1,40 @@
void
setcurrentdesktop(void)
{
long data[] = { 0 };
XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
}
void
setdesktopnames(void)
{
XTextProperty text;
Xutf8TextListToTextProperty(dpy, tags, TAGSLENGTH, XUTF8StringStyle, &text);
XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]);
}
void
setnumdesktops(void)
{
long data[] = { TAGSLENGTH };
XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
}
void
setviewport(void)
{
long data[] = { 0, 0 };
XChangeProperty(dpy, root, netatom[NetDesktopViewport], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 2);
}
void
updatecurrentdesktop(void)
{
long rawdata[] = { selmon->tagset[selmon->seltags] };
int i = 0;
while (*rawdata >> (i + 1)) {
i++;
}
long data[] = { i };
XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
}

7
patch/ewmhtags.h Normal file
View File

@ -0,0 +1,7 @@
#define TAGSLENGTH (LENGTH(tags))
static void setcurrentdesktop(void);
static void setdesktopnames(void);
static void setnumdesktops(void);
static void setviewport(void);
static void updatecurrentdesktop(void);

View File

@ -32,6 +32,10 @@
#include "cyclelayouts.c"
#endif
#if EWMHTAGS_PATCH
#include "ewmhtags.c"
#endif
#if PERTAG_PATCH
#include "pertag.c"
#endif

View File

@ -32,6 +32,10 @@
#include "cyclelayouts.h"
#endif
#if EWMHTAGS_PATCH
#include "ewmhtags.h"
#endif
#if ROTATESTACK_PATCH
#include "rotatestack.h"
#endif