mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 12:05:45 +00:00
Adding ewmhtags patch
This commit is contained in:
parent
706e06be43
commit
9e17c55d95
@ -13,7 +13,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
|
||||
### Changelog:
|
||||
|
||||
2019-09-11 - Added monitor rules and combo patches
|
||||
2019-09-11 - Added monitor rules, combo and ewmhtags patches
|
||||
|
||||
2019-09-10 - Minor tweaks to awesomebar patch (incl. alpha and systray compatibility). Added floatbordercolor patch.
|
||||
|
||||
@ -65,6 +65,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
- [cyclelayouts](https://dwm.suckless.org/patches/cyclelayouts/)
|
||||
- lets you cycle through all your layouts
|
||||
|
||||
- [ewmhtags](https://dwm.suckless.org/patches/ewmhtags/)
|
||||
- adds EWMH support for \_NET_NUMBER_OF_DESKTOPS, \_NET_CURRENT_DESKTOP, \_NET_DESKTOP_NAMES and \_NET_DESKTOP_VIEWPORT, which allows for compatibility with other bars and programs that request workspace information, e.g. polybar's xworkspaces module
|
||||
|
||||
- [fancybar](https://dwm.suckless.org/patches/fancybar/)
|
||||
- shows the titles of all visible windows in the status bar
|
||||
|
||||
|
@ -62,7 +62,11 @@ static const char *colors[][3] = {
|
||||
#endif // FLOAT_BORDER_COLOR_PATCH
|
||||
|
||||
/* tagging */
|
||||
#if EWMHTAGS_PATCH
|
||||
static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
#else
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
#endif // EWMHTAGS_PATCH
|
||||
#if ALTERNATIVE_TAGS_PATCH
|
||||
static const char *tagsalt[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
#endif // ALTERNATIVE_TAGS_PATCH
|
||||
|
36
dwm.c
36
dwm.c
@ -73,15 +73,18 @@ enum { SchemeNorm, SchemeSel, SchemeHid }; /* color schemes */
|
||||
#else
|
||||
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||
#endif // #if AWESOMEBAR_PATCH
|
||||
#if SYSTRAY_PATCH
|
||||
enum { NetSupported, NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayVisual,
|
||||
NetWMName, NetWMState, NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMWindowTypeDock,
|
||||
NetSystemTrayOrientationHorz, NetWMWindowTypeDialog, NetClientList, NetWMCheck, NetLast }; /* EWMH atoms */
|
||||
#else
|
||||
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||
#if SYSTRAY_PATCH
|
||||
NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation,
|
||||
NetSystemTrayVisual, NetWMWindowTypeDock, NetSystemTrayOrientationHorz,
|
||||
#endif // SYSTRAY_PATCH
|
||||
#if EWMHTAGS_PATCH
|
||||
NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop,
|
||||
#endif // EWMHTAGS_PATCH
|
||||
NetWMWindowTypeDialog, NetClientList, NetLast
|
||||
}; /* EWMH atoms */
|
||||
|
||||
#if WINDOWROLERULE_PATCH
|
||||
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMWindowRole, WMLast }; /* default atoms */
|
||||
#else
|
||||
@ -2220,6 +2223,12 @@ setup(void)
|
||||
xatom[Xembed] = XInternAtom(dpy, "_XEMBED", False);
|
||||
xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
|
||||
#endif // SYSTRAY_PATCH
|
||||
#if EWMHTAGS_PATCH
|
||||
netatom[NetDesktopViewport] = XInternAtom(dpy, "_NET_DESKTOP_VIEWPORT", False);
|
||||
netatom[NetNumberOfDesktops] = XInternAtom(dpy, "_NET_NUMBER_OF_DESKTOPS", False);
|
||||
netatom[NetCurrentDesktop] = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False);
|
||||
netatom[NetDesktopNames] = XInternAtom(dpy, "_NET_DESKTOP_NAMES", False);
|
||||
#endif // EWMHTAGS_PATCH
|
||||
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
|
||||
netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
|
||||
netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
|
||||
@ -2263,6 +2272,12 @@ setup(void)
|
||||
/* EWMH support per view */
|
||||
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char *) netatom, NetLast);
|
||||
#if EWMHTAGS_PATCH
|
||||
setnumdesktops();
|
||||
setcurrentdesktop();
|
||||
setdesktopnames();
|
||||
setviewport();
|
||||
#endif // EWMHTAGS_PATCH
|
||||
XDeleteProperty(dpy, root, netatom[NetClientList]);
|
||||
/* select events */
|
||||
wa.cursor = cursor[CurNormal]->cursor;
|
||||
@ -2445,6 +2460,9 @@ toggletag(const Arg *arg)
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
#if EWMHTAGS_PATCH
|
||||
updatecurrentdesktop();
|
||||
#endif // EWMHTAGS_PATCH
|
||||
}
|
||||
|
||||
void
|
||||
@ -2484,6 +2502,9 @@ toggleview(const Arg *arg)
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
#if EWMHTAGS_PATCH
|
||||
updatecurrentdesktop();
|
||||
#endif // EWMHTAGS_PATCH
|
||||
}
|
||||
|
||||
void
|
||||
@ -2858,6 +2879,9 @@ view(const Arg *arg)
|
||||
#endif // PERTAG_PATCH
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
#if EWMHTAGS_PATCH
|
||||
updatecurrentdesktop();
|
||||
#endif // EWMHTAGS_PATCH
|
||||
}
|
||||
|
||||
Client *
|
||||
|
40
patch/ewmhtags.c
Normal file
40
patch/ewmhtags.c
Normal 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
7
patch/ewmhtags.h
Normal 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);
|
@ -32,6 +32,10 @@
|
||||
#include "cyclelayouts.c"
|
||||
#endif
|
||||
|
||||
#if EWMHTAGS_PATCH
|
||||
#include "ewmhtags.c"
|
||||
#endif
|
||||
|
||||
#if PERTAG_PATCH
|
||||
#include "pertag.c"
|
||||
#endif
|
||||
|
@ -32,6 +32,10 @@
|
||||
#include "cyclelayouts.h"
|
||||
#endif
|
||||
|
||||
#if EWMHTAGS_PATCH
|
||||
#include "ewmhtags.h"
|
||||
#endif
|
||||
|
||||
#if ROTATESTACK_PATCH
|
||||
#include "rotatestack.h"
|
||||
#endif
|
||||
|
@ -85,6 +85,13 @@
|
||||
*/
|
||||
#define CYCLELAYOUTS_PATCH 0
|
||||
|
||||
/* Adds EWMH support for _NET_NUMBER_OF_DESKTOPS, _NET_CURRENT_DESKTOP, _NET_DESKTOP_NAMES
|
||||
* and _NET_DESKTOP_VIEWPORT, which allows for compatibility with other bars and programs
|
||||
* that request workspace information. For example polybar's xworkspaces module.
|
||||
* https://dwm.suckless.org/patches/ewmhtags/
|
||||
*/
|
||||
#define EWMHTAGS_PATCH 0
|
||||
|
||||
/* This patch shows the titles of all visible windows in the status bar
|
||||
* (as opposed to showing only the selected one).
|
||||
* Awesomebar takes precedence over fancybar.
|
||||
|
Loading…
x
Reference in New Issue
Block a user