Re: [hackers] dwm-6.0-current_desktop.diff
Ok... please I offer my apologies to all. Yes I should of read how to
contribute first.
In the moment of achieving apparently nothing at all I just sent using gmail.
Honestly I dont know anything about dwm concepts or EWMH, I simply
was helping someone out on IRC and they wanted me to send this in.
I do love using dwm.
All I did was fix the existing dwm-5.8.2-current_desktop.diff for it to apply to
dwm-6.0. Whats the point in having a patch online that doesnt work with your
current version??
Suave!
-Roberto
--- dwm.c.orig 2011-12-19 10:02:46.000000000 -0500
+++ dwm.c 2015-08-19 13:04:05.843531007 -0400
_AT_@ -59,8 +59,10 @@
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
enum { NetSupported, NetWMName, NetWMState,
- NetWMFullscreen, NetActiveWindow, NetWMWindowType,
+ NetWMFullscreen, NetNumberOfDesktops,
+ NetCurrentDesktop,NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetLast }; /* EWMH atoms */
+
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /*
default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
_AT_@ -220,6 +222,7 @@
static void setfullscreen(Client *c, Bool fullscreen);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
+static void setnumbdesktops(void);
static void setup(void);
static void showhide(Client *c);
static void sigchld(int unused);
_AT_@ -235,6 +238,7 @@
static void unfocus(Client *c, Bool setfocus);
static void unmanage(Client *c, Bool destroyed);
static void unmapnotify(XEvent *e);
+static void updatecurrenddesktop(void);
static Bool updategeom(void);
static void updatebarpos(Monitor *m);
static void updatebars(void);
_AT_@ -1487,6 +1491,13 @@
}
void
+setcurrentdesktop(void){
+ long data[] = { 0 };
+ XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *)data, 1);
+}
+
+void
setclientstate(Client *c, long state) {
long data[] = { state, None };
_AT_@ -1581,6 +1592,13 @@
}
void
+setnumbdesktops(void){
+ long data[] = { TAGMASK };
+ XChangeProperty(dpy, root, netatom[NetNumberOfDesktops],
XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *)data, 1);
+}
+
+void
setup(void) {
XSetWindowAttributes wa;
_AT_@ -1607,6 +1625,10 @@
netatom[NetWMFullscreen] = XInternAtom(dpy,
"_NET_WM_STATE_FULLSCREEN", False);
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy,
"_NET_WM_WINDOW_TYPE_DIALOG", False);
+ netatom[NetNumberOfDesktops] = XInternAtom(dpy,
"_NET_NUMBER_OF_DESKTOPS", False);
+ netatom[NetCurrentDesktop] = XInternAtom(dpy,
"_NET_CURRENT_DESKTOP", False);
+
+
/* init cursors */
cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
_AT_@ -1629,6 +1651,10 @@
/* EWMH support per view */
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
PropModeReplace, (unsigned char *) netatom, NetLast);
+ /* set EWMH NUMBER_OF_DESKTOPS */
+ setnumbdesktops();
+ /* initialize EWMH CURRENT_DESKTOP */
+ setcurrentdesktop();
/* select for events */
wa.cursor = cursor[CurNormal];
wa.event_mask =
SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask|PointerMotionMask
_AT_@ -1769,6 +1795,7 @@
focus(NULL);
arrange(selmon);
}
+ updatecurrenddesktop();
}
void
_AT_@ -1848,6 +1875,14 @@
m->by = -bh;
}
+void
+updatecurrenddesktop(){
+ long data[] = { selmon->tagset[selmon->seltags] };
+
+ XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *)data, 1);
+}
+
Bool
updategeom(void) {
Bool dirty = False;
_AT_@ -2050,6 +2085,7 @@
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
focus(NULL);
arrange(selmon);
+ updatecurrenddesktop();
}
Client *
On Wed, Aug 19, 2015 at 3:31 PM, Martti Kühne <mysatyre_AT_gmail.com> wrote:
> On Wed, Aug 19, 2015 at 8:00 PM, R0B R0D <witchdoctor.mdf_AT_gmail.com> wrote:
>> Hi, this is my first patch, I was helping someone on IRC and got it to work.
>
> First of all welcome and thanks for making me puke over my web mail
> interface. A quick google revealed to me that the discussion about
> HTML email had been had in 2009, with a conclusion diverging from your
> input.
>
>>
>> # wmctrl -d
>> Cannot get number of desktops properties. (_NET_NUMBER_OF_DESKTOPS or
>> _WIN_WORKSPACE_COUNT)
>>
>
> dwm tags != workspaces.
> Please attach some information about how this is compatible with both
> dwm's concepts and EWMH, in that it won't go up in flames for the
> obvious case where several workspaces are displayed at the same time.
> I could google that, but I just googled 6 years back already.
>
> As another aside, please read up on how to make contributions to the
> suckless wiki and how to apply changes and patches for particular
> projects.
>
> cheers!
> mar77i
>
Received on Wed Aug 19 2015 - 21:55:28 CEST
This archive was generated by hypermail 2.3.0
: Wed Aug 19 2015 - 22:00:18 CEST