summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBossCode45 <human.cyborg42@gmail.com>2022-08-29 10:49:50 +1200
committerBossCode45 <human.cyborg42@gmail.com>2022-08-29 10:49:50 +1200
commit1159d5a29101522503ee198215b9d624449f4e49 (patch)
tree2fa8e2880eaea208e813e35f79e5fd9a95795faf
parentb4eba3e98ed58f1dbfe454d702653e6caefc9635 (diff)
downloadYATwm-1159d5a29101522503ee198215b9d624449f4e49.tar.gz
YATwm-1159d5a29101522503ee198215b9d624449f4e49.zip
Wooo beginings of EWMH - docks are excluded from tilinga
-rw-r--r--config.h2
-rw-r--r--main.cpp33
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 <string>
//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 <X11/X.h>
#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
#include <cstdlib>
#include <iostream>
#include <map>
@@ -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<int, Frame>(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)