summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBossCode45 <human.cyborg42@gmail.com>2022-08-23 13:14:27 +1200
committerBossCode45 <human.cyborg42@gmail.com>2022-08-23 13:14:27 +1200
commitd8ed99af5deb48ed8280d8dcb5457a401d074a2d (patch)
treefbeca9d81c7d41887f6afccc8bb62c5f42028d71
parent3cb6b1583417c47c72e542604a8636d3410067fe (diff)
downloadYATwm-d8ed99af5deb48ed8280d8dcb5457a401d074a2d.tar.gz
YATwm-d8ed99af5deb48ed8280d8dcb5457a401d074a2d.zip
More config options and slightly better docs.
-rw-r--r--config.h11
-rw-r--r--main.cpp22
-rw-r--r--readme.org15
3 files changed, 42 insertions, 6 deletions
diff --git a/config.h b/config.h
index 4fa6ee3..55128bb 100644
--- a/config.h
+++ b/config.h
@@ -1,5 +1,16 @@
#include <X11/keysym.h>
+#include <vector>
+
+//Startup
+std::string startup[] = {"picom -fD 3", "feh --bg-scale /usr/share/backgrounds/vapor_trails_blue.png"};
+
+//Main config
+int gaps = 3;
+int outerGaps = 3;
+
+//Keys
+//The types and perhaps functions likely to be moved to seperate header file later
typedef union
{
const char** str;
diff --git a/main.cpp b/main.cpp
index d81924e..1a2f0ec 100644
--- a/main.cpp
+++ b/main.cpp
@@ -180,7 +180,7 @@ void mapRequest(XMapRequestEvent e)
//Add to frames map
frames.insert(pair<int, Frame>(f.ID, f));
- tile(0, 0, 0, sW, sH);
+ tile(0, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2);
}
void destroyNotify(XDestroyWindowEvent e)
@@ -220,7 +220,7 @@ void destroyNotify(XDestroyWindowEvent e)
break;
}
}
- tile(0, 0, 0, sW, sH);
+ tile(0, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2);
}
static int OnXError(Display* display, XErrorEvent* e)
@@ -247,11 +247,20 @@ void tile(int frameID, int x, int y, int w, int h)
int wW = (dir==horizontal) ? w/subFrameIDs.size() : w;
int wH = (dir==vertical) ? h/subFrameIDs.size() : h;
i++;
+ if(i==subFrameIDs.size())
+ {
+ wW = (dir==horizontal) ? w - wX : w;
+ wH = (dir==vertical) ? h - wY : h;
+ }
if(!f.isClient)
{
tile(fID, wX, wY, wW, wH);
continue;
}
+ wX += gaps;
+ wY += gaps;
+ wW -= gaps*2;
+ wH -= gaps*2;
Client c = clients.find(f.cID)->second;
//printf("Arranging client with frame ID %i, client ID %i:\n\tx: %i, y: %i, w: %i, h: %i\n", fID, c.ID, wX, wY, wW, wH);
XMoveWindow(dpy, c.w,
@@ -287,6 +296,15 @@ int main(int argc, char** argv)
currFrameID++;
frames.insert(pair<int, Frame>(0, rootFrame));
+ for(int i = 0; i < sizeof(startup)/sizeof(startup[0]); i++)
+ {
+ if(fork() == 0)
+ {
+ system(startup[i].c_str());
+ exit(0);
+ }
+ }
+
cout << "Begin mainloop\n";
while(keepGoing)
diff --git a/readme.org b/readme.org
index 14383b5..331efbb 100644
--- a/readme.org
+++ b/readme.org
@@ -7,15 +7,22 @@
It currently barely works (only reason this is public is because others may want to see for reference.
I wouldn't suggest using this at all and it may undergo heavy changes as the code currently isn't very clean or good.
-* For people that have brain damage (anyone who wants to use it)
-** Keybinds
-mod1 is alt
+* For people that have brain damage (anyone who wants to use it `while it is unfinished`)
+** Config
+*** Startup
+Add a bash command to the `startup` string in config.h and it will execute on startup.
+*** General
+You can change either the inner gaps (padding around each window - so double it for space between windows), or the outer gaps (padding around the display - add to inner gaps to get space between window and screen edges).
+They can be changed with the integers `gaps` and `outerGaps` in the config.h file.
+*** Keybinds
+Current keybinds:
- mod1 + enter : alacritty
- mod1 + d : rofi
- mod1 + t : change next tile direction
- mod1 + e : exit
- mod1 + q : quit focused window
-Add new keybinds reffering to the pre existing ones - docs coming later
+(mod1 is alt)
+Add new keybinds reffering to the pre existing ones - more docs coming later
* Credits
Catwm (https://github.com/pyknite/catwm)