summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBossCode45 <human.cyborg42@gmail.com>2024-10-01 14:58:13 +1300
committerBossCode45 <human.cyborg42@gmail.com>2024-10-01 14:58:13 +1300
commit8b48a9cfc4b0795a62a515e2519e7194d1d57347 (patch)
treefc0d0d6df5bb0c10853cb3ba77bc48cc48a2d23d
parent915532bf8fbda9ba2a36e04fcd6acc67c6c68fa5 (diff)
parente162dff48c251e262f475de9261f0ecfa0f39dc4 (diff)
downloadYATwm-8b48a9cfc4b0795a62a515e2519e7194d1d57347.tar.gz
YATwm-8b48a9cfc4b0795a62a515e2519e7194d1d57347.zip
Merge branch 'main' into IPC
l---------.direnv/flake-profile1
l---------.direnv/flake-profile-1-link1
-rw-r--r--.envrc1
-rw-r--r--compile_commands.json128
-rw-r--r--flake.lock59
-rw-r--r--flake.nix14
-rw-r--r--readme.html98
-rw-r--r--readme.org2
-rw-r--r--shell.nix13
-rw-r--r--src/main.cpp171
-rw-r--r--src/structs.h17
11 files changed, 248 insertions, 257 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
diff --git a/.envrc b/.envrc
new file mode 100644
index 0000000..3550a30
--- /dev/null
+++ b/.envrc
@@ -0,0 +1 @@
+use flake
diff --git a/compile_commands.json b/compile_commands.json
deleted file mode 100644
index aa66e68..0000000
--- a/compile_commands.json
+++ /dev/null
@@ -1,128 +0,0 @@
-[
- {
- "arguments": [
- "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
- "-std=c++17",
- "-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",
- "build/config.o",
- "src/config.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/src/config.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/build/config.o"
- },
- {
- "arguments": [
- "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
- "-std=c++17",
- "-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",
- "build/ewmh.o",
- "src/ewmh.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/src/ewmh.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/build/ewmh.o"
- },
- {
- "arguments": [
- "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
- "-std=c++17",
- "-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",
- "build/main.o",
- "src/main.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/src/main.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/build/main.o"
- },
- {
- "arguments": [
- "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
- "-std=c++17",
- "-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",
- "build/IPC.o",
- "src/IPC.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/src/IPC.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/build/IPC.o"
- },
- {
- "arguments": [
- "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
- "-std=c++17",
- "-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",
- "build/util.o",
- "src/util.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/src/util.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/build/util.o"
- },
- {
- "arguments": [
- "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
- "-std=c++17",
- "-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",
- "build/keybinds.o",
- "src/keybinds.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/src/keybinds.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/build/keybinds.o"
- },
- {
- "arguments": [
- "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
- "-std=c++17",
- "-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",
- "build/commands.o",
- "src/commands.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/src/commands.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/build/commands.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; };
+ }
+ );
+}
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 &amp;&amp; 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>
diff --git a/readme.org b/readme.org
index f6257da..a5a2041 100644
--- a/readme.org
+++ b/readme.org
@@ -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
+ ];
+}
diff --git a/src/main.cpp b/src/main.cpp
index 1f3edc2..77f4dbc 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -97,6 +97,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);
@@ -173,13 +175,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)
{
@@ -221,6 +223,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)
@@ -287,57 +342,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);
@@ -362,7 +366,7 @@ const void wToWS(const CommandArg* argv)
//Frame disolve
pSF.erase(pSF.begin() + i);
int pID = frames.find(fID)->second.pID;
- if(pSF.size() < 2 && !frames.find(pID)->second.isRoot)
+ if(pSF.size() < 2 && !frames.find(pID)->second.rootData)
{
//Erase parent frame
int lastChildID = frames.find(frames.find(pID)->second.subFrameIDs[0])->second.ID;
@@ -393,7 +397,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)
{
@@ -449,7 +453,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)
{
@@ -479,7 +483,7 @@ const void wMove(const CommandArg* argv)
{
//Frame dissolve
oPSF.erase(oPSF.begin() + i);
- if(oPSF.size() < 2 && !frames.find(oPID)->second.isRoot)
+ if(oPSF.size() < 2 && !frames.find(oPID)->second.rootData)
{
//Erase parent frame
int lastChildID = frames.find(frames.find(oPID)->second.subFrameIDs[0])->second.ID;
@@ -531,10 +535,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)
{
@@ -578,7 +582,7 @@ const void wsDump(const CommandArg* argv)
if(getFrame(i).isClient)
{
int id = i;
- while(!getFrame(id).isRoot)
+ while(!getFrame(id).rootData)
{
id=getFrame(id).pID;
}
@@ -620,7 +624,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();
}
@@ -717,8 +721,7 @@ void mapRequest(XMapRequestEvent e)
//Make frame
//pID = (frameIDS.count(focusedWindow)>0)? frames.find(frameIDS.find(focusedWindow)->second)->second.pID : currWS;
vector<int> v;
- vector<int> floating;
- Frame f = {currFrameID, pID, true, c.ID, noDir, v, false, floating};
+ Frame f = {currFrameID, pID, true, c.ID, noDir, v, NULL};
currFrameID++;
@@ -730,7 +733,7 @@ void mapRequest(XMapRequestEvent e)
{
cout << "Floating" << endl;
clients.find(c.ID)->second.floating = true;
- frames.find(pID)->second.floatingFrameIDs.push_back(f.ID);
+ frames.find(pID)->second.rootData->floatingFrameIDs.push_back(f.ID);
frames.insert(pair<int, Frame>(f.ID, f));
setWindowDesktop(e.window, currWS);
updateClientList(clients);
@@ -764,7 +767,7 @@ void mapRequest(XMapRequestEvent e)
vector<int> v;
v.push_back(frames.find(frameIDS.find(focusedWindow)->second)->second.ID);
v.push_back(f.ID);
- Frame pF = {currFrameID, pID, false, noID, nextDir, v, false, floating};
+ Frame pF = {currFrameID, pID, false, noID, nextDir, v, NULL};
//Update the IDS
f.pID = currFrameID;
@@ -776,7 +779,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));
@@ -784,7 +787,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();
}
@@ -799,7 +802,7 @@ void destroyNotify(XDestroyWindowEvent e)
vector<int>& pS = frames.find(pID)->second.subFrameIDs;
if(clients.find(frames.find(fID)->second.cID)->second.floating)
{
- pS = frames.find(pID)->second.floatingFrameIDs;
+ pS = frames.find(pID)->second.rootData->floatingFrameIDs;
}
for(int i = 0; i < pS.size(); i++)
{
@@ -810,7 +813,7 @@ void destroyNotify(XDestroyWindowEvent e)
frames.erase(fID);
frameIDS.erase(e.window);
- if(pS.size() < 2 && !frames.find(pID)->second.isRoot)
+ if(pS.size() < 2 && !frames.find(pID)->second.rootData)
{
//Erase parent frame
int lastChildID = frames.find(frames.find(pID)->second.subFrameIDs[0])->second.ID;
@@ -830,7 +833,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();
@@ -857,7 +860,7 @@ void enterNotify(XEnterWindowEvent e)
}
}
focusedScreen = monitor;
- XSetInputFocus(dpy, e.window, RevertToNone, CurrentTime);
+ focusWindow(e.window);
}
void clientMessage(XClientMessageEvent e)
{
@@ -877,7 +880,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);
@@ -940,10 +943,13 @@ void untileRoots()
}
int tile(int frameID, int x, int y, int w, int h)
{
- for(int fID : frames.find(frameID)->second.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;
@@ -986,10 +992,13 @@ int tile(int frameID, int x, int y, int w, int h)
void untile(int frameID)
{
- for(int fID : frames.find(frameID)->second.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;
@@ -1088,12 +1097,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, true};
+ 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);
fd_set fdset;
diff --git a/src/structs.h b/src/structs.h
index 8215bf5..5273f52 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -23,6 +23,13 @@ enum TileDir
noDir
};
+struct RootData
+{
+ std::vector<int> floatingFrameIDs;
+ Window focus;
+ //int workspaceNumber;
+};
+
struct Frame
{
int ID;
@@ -30,15 +37,15 @@ struct Frame
bool isClient;
- //If its a client (window)
+ // If its a client (window)
int cID;
- //If it isn't a client
+ // If it isn't a client
TileDir dir;
std::vector<int> subFrameIDs;
- bool isRoot;
- std::vector<int> floatingFrameIDs;
- //int whichChildFocused = 0;
+
+ // Null if not root
+ RootData* rootData;
};
struct ScreenInfo