diff options
| author | BossCode45 <human.cyborg42@gmail.com> | 2024-05-30 12:19:27 +1200 |
|---|---|---|
| committer | BossCode45 <human.cyborg42@gmail.com> | 2024-05-30 12:19:27 +1200 |
| commit | e162dff48c251e262f475de9261f0ecfa0f39dc4 (patch) | |
| tree | 32492f6c22e1b85c811f8a52942857c1f2773a1d | |
| parent | 2c9d13e954c2ee66ff4d43949bedc73e60637a34 (diff) | |
| download | YATwm-e162dff48c251e262f475de9261f0ecfa0f39dc4.tar.gz YATwm-e162dff48c251e262f475de9261f0ecfa0f39dc4.zip | |
feat: Updated readme and added nix support
Added a flake.nix and shell.nix and .envrc so nix+direnv will work well
| l--------- | .direnv/flake-profile | 1 | ||||
| l--------- | .direnv/flake-profile-1-link | 1 | ||||
| -rw-r--r-- | .envrc | 1 | ||||
| -rw-r--r-- | compile_commands.json | 130 | ||||
| -rw-r--r-- | flake.lock | 59 | ||||
| -rw-r--r-- | flake.nix | 14 | ||||
| -rw-r--r-- | main.cpp | 154 | ||||
| -rw-r--r-- | readme.html | 98 | ||||
| -rw-r--r-- | readme.org | 2 | ||||
| -rw-r--r-- | shell.nix | 13 | ||||
| -rw-r--r-- | structs.h | 2 |
11 files changed, 285 insertions, 190 deletions
diff --git a/.direnv/flake-profile b/.direnv/flake-profile new file mode 120000 index 0000000..0c05709 --- /dev/null +++ b/.direnv/flake-profile @@ -0,0 +1 @@ +flake-profile-1-link
\ No newline at end of file diff --git a/.direnv/flake-profile-1-link b/.direnv/flake-profile-1-link new file mode 120000 index 0000000..2c4bfed --- /dev/null +++ b/.direnv/flake-profile-1-link @@ -0,0 +1 @@ +/nix/store/lgavdfyjs3pawq8cpcbrd0idpxkw2xi8-nix-shell-env
\ No newline at end of file @@ -0,0 +1 @@ +use flake diff --git a/compile_commands.json b/compile_commands.json index 3997f42..e5199c2 100644 --- a/compile_commands.json +++ b/compile_commands.json @@ -1,16 +1,13 @@ [ { "arguments": [ - "/usr/bin/g++", + "/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/g++", "-std=c++17", - "-I/usr/include/gdk-pixbuf-2.0", - "-I/usr/include/glib-2.0", - "-I/usr/lib64/glib-2.0/include", - "-I/usr/include/sysprof-4", - "-I/usr/include/libpng16", - "-I/usr/include/libmount", - "-I/usr/include/blkid", - "-pthread", + "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include", + "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0", + "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include", + "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0", + "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include", "-c", "-o", "ewmh.o", @@ -22,107 +19,92 @@ }, { "arguments": [ - "/usr/bin/g++", + "/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/g++", "-std=c++17", - "-I/usr/include/gdk-pixbuf-2.0", - "-I/usr/include/glib-2.0", - "-I/usr/lib64/glib-2.0/include", - "-I/usr/include/sysprof-4", - "-I/usr/include/libpng16", - "-I/usr/include/libmount", - "-I/usr/include/blkid", - "-pthread", + "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include", + "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0", + "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include", + "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0", + "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include", "-c", "-o", - "main.o", - "main.cpp" + "config.o", + "config.cpp" ], "directory": "/home/boss/Documents/Coding/WM/YATwm", - "file": "/home/boss/Documents/Coding/WM/YATwm/main.cpp", - "output": "/home/boss/Documents/Coding/WM/YATwm/main.o" + "file": "/home/boss/Documents/Coding/WM/YATwm/config.cpp", + "output": "/home/boss/Documents/Coding/WM/YATwm/config.o" }, { "arguments": [ - "/usr/bin/g++", + "/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/g++", "-std=c++17", - "-I/usr/include/gdk-pixbuf-2.0", - "-I/usr/include/glib-2.0", - "-I/usr/lib64/glib-2.0/include", - "-I/usr/include/sysprof-4", - "-I/usr/include/libpng16", - "-I/usr/include/libmount", - "-I/usr/include/blkid", - "-pthread", + "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include", + "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0", + "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include", + "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0", + "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include", "-c", "-o", - "util.o", - "util.cpp" + "keybinds.o", + "keybinds.cpp" ], "directory": "/home/boss/Documents/Coding/WM/YATwm", - "file": "/home/boss/Documents/Coding/WM/YATwm/util.cpp", - "output": "/home/boss/Documents/Coding/WM/YATwm/util.o" + "file": "/home/boss/Documents/Coding/WM/YATwm/keybinds.cpp", + "output": "/home/boss/Documents/Coding/WM/YATwm/keybinds.o" }, { "arguments": [ - "/usr/bin/g++", + "/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/g++", "-std=c++17", - "-I/usr/include/gdk-pixbuf-2.0", - "-I/usr/include/glib-2.0", - "-I/usr/lib64/glib-2.0/include", - "-I/usr/include/sysprof-4", - "-I/usr/include/libpng16", - "-I/usr/include/libmount", - "-I/usr/include/blkid", - "-pthread", + "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include", + "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0", + "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include", + "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0", + "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include", "-c", "-o", - "config.o", - "config.cpp" + "commands.o", + "commands.cpp" ], "directory": "/home/boss/Documents/Coding/WM/YATwm", - "file": "/home/boss/Documents/Coding/WM/YATwm/config.cpp", - "output": "/home/boss/Documents/Coding/WM/YATwm/config.o" + "file": "/home/boss/Documents/Coding/WM/YATwm/commands.cpp", + "output": "/home/boss/Documents/Coding/WM/YATwm/commands.o" }, { "arguments": [ - "/usr/bin/g++", + "/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/g++", "-std=c++17", - "-I/usr/include/gdk-pixbuf-2.0", - "-I/usr/include/glib-2.0", - "-I/usr/lib64/glib-2.0/include", - "-I/usr/include/sysprof-4", - "-I/usr/include/libpng16", - "-I/usr/include/libmount", - "-I/usr/include/blkid", - "-pthread", + "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include", + "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0", + "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include", + "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0", + "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include", "-c", "-o", - "keybinds.o", - "keybinds.cpp" + "util.o", + "util.cpp" ], "directory": "/home/boss/Documents/Coding/WM/YATwm", - "file": "/home/boss/Documents/Coding/WM/YATwm/keybinds.cpp", - "output": "/home/boss/Documents/Coding/WM/YATwm/keybinds.o" + "file": "/home/boss/Documents/Coding/WM/YATwm/util.cpp", + "output": "/home/boss/Documents/Coding/WM/YATwm/util.o" }, { "arguments": [ - "/usr/bin/g++", + "/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/g++", "-std=c++17", - "-I/usr/include/gdk-pixbuf-2.0", - "-I/usr/include/glib-2.0", - "-I/usr/lib64/glib-2.0/include", - "-I/usr/include/sysprof-4", - "-I/usr/include/libpng16", - "-I/usr/include/libmount", - "-I/usr/include/blkid", - "-pthread", + "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include", + "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0", + "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include", + "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0", + "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include", "-c", "-o", - "commands.o", - "commands.cpp" + "main.o", + "main.cpp" ], "directory": "/home/boss/Documents/Coding/WM/YATwm", - "file": "/home/boss/Documents/Coding/WM/YATwm/commands.cpp", - "output": "/home/boss/Documents/Coding/WM/YATwm/commands.o" + "file": "/home/boss/Documents/Coding/WM/YATwm/main.cpp", + "output": "/home/boss/Documents/Coding/WM/YATwm/main.o" } ] diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fcf75f0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,59 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1710252211, + "narHash": "sha256-hQChQpB4LDBaSrNlD6DPLhU9T+R6oyxMCg2V+S7Y1jg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7eeacecff44e05a9fd61b9e03836b66ecde8a525", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d56f11d --- /dev/null +++ b/flake.nix @@ -0,0 +1,14 @@ +{ + description = "YATwm"; + + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let pkgs = nixpkgs.legacyPackages.${system}; in + { + devShells.default = import ./shell.nix { inherit pkgs; }; + } + ); +} @@ -93,6 +93,8 @@ void detectScreens(); void focusRoot(int root); void handleConfigErrs(vector<Err> cfgErrs); void updateTime(); +void cWS(int newWS); +void focusWindow(Window w); void configureRequest(XConfigureRequestEvent e); void mapRequest(XMapRequestEvent e); @@ -169,13 +171,13 @@ void focusRoot(int root) if(getFrame(root).subFrameIDs.size() == 0) { //log("\tRoot has no children"); - XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + focusWindow(root); return; } int client = getFrame(getClientChild(root)).cID; Window w = getClient(client).w; //log("\tFocusing window: " << w); - XSetInputFocus(dpy, w, RevertToPointerRoot, CurrentTime); + focusWindow(w); } void handleConfigErrs(vector<Err> cfgErrs) { @@ -217,6 +219,59 @@ void updateTime() now = std::localtime(&timeNow); strftime(nowString, sizeof(nowString), "[%H:%M:%S] ", now); } +void cWS(int newWS) +{ + int prevWS = currWS; + + currWS = newWS; + if(prevWS == currWS) + return; + untileRoots(); + + //log("Changing WS with keybind"); + + for(int i = 0; i < cfg.workspaces[newWS - 1].screenPreferencesc; i++) + { + if(nscreens > cfg.workspaces[newWS - 1].screenPreferences[i]) + { + int screen = cfg.workspaces[newWS - 1].screenPreferences[i]; + //log("Found screen (screen " << screenPreferences[arg.num - 1][i] << ")"); + prevWS = focusedWorkspaces[screen]; + //log("Changed prevWS"); + focusedWorkspaces[screen] = newWS; + //log("Changed focusedWorkspaces"); + if(focusedScreen != screen) + { + focusedScreen = screen; + XWarpPointer(dpy, root, root, 0, 0, 0, 0, screens[screen].x + screens[screen].w/2, screens[screen].y + screens[screen].h/2); + } + //log("Changed focusedScreen"); + break; + } + } + + //log("Finished changes"); + + //log(prevWS); + // LOOK: what is this for????? + if(prevWS < 1 || prevWS > cfg.workspaces.size()) + { + //untile(prevWS); + } + //log("Untiled"); + //tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2 - bH); + tileRoots(); + //log("Roots tiled"); + focusWindow(getFrame(currWS).rootData->focus); + + //EWMH + setCurrentDesktop(currWS); +} +void focusWindow(Window w) +{ + XSetInputFocus(dpy, w, RevertToPointerRoot, CurrentTime); + getFrame(currWS).rootData->focus = w; +} //Keybind commands const void exit(const CommandArg* argv) @@ -283,57 +338,6 @@ const void kill(const CommandArg* argv) XKillClient(dpy, w); } } -// Took this out as it is used commonly -void cWS(int newWS) -{ - int prevWS = currWS; - - currWS = newWS; - if(prevWS == currWS) - return; - untileRoots(); - - //log("Changing WS with keybind"); - - for(int i = 0; i < cfg.workspaces[newWS - 1].screenPreferencesc; i++) - { - if(nscreens > cfg.workspaces[newWS - 1].screenPreferences[i]) - { - int screen = cfg.workspaces[newWS - 1].screenPreferences[i]; - //log("Found screen (screen " << screenPreferences[arg.num - 1][i] << ")"); - prevWS = focusedWorkspaces[screen]; - //log("Changed prevWS"); - focusedWorkspaces[screen] = newWS; - //log("Changed focusedWorkspaces"); - if(focusedScreen != screen) - { - focusedScreen = screen; - XWarpPointer(dpy, root, root, 0, 0, 0, 0, screens[screen].x + screens[screen].w/2, screens[screen].y + screens[screen].h/2); - } - //log("Changed focusedScreen"); - break; - } - } - - //log("Finished changes"); - - //log(prevWS); - // LOOK: what is this for????? - if(prevWS < 1 || prevWS > cfg.workspaces.size()) - { - //untile(prevWS); - } - //log("Untiled"); - //tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2 - bH); - tileRoots(); - //log("Roots tiled"); - XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); - - cout << focusedWorkspaces[0] << endl; - - //EWMH - setCurrentDesktop(currWS); -} const void changeWS(const CommandArg* argv) { cWS(argv[0].num); @@ -389,7 +393,7 @@ const void wToWS(const CommandArg* argv) //tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2 - bH); untileRoots(); tileRoots(); - XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + focusWindow(root); } int dirFind(int fID, MoveDir dir) { @@ -445,7 +449,7 @@ const void focChange(const CommandArg* argv) int nID = dirFind(fID, argv[0].dir); int fNID = FFCF(nID); Window w = clients.find(frames.find(fNID)->second.cID)->second.w; - XSetInputFocus(dpy, w, RevertToPointerRoot, CurrentTime); + focusWindow(w); } const void wMove(const CommandArg* argv) { @@ -527,10 +531,10 @@ const void wMove(const CommandArg* argv) untileRoots(); tileRoots(); //tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2 - bH); - XSetInputFocus(dpy, focusedWindow, RevertToPointerRoot, CurrentTime); + focusWindow(focusedWindow); return; } - XSetInputFocus(dpy, focusedWindow, RevertToPointerRoot, CurrentTime); + focusWindow(focusedWindow); } const void bashSpawn(const CommandArg* argv) { @@ -616,7 +620,7 @@ void configureRequest(XConfigureRequestEvent e) changes.stack_mode = e.detail; XConfigureWindow(dpy, e.window, (unsigned int) e.value_mask, &changes); log("Configure request: " << e.window); - //XSetInputFocus(dpy, e.window, RevertToNone, CurrentTime); + //focusWindow(e.window); //tileRoots(); } @@ -771,7 +775,7 @@ void mapRequest(XMapRequestEvent e) //Insert the new frame into the frames map frames.insert(pair<int, Frame>(pF.ID, pF)); } - + //Add to frames map frames.insert(pair<int, Frame>(f.ID, f)); @@ -779,7 +783,7 @@ void mapRequest(XMapRequestEvent e) updateClientList(clients); //tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2 - bH); - XSetInputFocus(dpy, e.window, RevertToNone, CurrentTime); + focusWindow(e.window); tileRoots(); } @@ -825,7 +829,7 @@ void destroyNotify(XDestroyWindowEvent e) break; } } - XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + focusWindow(root); //tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2 - bH); tileRoots(); @@ -852,7 +856,7 @@ void enterNotify(XEnterWindowEvent e) } } focusedScreen = monitor; - XSetInputFocus(dpy, e.window, RevertToNone, CurrentTime); + focusWindow(e.window); } void clientMessage(XClientMessageEvent e) { @@ -872,7 +876,7 @@ void clientMessage(XClientMessageEvent e) untile(prevWS); tile(currWS, outerGaps, outerGaps, sW - outerGaps*2, sH - outerGaps*2 - bH); - XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + focusWindow(root); //EWMH setCurrentDesktop(currWS); @@ -935,10 +939,13 @@ void untileRoots() } int tile(int frameID, int x, int y, int w, int h) { - for(int fID : frames.find(frameID)->second.rootData->floatingFrameIDs) + if(getFrame(frameID).rootData) { - Window w = clients.find(frames.find(fID)->second.cID)->second.w; - XMapWindow(dpy, w); + for(int fID : frames.find(frameID)->second.rootData->floatingFrameIDs) + { + Window w = clients.find(frames.find(fID)->second.cID)->second.w; + XMapWindow(dpy, w); + } } TileDir dir = frames.find(frameID)->second.dir; int i = 0; @@ -981,10 +988,13 @@ int tile(int frameID, int x, int y, int w, int h) void untile(int frameID) { - for(int fID : frames.find(frameID)->second.rootData->floatingFrameIDs) + if(getFrame(frameID).rootData) { - Window w = clients.find(frames.find(fID)->second.cID)->second.w; - XUnmapWindow(dpy, w); + for(int fID : frames.find(frameID)->second.rootData->floatingFrameIDs) + { + Window w = clients.find(frames.find(fID)->second.cID)->second.w; + XUnmapWindow(dpy, w); + } } vector<int>& subFrameIDs = frames.find(frameID)->second.subFrameIDs; TileDir dir = frames.find(frameID)->second.dir; @@ -1081,12 +1091,14 @@ int main(int argc, char** argv) for(int i = 1; i < cfg.numWS + 1; i++) { vector<int> v; - Frame rootFrame = {i, noID, false, noID, horizontal, v, new RootData}; + RootData* rootData = new RootData; + rootData->focus = root; + Frame rootFrame = {i, noID, false, noID, horizontal, v, rootData}; frames.insert(pair<int, Frame>(i, rootFrame)); currFrameID++; } - XSetInputFocus(dpy, root, RevertToNone, CurrentTime); + focusWindow(root); XWarpPointer(dpy, root, root, 0, 0, 0, 0, 960, 540); log("Begin mainloop"); diff --git a/readme.html b/readme.html index 7879e4d..baf974a 100644 --- a/readme.html +++ b/readme.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> -<!-- 2023-06-28 Wed 21:24 --> +<!-- 2024-05-30 Thu 12:18 --> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>YATwm</title> @@ -200,36 +200,36 @@ <h2>Table of Contents</h2> <div id="text-table-of-contents" role="doc-toc"> <ul> -<li><a href="#orgbfb53c0">1. This config is best read in Emacs!</a></li> -<li><a href="#org10dcbf8">2. Disclaimer: This is still very much in beta</a></li> -<li><a href="#org522cd53">3. Usage instructions</a> +<li><a href="#org8f255ac">1. This readme is best read in Emacs!</a></li> +<li><a href="#orgff58158">2. Disclaimer: This is still very much in beta</a></li> +<li><a href="#org5a82899">3. Usage instructions</a> <ul> -<li><a href="#org5f71891">3.1. Installation</a> +<li><a href="#org7f0c02f">3.1. Installation</a> <ul> -<li><a href="#org3dc64ae">3.1.1. Pre reqs</a></li> -<li><a href="#org309a902">3.1.2. Installing and removing</a></li> +<li><a href="#orgeea7a9c">3.1.1. Pre reqs</a></li> +<li><a href="#org5d141f8">3.1.2. Installing and removing</a></li> </ul> </li> -<li><a href="#orgb007d3a">3.2. Config</a> +<li><a href="#org7702c4e">3.2. Config</a> <ul> -<li><a href="#org6dcf252">3.2.1. Syntax</a></li> -<li><a href="#org9f46c02">3.2.2. General</a></li> -<li><a href="#org7f3b7f1">3.2.3. Workspaces</a></li> -<li><a href="#org123f75e">3.2.4. Keybinds</a></li> +<li><a href="#orgaf9f242">3.2.1. Syntax</a></li> +<li><a href="#org53df619">3.2.2. General</a></li> +<li><a href="#orgcf9ca38">3.2.3. Workspaces</a></li> +<li><a href="#orgf1e79dd">3.2.4. Keybinds</a></li> </ul> </li> </ul> </li> -<li><a href="#org5ea945f">4. Credits</a></li> +<li><a href="#orgbb47c8b">4. Credits</a></li> </ul> </div> </div> -<div id="outline-container-orgbfb53c0" class="outline-2"> -<h2 id="orgbfb53c0"><span class="section-number-2">1.</span> This config is best read in Emacs!</h2> +<div id="outline-container-org8f255ac" class="outline-2"> +<h2 id="org8f255ac"><span class="section-number-2">1.</span> This readme is best read in Emacs!</h2> </div> -<div id="outline-container-org10dcbf8" class="outline-2"> -<h2 id="org10dcbf8"><span class="section-number-2">2.</span> Disclaimer: This is still very much in beta</h2> +<div id="outline-container-orgff58158" class="outline-2"> +<h2 id="orgff58158"><span class="section-number-2">2.</span> Disclaimer: This is still very much in beta</h2> <div class="outline-text-2" id="text-2"> <p> This only just works, multiple monitors aren't supported and floating windows cannot move and there is no resizing. Many features are just hacked together and are likely to break. However, it is just about usable so if you really want to try then go for it! (feel free to make an issue if you have any questions).<br /> @@ -237,16 +237,16 @@ This only just works, multiple monitors aren't supported and floating windows ca </div> </div> -<div id="outline-container-org522cd53" class="outline-2"> -<h2 id="org522cd53"><span class="section-number-2">3.</span> Usage instructions</h2> +<div id="outline-container-org5a82899" class="outline-2"> +<h2 id="org5a82899"><span class="section-number-2">3.</span> Usage instructions</h2> <div class="outline-text-2" id="text-3"> </div> -<div id="outline-container-org5f71891" class="outline-3"> -<h3 id="org5f71891"><span class="section-number-3">3.1.</span> Installation</h3> +<div id="outline-container-org7f0c02f" class="outline-3"> +<h3 id="org7f0c02f"><span class="section-number-3">3.1.</span> Installation</h3> <div class="outline-text-3" id="text-3-1"> </div> -<div id="outline-container-org3dc64ae" class="outline-4"> -<h4 id="org3dc64ae"><span class="section-number-4">3.1.1.</span> Pre reqs</h4> +<div id="outline-container-orgeea7a9c" class="outline-4"> +<h4 id="orgeea7a9c"><span class="section-number-4">3.1.1.</span> Pre reqs</h4> <div class="outline-text-4" id="text-3-1-1"> <ul class="org-ul"> <li><code>Xlib</code> and <code>g++</code> and <code>libnotify</code> to build the program<br /></li> @@ -258,8 +258,8 @@ This only just works, multiple monitors aren't supported and floating windows ca </ul> </div> </div> -<div id="outline-container-org309a902" class="outline-4"> -<h4 id="org309a902"><span class="section-number-4">3.1.2.</span> Installing and removing</h4> +<div id="outline-container-org5d141f8" class="outline-4"> +<h4 id="org5d141f8"><span class="section-number-4">3.1.2.</span> Installing and removing</h4> <div class="outline-text-4" id="text-3-1-2"> <ul class="org-ul"> <li><code>make i</code> or <code>make install</code> to install<br /></li> @@ -269,23 +269,23 @@ This only just works, multiple monitors aren't supported and floating windows ca </div> </div> </div> -<div id="outline-container-orgb007d3a" class="outline-3"> -<h3 id="orgb007d3a"><span class="section-number-3">3.2.</span> Config</h3> +<div id="outline-container-org7702c4e" class="outline-3"> +<h3 id="org7702c4e"><span class="section-number-3">3.2.</span> Config</h3> <div class="outline-text-3" id="text-3-2"> <p> You can configure YATwm with the config file in <code>$HOME/.config/YATwm/config</code> or <code>$XDG_CONFIG_HOME/YATwm/config</code> if you have that set. I have provided an example config file in the project dir that has all the variables set to their defaults (this will also be installed to <code>/etc/YATwm/config</code>.<br /> It should alert you with a notification if you have an error, and put the error your log file. If the whole file is missing then it will use the default in <code>/etc/YATwm/config</code>.<br /> </p> </div> -<div id="outline-container-org6dcf252" class="outline-4"> -<h4 id="org6dcf252"><span class="section-number-4">3.2.1.</span> Syntax</h4> +<div id="outline-container-orgaf9f242" class="outline-4"> +<h4 id="orgaf9f242"><span class="section-number-4">3.2.1.</span> Syntax</h4> <div class="outline-text-4" id="text-3-2-1"> <p> The config file is a list of commands. Each command should be on a new line. For example, to set the gaps you would use the <code>gaps</code> command like this <code>gaps 10</code> (make sure this is all there is on that line). This says to call the command <code>gaps</code> with the arguments of <code>10</code>. Commands can have multiple arguments and these should be separated with a space, if you want a space in one of the arguments then wrap the arg in quotes, e.g. <code>addWorkspace "1: A" 1</code>, here the arguments are <code>1: A</code> and <code>1</code>. If you want to have a quote in your argument then make sure that arg is wrapped in quotes or escape it with <code>\</code> (e.g. <code>\'</code>), to insert <code>\</code> then use <code>\\</code>. If you want to have multiple commands on the same line, e.g. binding a key to multiple commands, then use <code>;</code> as an argument on its own to separate them (tip: if you are using this for keybinds then enclose <b>all</b> the keybind commands in quotes, e.g. <code>bind mod+l "spawn i3lock ; spawn systemctl suspend"</code>).<br /> </p> </div> <ol class="org-ol"> -<li><a id="orge3364c9"></a>Command arg types<br /> +<li><a id="orgdadee98"></a>Command arg types<br /> <div class="outline-text-5" id="text-3-2-1-1"> <ul class="org-ul"> <li>String: this is just some text, this can be wrapped in quotes if you want a space in it.<br /></li> @@ -302,7 +302,7 @@ The config file is a list of commands. Each command should be on a new line. For </ul> </div> </li> -<li><a id="orgbdd70f3"></a>List of commands<br /> +<li><a id="org558f16b"></a>List of commands<br /> <div class="outline-text-5" id="text-3-2-1-2"> <ul class="org-ul"> <li>exit: shuts down YATwm<br /></li> @@ -359,12 +359,16 @@ The config file is a list of commands. Each command should be on a new line. For </ul></li> <li>bind: Binds a key to a command<br /> <ul class="org-ul"> -<li>String: The key bind, modifiers and keys are separated with +, e.g. <code>mod+x</code>. This can also be a key chord, where you have multiple binds, where when pressed in succession will execute the command (make sure to enclose this arg in quotes, and then separate the binds with spaces)<br /></li> +<li>String: The key bind, structured according to the bind mode. This can also be a key chord, where you have multiple binds, where when pressed in succession will execute the command (make sure to enclose this arg in quotes, and then separate the binds with spaces)<br /></li> <li>String rest: The command to run<br /></li> </ul></li> <li>quitkey: Sets the key to exit a key chord (note: pressing an unbound key also does this)<br /> <ul class="org-ul"> -<li>String: The key bind, modifiers and keys are separated with +, e.g. <code>mod+g</code>.<br /></li> +<li>String: The key bind, structured according to the bind mode.<br /></li> +</ul></li> +<li>bindmode: Sets the bind mode (Description of these further down)<br /> +<ul class="org-ul"> +<li>String: The bind mode to use<br /></li> </ul></li> <li>wsDump: This is a command for testing, you probably don't want to use it<br /></li> </ul> @@ -372,8 +376,8 @@ The config file is a list of commands. Each command should be on a new line. For </li> </ol> </div> -<div id="outline-container-org9f46c02" class="outline-4"> -<h4 id="org9f46c02"><span class="section-number-4">3.2.2.</span> General</h4> +<div id="outline-container-org53df619" class="outline-4"> +<h4 id="org53df619"><span class="section-number-4">3.2.2.</span> General</h4> <div class="outline-text-4" id="text-3-2-2"> <p> 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).<br /> @@ -383,8 +387,8 @@ YATwm also keeps a log file, the location of this file can be changed with the c </div> </div> -<div id="outline-container-org7f3b7f1" class="outline-4"> -<h4 id="org7f3b7f1"><span class="section-number-4">3.2.3.</span> Workspaces</h4> +<div id="outline-container-orgcf9ca38" class="outline-4"> +<h4 id="orgcf9ca38"><span class="section-number-4">3.2.3.</span> Workspaces</h4> <div class="outline-text-4" id="text-3-2-3"> <p> You can add workspace with the command <code>addworkspace</code> in the config file.<br /> @@ -410,8 +414,8 @@ Defaults workspace are listed below (these are the args for the addworkspace com </ol> </div> </div> -<div id="outline-container-org123f75e" class="outline-4"> -<h4 id="org123f75e"><span class="section-number-4">3.2.4.</span> Keybinds</h4> +<div id="outline-container-orgf1e79dd" class="outline-4"> +<h4 id="orgf1e79dd"><span class="section-number-4">3.2.4.</span> Keybinds</h4> <div class="outline-text-4" id="text-3-2-4"> <p> Current keybinds (these can all be edited):<br /> @@ -452,12 +456,20 @@ bind mod+shift+x bashSpawn loginctl lock-session && systemctl suspend Commands are executed going down the list and multiple commands with the same keybind and modifiers will all be executed<br /> </p> </div> +<ol class="org-ol"> +<li><a id="orga1fb981"></a>Bind modes<br /> +<div class="outline-text-5" id="text-3-2-4-1"> +<p> +The current two bind modes are <code>normal</code> and <code>emacs</code>. The normal bind mode has the same syntax as i3, so key and modifiers separated with a '+', and use the xlib KeySym name for them. The emacs bind mode has the same syntax as emacs, so separate modifiers and keys with a '-', and the key comes last. It uses xlib keysyms, but for multi letter keys such as <code>RET</code>, <code>SPC</code>, <code>ESC</code>, <code>+</code>, <code>-</code> it has special logic to interpret how they would be written in emacs (note: if there are any other exceptions please let me know).<br /> +</p> </div> +</li> +</ol> </div> </div> - -<div id="outline-container-org5ea945f" class="outline-2"> -<h2 id="org5ea945f"><span class="section-number-2">4.</span> Credits</h2> +</div> +<div id="outline-container-orgbb47c8b" class="outline-2"> +<h2 id="orgbb47c8b"><span class="section-number-2">4.</span> Credits</h2> <div class="outline-text-2" id="text-4"> <p> Catwm (<a href="https://github.com/pyknite/catwm">https://github.com/pyknite/catwm</a>)<br /> @@ -470,7 +482,7 @@ basic<sub>wm</sub> (<a href="https://github.com/jichu4n/basic_wm">https://github </div> </div> <div id="postamble" class="status"> -<p class="date">Created: 2023-06-28 Wed 21:24</p> +<p class="date">Created: 2024-05-30 Thu 12:18</p> <p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p> </div> </body> @@ -1,6 +1,6 @@ #+TITLE: YATwm #+OPTIONS: \n:t -* This config is best read in Emacs! +* This readme is best read in Emacs! * Disclaimer: This is still very much in beta This only just works, multiple monitors aren't supported and floating windows cannot move and there is no resizing. Many features are just hacked together and are likely to break. However, it is just about usable so if you really want to try then go for it! (feel free to make an issue if you have any questions). diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..46c8894 --- /dev/null +++ b/shell.nix @@ -0,0 +1,13 @@ +{ pkgs ? import <nixpkgs> {} }: +with pkgs; +mkShell { + buildInputs = [ + gcc + gnumake + xorg.libX11 + xorg.libXrandr + libnotify + pkg-config + clang-tools + ]; +} @@ -26,8 +26,8 @@ enum TileDir struct RootData { std::vector<int> floatingFrameIDs; + Window focus; //int workspaceNumber; - //int whichChildFocused = 0; }; struct Frame |
