From 1159d5a29101522503ee198215b9d624449f4e49 Mon Sep 17 00:00:00 2001 From: BossCode45 Date: Mon, 29 Aug 2022 10:49:50 +1200 Subject: Wooo beginings of EWMH - docks are excluded from tilinga --- config.h | 2 +- main.cpp | 33 ++++++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/config.h b/config.h index a74f846..d646b69 100644 --- a/config.h +++ b/config.h @@ -5,7 +5,7 @@ #include //Startup -std::string startup[] = {"picom -fD 3", "feh --bg-scale /usr/share/backgrounds/vapor_trails_blue.png"}; +std::string startup[] = {"picom -fD 3", "feh --bg-scale /usr/share/backgrounds/vapor_trails_blue.png", "~/.config/polybar/launch.sh"}; //Main config int gaps = 10; diff --git a/main.cpp b/main.cpp index 1a5af57..cdcf96e 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,8 @@ #include #include +#include +#include #include #include #include @@ -22,6 +24,7 @@ using std::vector; Display* dpy; Window root; int sW, sH; +int bH; TileDir nextDir = horizontal; bool keepGoing = true; @@ -101,7 +104,7 @@ void changeWS(const KeyArg arg) return; untile(prevWS); - tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2); + tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2 - bH); XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); } void wToWS(const KeyArg arg) @@ -145,7 +148,7 @@ void wToWS(const KeyArg arg) frames.find(fID)->second.pID = arg.num; frames.find(arg.num)->second.subFrameIDs.push_back(fID); XUnmapWindow(dpy, focusedWindow); - tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2); + tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2 - bH); XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); } int FFCF(int sID) @@ -286,7 +289,7 @@ void wMove(const KeyArg arg) std::swap(pSF[i], pSF[swapPos]); } - tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2); + tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2 - bH); XSetInputFocus(dpy, focusedWindow, RevertToPointerRoot, CurrentTime); return; } @@ -321,6 +324,26 @@ void configureRequest(XConfigureRequestEvent e) void mapRequest(XMapRequestEvent e) { XMapWindow(dpy, e.window); + + Atom prop_type = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", True); + Atom type; + int format; + unsigned long length; + unsigned long after; + unsigned char* data; + int status = XGetWindowProperty(dpy, e.window, prop_type, + 0L, 1L, False, + AnyPropertyType, &type, &format, + &length, &after, &data); + if (status == Success && type != None && ((Atom*)data)[0] == XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", true)) + { + XWindowAttributes attr; + XGetWindowAttributes(dpy, e.window, &attr); + bH = attr.height; + return; + } + + Window focusedWindow; int revertToReturn; XGetInputFocus(dpy, &focusedWindow, &revertToReturn); @@ -383,7 +406,7 @@ void mapRequest(XMapRequestEvent e) //Add to frames map frames.insert(pair(f.ID, f)); - tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2); + tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2 - bH); } void destroyNotify(XDestroyWindowEvent e) @@ -424,7 +447,7 @@ void destroyNotify(XDestroyWindowEvent e) } } XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); - tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2); + tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2 - bH); } static int OnXError(Display* display, XErrorEvent* e) -- cgit v1.2.3