Re: [hackers] [dwm][PATCH] dwm-ewhmtags-6.2

From: Abdullah <abdullah_AT_abdullah.today>
Date: Fri, 29 Mar 2019 22:38:46 +0500

this one is already submitted. maybe you changed somthing. does this
work now? I used it and I couldn't click on tag numbers in polybar.
btw appreciate your efforts.



On 29/03, Ryan Kes wrote:
> ---
> dwm.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 48 insertions(+), 1 deletion(-)
>
> diff --git a/dwm.c b/dwm.c
> index 4465af1..92022a1 100644
> --- a/dwm.c
> +++ b/dwm.c
> _AT_@ -55,6 +55,7 @@
> #define WIDTH(X) ((X)->w + 2 * (X)->bw)
> #define HEIGHT(X) ((X)->h + 2 * (X)->bw)
> #define TAGMASK ((1 << LENGTH(tags)) - 1)
> +#define TAGSLENGTH (LENGTH(tags))
> #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
>
> /* enums */
> _AT_@ -62,7 +63,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
> enum { SchemeNorm, SchemeSel }; /* color schemes */
> enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
> NetWMFullscreen, NetActiveWindow, NetWMWindowType,
> - NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
> + NetWMWindowTypeDialog, NetClientList, NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH atoms */
> enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
> enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
> ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
> _AT_@ -197,11 +198,15 @@ static void scan(void);
> static int sendevent(Client *c, Atom proto);
> static void sendmon(Client *c, Monitor *m);
> static void setclientstate(Client *c, long state);
> +static void setcurrentdesktop(void);
> +static void setdesktopnames(void);
> static void setfocus(Client *c);
> static void setfullscreen(Client *c, int fullscreen);
> static void setlayout(const Arg *arg);
> static void setmfact(const Arg *arg);
> +static void setnumdesktops(void);
> static void setup(void);
> +static void setviewport(void);
> static void seturgent(Client *c, int urg);
> static void showhide(Client *c);
> static void sigchld(int unused);
> _AT_@ -216,6 +221,7 @@ static void toggleview(const Arg *arg);
> static void unfocus(Client *c, int setfocus);
> static void unmanage(Client *c, int destroyed);
> static void unmapnotify(XEvent *e);
> +static void updatecurrentdesktop(void);
> static void updatebarpos(Monitor *m);
> static void updatebars(void);
> static void updateclientlist(void);
> _AT_@ -1431,6 +1437,16 @@ setclientstate(Client *c, long state)
> XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32,
> PropModeReplace, (unsigned char *)data, 2);
> }
> +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]);
> +}
>
> int
> sendevent(Client *c, Atom proto)
> _AT_@ -1457,6 +1473,12 @@ sendevent(Client *c, Atom proto)
> return exists;
> }
>
> +void
> +setnumdesktops(void){
> + long data[] = { TAGSLENGTH };
> + XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
> +}
> +
> void
> setfocus(Client *c)
> {
> _AT_@ -1562,6 +1584,10 @@ setup(void)
> netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
> netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
> netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
> + 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);
> /* init cursors */
> cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
> cursor[CurResize] = drw_cur_create(drw, XC_sizing);
> _AT_@ -1584,6 +1610,10 @@ setup(void)
> /* EWMH support per view */
> XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
> PropModeReplace, (unsigned char *) netatom, NetLast);
> + setnumdesktops();
> + setcurrentdesktop();
> + setdesktopnames();
> + setviewport();
> XDeleteProperty(dpy, root, netatom[NetClientList]);
> /* select events */
> wa.cursor = cursor[CurNormal]->cursor;
> _AT_@ -1595,6 +1625,11 @@ setup(void)
> grabkeys();
> focus(NULL);
> }
> +void
> +setviewport(void){
> + long data[] = { 0, 0 };
> + XChangeProperty(dpy, root, netatom[NetDesktopViewport], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 2);
> +}
>
>
> void
> _AT_@ -1732,6 +1767,7 @@ toggletag(const Arg *arg)
> focus(NULL);
> arrange(selmon);
> }
> + updatecurrentdesktop();
> }
>
> void
> _AT_@ -1744,6 +1780,7 @@ toggleview(const Arg *arg)
> focus(NULL);
> arrange(selmon);
> }
> + updatecurrentdesktop();
> }
>
> void
> _AT_@ -1846,6 +1883,15 @@ updateclientlist()
> XA_WINDOW, 32, PropModeAppend,
> (unsigned char *) &(c->win), 1);
> }
> +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);
> +}
>
> int
> updategeom(void)
> _AT_@ -2042,6 +2088,7 @@ view(const Arg *arg)
> selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
> focus(NULL);
> arrange(selmon);
> + updatecurrentdesktop();
> }
>
> Client *
> --
> 2.21.0
>
>


A K
https://abdullah.today
69C8 7720 E507 86DF 1D85
EA5E FC59 7891 5CBC 7BC7



Received on Fri Mar 29 2019 - 18:38:46 CET

This archive was generated by hypermail 2.3.0 : Fri Mar 29 2019 - 19:24:23 CET