├── .envrc
├── .github
└── workflows
│ └── build.yml
├── .gitignore
├── Cargo.lock
├── Cargo.toml
├── LICENSE
├── README.md
├── default.nix
├── flake.lock
├── flake.nix
├── protocols
├── river-control-unstable-v1.xml
└── river-layout-v3.xml
├── shell.nix
└── src
├── bin
└── owm.rs
├── binary.rs
├── derive.rs
├── encoding.rs
├── lib.rs
├── objective
├── adjacent_close.rs
├── area_ratios.rs
├── aspect_ratios.rs
├── center_main.rs
├── consistency.rs
├── gaps.rs
├── mod.rs
├── overlap.rs
└── reading_order.rs
├── post_processing.rs
├── rect.rs
└── testing.rs
/.envrc:
--------------------------------------------------------------------------------
1 | use flake
2 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: build
2 |
3 | on:
4 | push:
5 |
6 | jobs:
7 | build:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - uses: actions/checkout@v2
11 | - uses: cachix/install-nix-action@v12
12 | - name: Building package
13 | run: nix-build . -A defaultPackage.x86_64-linux
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /result
2 | /target
3 |
--------------------------------------------------------------------------------
/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | version = 3
4 |
5 | [[package]]
6 | name = "anstream"
7 | version = "0.3.2"
8 | source = "registry+https://github.com/rust-lang/crates.io-index"
9 | checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163"
10 | dependencies = [
11 | "anstyle",
12 | "anstyle-parse",
13 | "anstyle-query",
14 | "anstyle-wincon",
15 | "colorchoice",
16 | "is-terminal",
17 | "utf8parse",
18 | ]
19 |
20 | [[package]]
21 | name = "anstyle"
22 | version = "1.0.1"
23 | source = "registry+https://github.com/rust-lang/crates.io-index"
24 | checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd"
25 |
26 | [[package]]
27 | name = "anstyle-parse"
28 | version = "0.2.1"
29 | source = "registry+https://github.com/rust-lang/crates.io-index"
30 | checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333"
31 | dependencies = [
32 | "utf8parse",
33 | ]
34 |
35 | [[package]]
36 | name = "anstyle-query"
37 | version = "1.0.0"
38 | source = "registry+https://github.com/rust-lang/crates.io-index"
39 | checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
40 | dependencies = [
41 | "windows-sys",
42 | ]
43 |
44 | [[package]]
45 | name = "anstyle-wincon"
46 | version = "1.0.2"
47 | source = "registry+https://github.com/rust-lang/crates.io-index"
48 | checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c"
49 | dependencies = [
50 | "anstyle",
51 | "windows-sys",
52 | ]
53 |
54 | [[package]]
55 | name = "autocfg"
56 | version = "1.1.0"
57 | source = "registry+https://github.com/rust-lang/crates.io-index"
58 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
59 |
60 | [[package]]
61 | name = "bit-set"
62 | version = "0.5.3"
63 | source = "registry+https://github.com/rust-lang/crates.io-index"
64 | checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
65 | dependencies = [
66 | "bit-vec",
67 | ]
68 |
69 | [[package]]
70 | name = "bit-vec"
71 | version = "0.6.3"
72 | source = "registry+https://github.com/rust-lang/crates.io-index"
73 | checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
74 |
75 | [[package]]
76 | name = "bitflags"
77 | version = "1.3.2"
78 | source = "registry+https://github.com/rust-lang/crates.io-index"
79 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
80 |
81 | [[package]]
82 | name = "bitflags"
83 | version = "2.3.3"
84 | source = "registry+https://github.com/rust-lang/crates.io-index"
85 | checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
86 |
87 | [[package]]
88 | name = "blanket"
89 | version = "0.3.0"
90 | source = "registry+https://github.com/rust-lang/crates.io-index"
91 | checksum = "e0b121a9fe0df916e362fb3271088d071159cdf11db0e4182d02152850756eff"
92 | dependencies = [
93 | "proc-macro2",
94 | "quote",
95 | "syn 2.0.28",
96 | ]
97 |
98 | [[package]]
99 | name = "byteorder"
100 | version = "1.4.3"
101 | source = "registry+https://github.com/rust-lang/crates.io-index"
102 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
103 |
104 | [[package]]
105 | name = "cc"
106 | version = "1.0.79"
107 | source = "registry+https://github.com/rust-lang/crates.io-index"
108 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
109 |
110 | [[package]]
111 | name = "cfg-if"
112 | version = "1.0.0"
113 | source = "registry+https://github.com/rust-lang/crates.io-index"
114 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
115 |
116 | [[package]]
117 | name = "clap"
118 | version = "4.3.21"
119 | source = "registry+https://github.com/rust-lang/crates.io-index"
120 | checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd"
121 | dependencies = [
122 | "clap_builder",
123 | "clap_derive",
124 | "once_cell",
125 | ]
126 |
127 | [[package]]
128 | name = "clap_builder"
129 | version = "4.3.21"
130 | source = "registry+https://github.com/rust-lang/crates.io-index"
131 | checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa"
132 | dependencies = [
133 | "anstream",
134 | "anstyle",
135 | "clap_lex",
136 | "strsim",
137 | ]
138 |
139 | [[package]]
140 | name = "clap_derive"
141 | version = "4.3.12"
142 | source = "registry+https://github.com/rust-lang/crates.io-index"
143 | checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050"
144 | dependencies = [
145 | "heck",
146 | "proc-macro2",
147 | "quote",
148 | "syn 2.0.28",
149 | ]
150 |
151 | [[package]]
152 | name = "clap_lex"
153 | version = "0.5.0"
154 | source = "registry+https://github.com/rust-lang/crates.io-index"
155 | checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
156 |
157 | [[package]]
158 | name = "colorchoice"
159 | version = "1.0.0"
160 | source = "registry+https://github.com/rust-lang/crates.io-index"
161 | checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
162 |
163 | [[package]]
164 | name = "convert_case"
165 | version = "0.4.0"
166 | source = "registry+https://github.com/rust-lang/crates.io-index"
167 | checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
168 |
169 | [[package]]
170 | name = "crossbeam-channel"
171 | version = "0.5.8"
172 | source = "registry+https://github.com/rust-lang/crates.io-index"
173 | checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
174 | dependencies = [
175 | "cfg-if",
176 | "crossbeam-utils",
177 | ]
178 |
179 | [[package]]
180 | name = "crossbeam-deque"
181 | version = "0.8.3"
182 | source = "registry+https://github.com/rust-lang/crates.io-index"
183 | checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
184 | dependencies = [
185 | "cfg-if",
186 | "crossbeam-epoch",
187 | "crossbeam-utils",
188 | ]
189 |
190 | [[package]]
191 | name = "crossbeam-epoch"
192 | version = "0.9.15"
193 | source = "registry+https://github.com/rust-lang/crates.io-index"
194 | checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
195 | dependencies = [
196 | "autocfg",
197 | "cfg-if",
198 | "crossbeam-utils",
199 | "memoffset 0.9.0",
200 | "scopeguard",
201 | ]
202 |
203 | [[package]]
204 | name = "crossbeam-utils"
205 | version = "0.8.16"
206 | source = "registry+https://github.com/rust-lang/crates.io-index"
207 | checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
208 | dependencies = [
209 | "cfg-if",
210 | ]
211 |
212 | [[package]]
213 | name = "derive-getters"
214 | version = "0.3.0"
215 | source = "registry+https://github.com/rust-lang/crates.io-index"
216 | checksum = "7a2c35ab6e03642397cdda1dd58abbc05d418aef8e36297f336d5aba060fe8df"
217 | dependencies = [
218 | "proc-macro2",
219 | "quote",
220 | "syn 1.0.109",
221 | ]
222 |
223 | [[package]]
224 | name = "derive_more"
225 | version = "0.99.17"
226 | source = "registry+https://github.com/rust-lang/crates.io-index"
227 | checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
228 | dependencies = [
229 | "convert_case",
230 | "proc-macro2",
231 | "quote",
232 | "rustc_version",
233 | "syn 1.0.109",
234 | ]
235 |
236 | [[package]]
237 | name = "dlib"
238 | version = "0.5.2"
239 | source = "registry+https://github.com/rust-lang/crates.io-index"
240 | checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
241 | dependencies = [
242 | "libloading",
243 | ]
244 |
245 | [[package]]
246 | name = "downcast-rs"
247 | version = "1.2.0"
248 | source = "registry+https://github.com/rust-lang/crates.io-index"
249 | checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
250 |
251 | [[package]]
252 | name = "either"
253 | version = "1.9.0"
254 | source = "registry+https://github.com/rust-lang/crates.io-index"
255 | checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
256 |
257 | [[package]]
258 | name = "errno"
259 | version = "0.3.2"
260 | source = "registry+https://github.com/rust-lang/crates.io-index"
261 | checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f"
262 | dependencies = [
263 | "errno-dragonfly",
264 | "libc",
265 | "windows-sys",
266 | ]
267 |
268 | [[package]]
269 | name = "errno-dragonfly"
270 | version = "0.1.2"
271 | source = "registry+https://github.com/rust-lang/crates.io-index"
272 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
273 | dependencies = [
274 | "cc",
275 | "libc",
276 | ]
277 |
278 | [[package]]
279 | name = "fastrand"
280 | version = "2.0.0"
281 | source = "registry+https://github.com/rust-lang/crates.io-index"
282 | checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
283 |
284 | [[package]]
285 | name = "fnv"
286 | version = "1.0.7"
287 | source = "registry+https://github.com/rust-lang/crates.io-index"
288 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
289 |
290 | [[package]]
291 | name = "getrandom"
292 | version = "0.2.10"
293 | source = "registry+https://github.com/rust-lang/crates.io-index"
294 | checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
295 | dependencies = [
296 | "cfg-if",
297 | "libc",
298 | "wasi",
299 | ]
300 |
301 | [[package]]
302 | name = "heck"
303 | version = "0.4.1"
304 | source = "registry+https://github.com/rust-lang/crates.io-index"
305 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
306 |
307 | [[package]]
308 | name = "hermit-abi"
309 | version = "0.3.2"
310 | source = "registry+https://github.com/rust-lang/crates.io-index"
311 | checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
312 |
313 | [[package]]
314 | name = "io-lifetimes"
315 | version = "1.0.11"
316 | source = "registry+https://github.com/rust-lang/crates.io-index"
317 | checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
318 | dependencies = [
319 | "hermit-abi",
320 | "libc",
321 | "windows-sys",
322 | ]
323 |
324 | [[package]]
325 | name = "is-terminal"
326 | version = "0.4.9"
327 | source = "registry+https://github.com/rust-lang/crates.io-index"
328 | checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
329 | dependencies = [
330 | "hermit-abi",
331 | "rustix",
332 | "windows-sys",
333 | ]
334 |
335 | [[package]]
336 | name = "itertools"
337 | version = "0.11.0"
338 | source = "registry+https://github.com/rust-lang/crates.io-index"
339 | checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
340 | dependencies = [
341 | "either",
342 | ]
343 |
344 | [[package]]
345 | name = "lazy_static"
346 | version = "1.4.0"
347 | source = "registry+https://github.com/rust-lang/crates.io-index"
348 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
349 |
350 | [[package]]
351 | name = "libc"
352 | version = "0.2.147"
353 | source = "registry+https://github.com/rust-lang/crates.io-index"
354 | checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
355 |
356 | [[package]]
357 | name = "libloading"
358 | version = "0.8.0"
359 | source = "registry+https://github.com/rust-lang/crates.io-index"
360 | checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb"
361 | dependencies = [
362 | "cfg-if",
363 | "windows-sys",
364 | ]
365 |
366 | [[package]]
367 | name = "libm"
368 | version = "0.2.7"
369 | source = "registry+https://github.com/rust-lang/crates.io-index"
370 | checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4"
371 |
372 | [[package]]
373 | name = "linux-raw-sys"
374 | version = "0.4.5"
375 | source = "registry+https://github.com/rust-lang/crates.io-index"
376 | checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
377 |
378 | [[package]]
379 | name = "log"
380 | version = "0.4.19"
381 | source = "registry+https://github.com/rust-lang/crates.io-index"
382 | checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
383 |
384 | [[package]]
385 | name = "matrixmultiply"
386 | version = "0.3.7"
387 | source = "registry+https://github.com/rust-lang/crates.io-index"
388 | checksum = "090126dc04f95dc0d1c1c91f61bdd474b3930ca064c1edc8a849da2c6cbe1e77"
389 | dependencies = [
390 | "autocfg",
391 | "rawpointer",
392 | ]
393 |
394 | [[package]]
395 | name = "memchr"
396 | version = "2.5.0"
397 | source = "registry+https://github.com/rust-lang/crates.io-index"
398 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
399 |
400 | [[package]]
401 | name = "memoffset"
402 | version = "0.7.1"
403 | source = "registry+https://github.com/rust-lang/crates.io-index"
404 | checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
405 | dependencies = [
406 | "autocfg",
407 | ]
408 |
409 | [[package]]
410 | name = "memoffset"
411 | version = "0.9.0"
412 | source = "registry+https://github.com/rust-lang/crates.io-index"
413 | checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
414 | dependencies = [
415 | "autocfg",
416 | ]
417 |
418 | [[package]]
419 | name = "ndarray"
420 | version = "0.15.6"
421 | source = "registry+https://github.com/rust-lang/crates.io-index"
422 | checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32"
423 | dependencies = [
424 | "matrixmultiply",
425 | "num-complex",
426 | "num-integer",
427 | "num-traits",
428 | "rawpointer",
429 | ]
430 |
431 | [[package]]
432 | name = "ndarray-rand"
433 | version = "0.14.0"
434 | source = "registry+https://github.com/rust-lang/crates.io-index"
435 | checksum = "65608f937acc725f5b164dcf40f4f0bc5d67dc268ab8a649d3002606718c4588"
436 | dependencies = [
437 | "ndarray",
438 | "rand",
439 | "rand_distr",
440 | ]
441 |
442 | [[package]]
443 | name = "nix"
444 | version = "0.26.2"
445 | source = "registry+https://github.com/rust-lang/crates.io-index"
446 | checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a"
447 | dependencies = [
448 | "bitflags 1.3.2",
449 | "cfg-if",
450 | "libc",
451 | "memoffset 0.7.1",
452 | "static_assertions",
453 | ]
454 |
455 | [[package]]
456 | name = "num-complex"
457 | version = "0.4.3"
458 | source = "registry+https://github.com/rust-lang/crates.io-index"
459 | checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d"
460 | dependencies = [
461 | "num-traits",
462 | ]
463 |
464 | [[package]]
465 | name = "num-integer"
466 | version = "0.1.45"
467 | source = "registry+https://github.com/rust-lang/crates.io-index"
468 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
469 | dependencies = [
470 | "autocfg",
471 | "num-traits",
472 | ]
473 |
474 | [[package]]
475 | name = "num-traits"
476 | version = "0.2.16"
477 | source = "registry+https://github.com/rust-lang/crates.io-index"
478 | checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
479 | dependencies = [
480 | "autocfg",
481 | "libm",
482 | ]
483 |
484 | [[package]]
485 | name = "num_cpus"
486 | version = "1.16.0"
487 | source = "registry+https://github.com/rust-lang/crates.io-index"
488 | checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
489 | dependencies = [
490 | "hermit-abi",
491 | "libc",
492 | ]
493 |
494 | [[package]]
495 | name = "once_cell"
496 | version = "1.18.0"
497 | source = "registry+https://github.com/rust-lang/crates.io-index"
498 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
499 |
500 | [[package]]
501 | name = "optimal"
502 | version = "0.1.0"
503 | source = "git+https://github.com/justinlovinger/optimal-rs.git#2c1a65a7663ce822d625e1d03e1f764dde473a66"
504 | dependencies = [
505 | "blanket",
506 | "derive-getters",
507 | "derive_more",
508 | "lazy_static",
509 | "ndarray",
510 | "ndarray-rand",
511 | "num-traits",
512 | "once_cell",
513 | "paste",
514 | "rand",
515 | "rand_xoshiro",
516 | "replace_with",
517 | "streaming-iterator",
518 | "thiserror",
519 | ]
520 |
521 | [[package]]
522 | name = "owm"
523 | version = "0.1.0"
524 | dependencies = [
525 | "clap",
526 | "derive_more",
527 | "itertools",
528 | "ndarray",
529 | "num-traits",
530 | "once_cell",
531 | "optimal",
532 | "paste",
533 | "proptest",
534 | "rand",
535 | "rand_xoshiro",
536 | "rayon",
537 | "test-strategy",
538 | "thiserror",
539 | "wayland-client",
540 | "wayland-scanner",
541 | ]
542 |
543 | [[package]]
544 | name = "paste"
545 | version = "1.0.14"
546 | source = "registry+https://github.com/rust-lang/crates.io-index"
547 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
548 |
549 | [[package]]
550 | name = "pkg-config"
551 | version = "0.3.27"
552 | source = "registry+https://github.com/rust-lang/crates.io-index"
553 | checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
554 |
555 | [[package]]
556 | name = "ppv-lite86"
557 | version = "0.2.17"
558 | source = "registry+https://github.com/rust-lang/crates.io-index"
559 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
560 |
561 | [[package]]
562 | name = "proc-macro2"
563 | version = "1.0.66"
564 | source = "registry+https://github.com/rust-lang/crates.io-index"
565 | checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
566 | dependencies = [
567 | "unicode-ident",
568 | ]
569 |
570 | [[package]]
571 | name = "proptest"
572 | version = "1.2.0"
573 | source = "registry+https://github.com/rust-lang/crates.io-index"
574 | checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65"
575 | dependencies = [
576 | "bit-set",
577 | "bitflags 1.3.2",
578 | "byteorder",
579 | "lazy_static",
580 | "num-traits",
581 | "rand",
582 | "rand_chacha",
583 | "rand_xorshift",
584 | "regex-syntax",
585 | "rusty-fork",
586 | "tempfile",
587 | "unarray",
588 | ]
589 |
590 | [[package]]
591 | name = "quick-error"
592 | version = "1.2.3"
593 | source = "registry+https://github.com/rust-lang/crates.io-index"
594 | checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
595 |
596 | [[package]]
597 | name = "quick-xml"
598 | version = "0.28.2"
599 | source = "registry+https://github.com/rust-lang/crates.io-index"
600 | checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1"
601 | dependencies = [
602 | "memchr",
603 | ]
604 |
605 | [[package]]
606 | name = "quote"
607 | version = "1.0.32"
608 | source = "registry+https://github.com/rust-lang/crates.io-index"
609 | checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
610 | dependencies = [
611 | "proc-macro2",
612 | ]
613 |
614 | [[package]]
615 | name = "rand"
616 | version = "0.8.5"
617 | source = "registry+https://github.com/rust-lang/crates.io-index"
618 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
619 | dependencies = [
620 | "libc",
621 | "rand_chacha",
622 | "rand_core",
623 | ]
624 |
625 | [[package]]
626 | name = "rand_chacha"
627 | version = "0.3.1"
628 | source = "registry+https://github.com/rust-lang/crates.io-index"
629 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
630 | dependencies = [
631 | "ppv-lite86",
632 | "rand_core",
633 | ]
634 |
635 | [[package]]
636 | name = "rand_core"
637 | version = "0.6.4"
638 | source = "registry+https://github.com/rust-lang/crates.io-index"
639 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
640 | dependencies = [
641 | "getrandom",
642 | ]
643 |
644 | [[package]]
645 | name = "rand_distr"
646 | version = "0.4.3"
647 | source = "registry+https://github.com/rust-lang/crates.io-index"
648 | checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31"
649 | dependencies = [
650 | "num-traits",
651 | "rand",
652 | ]
653 |
654 | [[package]]
655 | name = "rand_xorshift"
656 | version = "0.3.0"
657 | source = "registry+https://github.com/rust-lang/crates.io-index"
658 | checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
659 | dependencies = [
660 | "rand_core",
661 | ]
662 |
663 | [[package]]
664 | name = "rand_xoshiro"
665 | version = "0.6.0"
666 | source = "registry+https://github.com/rust-lang/crates.io-index"
667 | checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
668 | dependencies = [
669 | "rand_core",
670 | ]
671 |
672 | [[package]]
673 | name = "rawpointer"
674 | version = "0.2.1"
675 | source = "registry+https://github.com/rust-lang/crates.io-index"
676 | checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
677 |
678 | [[package]]
679 | name = "rayon"
680 | version = "1.7.0"
681 | source = "registry+https://github.com/rust-lang/crates.io-index"
682 | checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
683 | dependencies = [
684 | "either",
685 | "rayon-core",
686 | ]
687 |
688 | [[package]]
689 | name = "rayon-core"
690 | version = "1.11.0"
691 | source = "registry+https://github.com/rust-lang/crates.io-index"
692 | checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
693 | dependencies = [
694 | "crossbeam-channel",
695 | "crossbeam-deque",
696 | "crossbeam-utils",
697 | "num_cpus",
698 | ]
699 |
700 | [[package]]
701 | name = "redox_syscall"
702 | version = "0.3.5"
703 | source = "registry+https://github.com/rust-lang/crates.io-index"
704 | checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
705 | dependencies = [
706 | "bitflags 1.3.2",
707 | ]
708 |
709 | [[package]]
710 | name = "regex-syntax"
711 | version = "0.6.29"
712 | source = "registry+https://github.com/rust-lang/crates.io-index"
713 | checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
714 |
715 | [[package]]
716 | name = "replace_with"
717 | version = "0.1.7"
718 | source = "registry+https://github.com/rust-lang/crates.io-index"
719 | checksum = "e3a8614ee435691de62bcffcf4a66d91b3594bf1428a5722e79103249a095690"
720 |
721 | [[package]]
722 | name = "rustc_version"
723 | version = "0.4.0"
724 | source = "registry+https://github.com/rust-lang/crates.io-index"
725 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
726 | dependencies = [
727 | "semver",
728 | ]
729 |
730 | [[package]]
731 | name = "rustix"
732 | version = "0.38.6"
733 | source = "registry+https://github.com/rust-lang/crates.io-index"
734 | checksum = "1ee020b1716f0a80e2ace9b03441a749e402e86712f15f16fe8a8f75afac732f"
735 | dependencies = [
736 | "bitflags 2.3.3",
737 | "errno",
738 | "libc",
739 | "linux-raw-sys",
740 | "windows-sys",
741 | ]
742 |
743 | [[package]]
744 | name = "rusty-fork"
745 | version = "0.3.0"
746 | source = "registry+https://github.com/rust-lang/crates.io-index"
747 | checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f"
748 | dependencies = [
749 | "fnv",
750 | "quick-error",
751 | "tempfile",
752 | "wait-timeout",
753 | ]
754 |
755 | [[package]]
756 | name = "scoped-tls"
757 | version = "1.0.1"
758 | source = "registry+https://github.com/rust-lang/crates.io-index"
759 | checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
760 |
761 | [[package]]
762 | name = "scopeguard"
763 | version = "1.2.0"
764 | source = "registry+https://github.com/rust-lang/crates.io-index"
765 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
766 |
767 | [[package]]
768 | name = "semver"
769 | version = "1.0.18"
770 | source = "registry+https://github.com/rust-lang/crates.io-index"
771 | checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
772 |
773 | [[package]]
774 | name = "smallvec"
775 | version = "1.11.0"
776 | source = "registry+https://github.com/rust-lang/crates.io-index"
777 | checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
778 |
779 | [[package]]
780 | name = "static_assertions"
781 | version = "1.1.0"
782 | source = "registry+https://github.com/rust-lang/crates.io-index"
783 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
784 |
785 | [[package]]
786 | name = "streaming-iterator"
787 | version = "0.1.9"
788 | source = "registry+https://github.com/rust-lang/crates.io-index"
789 | checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520"
790 |
791 | [[package]]
792 | name = "strsim"
793 | version = "0.10.0"
794 | source = "registry+https://github.com/rust-lang/crates.io-index"
795 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
796 |
797 | [[package]]
798 | name = "structmeta"
799 | version = "0.2.0"
800 | source = "registry+https://github.com/rust-lang/crates.io-index"
801 | checksum = "78ad9e09554f0456d67a69c1584c9798ba733a5b50349a6c0d0948710523922d"
802 | dependencies = [
803 | "proc-macro2",
804 | "quote",
805 | "structmeta-derive",
806 | "syn 2.0.28",
807 | ]
808 |
809 | [[package]]
810 | name = "structmeta-derive"
811 | version = "0.2.0"
812 | source = "registry+https://github.com/rust-lang/crates.io-index"
813 | checksum = "a60bcaff7397072dca0017d1db428e30d5002e00b6847703e2e42005c95fbe00"
814 | dependencies = [
815 | "proc-macro2",
816 | "quote",
817 | "syn 2.0.28",
818 | ]
819 |
820 | [[package]]
821 | name = "syn"
822 | version = "1.0.109"
823 | source = "registry+https://github.com/rust-lang/crates.io-index"
824 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
825 | dependencies = [
826 | "proc-macro2",
827 | "quote",
828 | "unicode-ident",
829 | ]
830 |
831 | [[package]]
832 | name = "syn"
833 | version = "2.0.28"
834 | source = "registry+https://github.com/rust-lang/crates.io-index"
835 | checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567"
836 | dependencies = [
837 | "proc-macro2",
838 | "quote",
839 | "unicode-ident",
840 | ]
841 |
842 | [[package]]
843 | name = "tempfile"
844 | version = "3.7.0"
845 | source = "registry+https://github.com/rust-lang/crates.io-index"
846 | checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998"
847 | dependencies = [
848 | "cfg-if",
849 | "fastrand",
850 | "redox_syscall",
851 | "rustix",
852 | "windows-sys",
853 | ]
854 |
855 | [[package]]
856 | name = "test-strategy"
857 | version = "0.3.1"
858 | source = "registry+https://github.com/rust-lang/crates.io-index"
859 | checksum = "b8361c808554228ad09bfed70f5c823caf8a3450b6881cc3a38eb57e8c08c1d9"
860 | dependencies = [
861 | "proc-macro2",
862 | "quote",
863 | "structmeta",
864 | "syn 2.0.28",
865 | ]
866 |
867 | [[package]]
868 | name = "thiserror"
869 | version = "1.0.46"
870 | source = "registry+https://github.com/rust-lang/crates.io-index"
871 | checksum = "d9207952ae1a003f42d3d5e892dac3c6ba42aa6ac0c79a6a91a2b5cb4253e75c"
872 | dependencies = [
873 | "thiserror-impl",
874 | ]
875 |
876 | [[package]]
877 | name = "thiserror-impl"
878 | version = "1.0.46"
879 | source = "registry+https://github.com/rust-lang/crates.io-index"
880 | checksum = "f1728216d3244de4f14f14f8c15c79be1a7c67867d28d69b719690e2a19fb445"
881 | dependencies = [
882 | "proc-macro2",
883 | "quote",
884 | "syn 2.0.28",
885 | ]
886 |
887 | [[package]]
888 | name = "unarray"
889 | version = "0.1.4"
890 | source = "registry+https://github.com/rust-lang/crates.io-index"
891 | checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94"
892 |
893 | [[package]]
894 | name = "unicode-ident"
895 | version = "1.0.11"
896 | source = "registry+https://github.com/rust-lang/crates.io-index"
897 | checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
898 |
899 | [[package]]
900 | name = "utf8parse"
901 | version = "0.2.1"
902 | source = "registry+https://github.com/rust-lang/crates.io-index"
903 | checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
904 |
905 | [[package]]
906 | name = "wait-timeout"
907 | version = "0.2.0"
908 | source = "registry+https://github.com/rust-lang/crates.io-index"
909 | checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
910 | dependencies = [
911 | "libc",
912 | ]
913 |
914 | [[package]]
915 | name = "wasi"
916 | version = "0.11.0+wasi-snapshot-preview1"
917 | source = "registry+https://github.com/rust-lang/crates.io-index"
918 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
919 |
920 | [[package]]
921 | name = "wayland-backend"
922 | version = "0.1.2"
923 | source = "registry+https://github.com/rust-lang/crates.io-index"
924 | checksum = "41b48e27457e8da3b2260ac60d0a94512f5cba36448679f3747c0865b7893ed8"
925 | dependencies = [
926 | "cc",
927 | "downcast-rs",
928 | "io-lifetimes",
929 | "nix",
930 | "scoped-tls",
931 | "smallvec",
932 | "wayland-sys",
933 | ]
934 |
935 | [[package]]
936 | name = "wayland-client"
937 | version = "0.30.2"
938 | source = "registry+https://github.com/rust-lang/crates.io-index"
939 | checksum = "489c9654770f674fc7e266b3c579f4053d7551df0ceb392f153adb1f9ed06ac8"
940 | dependencies = [
941 | "bitflags 1.3.2",
942 | "nix",
943 | "wayland-backend",
944 | "wayland-scanner",
945 | ]
946 |
947 | [[package]]
948 | name = "wayland-scanner"
949 | version = "0.30.1"
950 | source = "registry+https://github.com/rust-lang/crates.io-index"
951 | checksum = "b9b873b257fbc32ec909c0eb80dea312076a67014e65e245f5eb69a6b8ab330e"
952 | dependencies = [
953 | "proc-macro2",
954 | "quick-xml",
955 | "quote",
956 | ]
957 |
958 | [[package]]
959 | name = "wayland-sys"
960 | version = "0.30.1"
961 | source = "registry+https://github.com/rust-lang/crates.io-index"
962 | checksum = "96b2a02ac608e07132978689a6f9bf4214949c85998c247abadd4f4129b1aa06"
963 | dependencies = [
964 | "dlib",
965 | "log",
966 | "pkg-config",
967 | ]
968 |
969 | [[package]]
970 | name = "windows-sys"
971 | version = "0.48.0"
972 | source = "registry+https://github.com/rust-lang/crates.io-index"
973 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
974 | dependencies = [
975 | "windows-targets",
976 | ]
977 |
978 | [[package]]
979 | name = "windows-targets"
980 | version = "0.48.1"
981 | source = "registry+https://github.com/rust-lang/crates.io-index"
982 | checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
983 | dependencies = [
984 | "windows_aarch64_gnullvm",
985 | "windows_aarch64_msvc",
986 | "windows_i686_gnu",
987 | "windows_i686_msvc",
988 | "windows_x86_64_gnu",
989 | "windows_x86_64_gnullvm",
990 | "windows_x86_64_msvc",
991 | ]
992 |
993 | [[package]]
994 | name = "windows_aarch64_gnullvm"
995 | version = "0.48.0"
996 | source = "registry+https://github.com/rust-lang/crates.io-index"
997 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
998 |
999 | [[package]]
1000 | name = "windows_aarch64_msvc"
1001 | version = "0.48.0"
1002 | source = "registry+https://github.com/rust-lang/crates.io-index"
1003 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
1004 |
1005 | [[package]]
1006 | name = "windows_i686_gnu"
1007 | version = "0.48.0"
1008 | source = "registry+https://github.com/rust-lang/crates.io-index"
1009 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
1010 |
1011 | [[package]]
1012 | name = "windows_i686_msvc"
1013 | version = "0.48.0"
1014 | source = "registry+https://github.com/rust-lang/crates.io-index"
1015 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
1016 |
1017 | [[package]]
1018 | name = "windows_x86_64_gnu"
1019 | version = "0.48.0"
1020 | source = "registry+https://github.com/rust-lang/crates.io-index"
1021 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
1022 |
1023 | [[package]]
1024 | name = "windows_x86_64_gnullvm"
1025 | version = "0.48.0"
1026 | source = "registry+https://github.com/rust-lang/crates.io-index"
1027 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
1028 |
1029 | [[package]]
1030 | name = "windows_x86_64_msvc"
1031 | version = "0.48.0"
1032 | source = "registry+https://github.com/rust-lang/crates.io-index"
1033 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
1034 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "owm"
3 | version = "0.1.0"
4 | edition = "2021"
5 | authors = ["Justin Lovinger"]
6 | description = "An experimental River layout generator using mathematical optimization to invent layouts on-the-fly"
7 | repository = "https://github.com/justinlovinger/owm"
8 | readme = "README.md"
9 | keywords = ["optimization", "river", "window-manager"]
10 | categories = ["command-line-utilities"]
11 | license = "MIT"
12 |
13 | [profile.dev]
14 | # Generating layouts is significantly slower than compiling.
15 | opt-level = 3
16 |
17 | [profile.test]
18 | opt-level = 0
19 |
20 | [dependencies]
21 | clap = { version = "4.3.21", features = ["derive"] }
22 | derive_more = "0.99.17"
23 | itertools = "0.11.0"
24 | ndarray = "0.15.6"
25 | num-traits = "0.2.16"
26 | once_cell = "1.18.0"
27 | optimal = { git = "https://github.com/justinlovinger/optimal-rs.git" }
28 | paste = "1.0.14"
29 | rand = "0.8.5"
30 | rand_xoshiro = "0.6.0"
31 | rayon = "1.7.0"
32 | thiserror = "1.0.46"
33 | wayland-client = "0.30.2"
34 | wayland-scanner = "0.30.1"
35 |
36 | [dev-dependencies]
37 | proptest = "1.2.0"
38 | test-strategy = "0.3.1"
39 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2023 Justin Lovinger
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included
12 | in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://github.com/justinlovinger/owm/actions?query=workflow%3A%22build%22)
2 |
3 | # owm
4 |
5 | An experimental [River](https://github.com/riverwm/river) layout generator
6 | using mathematical optimization
7 | to invent layouts
8 | on-the-fly.
9 |
10 | ## Building
11 |
12 | Run `cargo build --release` or `nix build`.
13 |
14 | ## Usage
15 |
16 | Add
17 |
18 | ```
19 | riverctl default-layout owm
20 | owm &
21 | ```
22 |
23 | to your River `init`.
24 |
25 | See `owm --help` for configuration options.
26 |
--------------------------------------------------------------------------------
/default.nix:
--------------------------------------------------------------------------------
1 | (import (
2 | fetchTarball {
3 | url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
4 | sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
5 | ) {
6 | src = ./.;
7 | }).defaultNix
8 |
--------------------------------------------------------------------------------
/flake.lock:
--------------------------------------------------------------------------------
1 | {
2 | "nodes": {
3 | "naersk": {
4 | "inputs": {
5 | "nixpkgs": "nixpkgs"
6 | },
7 | "locked": {
8 | "lastModified": 1690373729,
9 | "narHash": "sha256-e136hTT7LqQ2QjOTZQMW+jnsevWwBpMj78u6FRUsH9I=",
10 | "owner": "nix-community",
11 | "repo": "naersk",
12 | "rev": "d9a33d69a9c421d64c8d925428864e93be895dcc",
13 | "type": "github"
14 | },
15 | "original": {
16 | "owner": "nix-community",
17 | "ref": "master",
18 | "repo": "naersk",
19 | "type": "github"
20 | }
21 | },
22 | "nixpkgs": {
23 | "locked": {
24 | "lastModified": 1690593349,
25 | "narHash": "sha256-i6jdORO+YiP19pFNeR7oYIIwmzQvdxwNO+BmtATcYpA=",
26 | "owner": "NixOS",
27 | "repo": "nixpkgs",
28 | "rev": "11cf5e1c74fe6892e860afeeaf3bfb84fdb7b1c3",
29 | "type": "github"
30 | },
31 | "original": {
32 | "id": "nixpkgs",
33 | "type": "indirect"
34 | }
35 | },
36 | "nixpkgs_2": {
37 | "locked": {
38 | "lastModified": 1690593349,
39 | "narHash": "sha256-i6jdORO+YiP19pFNeR7oYIIwmzQvdxwNO+BmtATcYpA=",
40 | "owner": "NixOS",
41 | "repo": "nixpkgs",
42 | "rev": "11cf5e1c74fe6892e860afeeaf3bfb84fdb7b1c3",
43 | "type": "github"
44 | },
45 | "original": {
46 | "owner": "NixOS",
47 | "ref": "nixpkgs-unstable",
48 | "repo": "nixpkgs",
49 | "type": "github"
50 | }
51 | },
52 | "root": {
53 | "inputs": {
54 | "naersk": "naersk",
55 | "nixpkgs": "nixpkgs_2",
56 | "utils": "utils"
57 | }
58 | },
59 | "systems": {
60 | "locked": {
61 | "lastModified": 1681028828,
62 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
63 | "owner": "nix-systems",
64 | "repo": "default",
65 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
66 | "type": "github"
67 | },
68 | "original": {
69 | "owner": "nix-systems",
70 | "repo": "default",
71 | "type": "github"
72 | }
73 | },
74 | "utils": {
75 | "inputs": {
76 | "systems": "systems"
77 | },
78 | "locked": {
79 | "lastModified": 1689068808,
80 | "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
81 | "owner": "numtide",
82 | "repo": "flake-utils",
83 | "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
84 | "type": "github"
85 | },
86 | "original": {
87 | "owner": "numtide",
88 | "repo": "flake-utils",
89 | "type": "github"
90 | }
91 | }
92 | },
93 | "root": "root",
94 | "version": 7
95 | }
96 |
--------------------------------------------------------------------------------
/flake.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs = {
3 | naersk.url = "github:nix-community/naersk/master";
4 | nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5 | utils.url = "github:numtide/flake-utils";
6 | };
7 |
8 | outputs = {
9 | self,
10 | naersk,
11 | nixpkgs,
12 | utils,
13 | }:
14 | utils.lib.eachDefaultSystem (system: let
15 | pkgs = import nixpkgs {inherit system;};
16 | naersk-lib = pkgs.callPackage naersk {};
17 | in {
18 | defaultPackage = naersk-lib.buildPackage {
19 | src = ./.;
20 | doCheck = true;
21 | };
22 | devShell = with pkgs;
23 | mkShell {
24 | buildInputs = [
25 | cargo
26 | rust-analyzer
27 | rustc
28 | rustfmt
29 | rustPackages.clippy
30 | ];
31 | RUST_SRC_PATH = rustPlatform.rustLibSrc;
32 | PROPTEST_DISABLE_FAILURE_PERSISTENCE = 1;
33 | };
34 | });
35 | }
36 |
--------------------------------------------------------------------------------
/protocols/river-control-unstable-v1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Copyright 2020 The River Developers
5 |
6 | Permission to use, copy, modify, and/or distribute this software for any
7 | purpose with or without fee is hereby granted, provided that the above
8 | copyright notice and this permission notice appear in all copies.
9 |
10 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 |
18 |
19 |
20 |
21 | This interface allows clients to run compositor commands and receive a
22 | success/failure response with output or a failure message respectively.
23 |
24 | Each command is built up in a series of add_argument requests and
25 | executed with a run_command request. The first argument is the command
26 | to be run.
27 |
28 | A complete list of commands should be made available in the man page of
29 | the compositor.
30 |
31 |
32 |
33 |
34 | This request indicates that the client will not use the
35 | river_control object any more. Objects that have been created
36 | through this instance are not affected.
37 |
38 |
39 |
40 |
41 |
42 | Arguments are stored by the server in the order they were sent until
43 | the run_command request is made.
44 |
45 |
46 |
47 |
48 |
49 |
50 | Execute the command built up using the add_argument request for the
51 | given seat.
52 |
53 |
54 |
56 |
57 |
58 |
59 |
60 |
61 | This object is created by the run_command request. Exactly one of the
62 | success or failure events will be sent. This object will be destroyed
63 | by the compositor after one of the events is sent.
64 |
65 |
66 |
67 |
68 | Sent when the command has been successfully received and executed by
69 | the compositor. Some commands may produce output, in which case the
70 | output argument will be a non-empty string.
71 |
72 |
73 |
74 |
75 |
76 |
77 | Sent when the command could not be carried out. This could be due to
78 | sending a non-existent command, no command, not enough arguments, too
79 | many arguments, invalid arguments, etc.
80 |
81 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/protocols/river-layout-v3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Copyright 2020-2021 The River Developers
5 |
6 | Permission to use, copy, modify, and/or distribute this software for any
7 | purpose with or without fee is hereby granted, provided that the above
8 | copyright notice and this permission notice appear in all copies.
9 |
10 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 |
18 |
19 |
20 | This protocol specifies a way for clients to propose arbitrary positions
21 | and dimensions for a set of views on a specific output of a compositor
22 | through the river_layout_v3 object.
23 |
24 | Layouts are a strictly linear list of views, the position and dimensions
25 | of which are supplied by the client. Any complex underlying data structure
26 | a client may use when generating the layout is lost in transmission. This
27 | is an intentional limitation.
28 |
29 | Additionally, this protocol allows the compositor to deliver arbitrary
30 | user-provided commands associated with a layout to clients. A client
31 | may use these commands to implement runtime configuration/control, or
32 | may ignore them entirely. How the user provides these commands to the
33 | compositor is not specified by this protocol and left to compositor policy.
34 |
35 | Warning! The protocol described in this file is currently in the
36 | testing phase. Backward compatible changes may be added together with
37 | the corresponding interface version bump. Backward incompatible changes
38 | can only be done by creating a new major version of the extension.
39 |
40 |
41 |
42 |
43 | A global factory for river_layout_v3 objects.
44 |
45 |
46 |
47 |
48 | This request indicates that the client will not use the
49 | river_layout_manager object any more. Objects that have been created
50 | through this instance are not affected.
51 |
52 |
53 |
54 |
55 |
56 | This creates a new river_layout_v3 object for the given wl_output.
57 |
58 | All layout related communication is done through this interface.
59 |
60 | The namespace is used by the compositor to decide which river_layout_v3
61 | object will receive layout demands for the output.
62 |
63 | The namespace is required to be be unique per-output. Furthermore,
64 | two separate clients may not share a namespace on separate outputs. If
65 | these conditions are not upheld, the the namespace_in_use event will
66 | be sent directly after creation of the river_layout_v3 object.
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | This interface allows clients to receive layout demands from the
77 | compositor for a specific output and subsequently propose positions and
78 | dimensions of individual views.
79 |
80 |
81 |
82 |
84 |
86 |
87 |
88 |
89 |
90 | This request indicates that the client will not use the river_layout_v3
91 | object any more.
92 |
93 |
94 |
95 |
96 |
97 | After this event is sent, all requests aside from the destroy event
98 | will be ignored by the server. If the client wishes to try again with
99 | a different namespace they must create a new river_layout_v3 object.
100 |
101 |
102 |
103 |
104 |
105 | The compositor sends this event to inform the client that it requires a
106 | layout for a set of views.
107 |
108 | The usable width and height indicate the space in which the client
109 | can safely position views without interfering with desktop widgets
110 | such as panels.
111 |
112 | The serial of this event is used to identify subsequent requests as
113 | belonging to this layout demand. Beware that the client might need
114 | to handle multiple layout demands at the same time.
115 |
116 | The server will ignore responses to all but the most recent layout
117 | demand. Thus, clients are only required to respond to the most recent
118 | layout_demand received. If a newer layout_demand is received before
119 | the client has finished responding to an old demand, the client should
120 | abort work on the old demand as any further work would be wasted.
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 | This request proposes a size and position for a view in the layout demand
132 | with matching serial.
133 |
134 | A client must send this request for every view that is part of the
135 | layout demand. The number of views in the layout is given by the
136 | view_count argument of the layout_demand event. Pushing too many or
137 | too few view dimensions is a protocol error.
138 |
139 | The x and y coordinates are relative to the usable area of the output,
140 | with (0,0) as the top left corner.
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 | This request indicates that the client is done pushing dimensions
152 | and the compositor may apply the layout. This completes the layout
153 | demand with matching serial, any other requests sent with the serial
154 | are a protocol error.
155 |
156 | The layout_name argument is a user-facing name or short description
157 | of the layout that is being committed. The compositor may for example
158 | display this on a status bar, though what exactly is done with it is
159 | left to the compositor's discretion.
160 |
161 | The compositor is free to use this proposed layout however it chooses,
162 | including ignoring it.
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 | This event informs the client of a command sent to it by the user.
171 |
172 | The semantic meaning of the command is left for the client to
173 | decide. It is also free to ignore it entirely if it so chooses.
174 |
175 | A layout_demand will be sent after this event if the compositor is
176 | currently using this layout object to arrange the output.
177 |
178 | If version 2 or higher of the river_layout_v3 object is bound, the
179 | user_command_tags event is guaranteed to be sent directly before the
180 | user_command event.
181 |
182 |
183 |
184 |
185 |
186 |
187 | If version 2 or higher of the river_layout_v3 object is bound, this
188 | event will be sent directly before every user_command event. This allows
189 | layout generators to be aware of the active tags when a user command is
190 | sent. This is necessary for generators wanting to keep settings on a
191 | per-tag basis.
192 |
193 |
194 |
195 |
196 |
197 |
--------------------------------------------------------------------------------
/shell.nix:
--------------------------------------------------------------------------------
1 | (import (
2 | fetchTarball {
3 | url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
4 | sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
5 | ) {
6 | src = ./.;
7 | }).shellNix
8 |
--------------------------------------------------------------------------------
/src/bin/owm.rs:
--------------------------------------------------------------------------------
1 | use std::num::NonZeroUsize;
2 | use std::str::FromStr;
3 | use std::sync::{Arc, Mutex};
4 |
5 | use clap::Parser;
6 | use owm::{AreaRatio, AspectRatio, LayoutGen, Size, Status, Weight, Weights};
7 | use wayland_client::protocol::wl_seat::WlSeat;
8 | use wayland_client::Connection;
9 | use wayland_client::{
10 | backend::ObjectId,
11 | protocol::{
12 | wl_output::{self, WlOutput},
13 | wl_registry::{self, WlRegistry},
14 | },
15 | Dispatch, Proxy,
16 | };
17 |
18 | use crate::protocol::{
19 | river_layout_manager_v3::RiverLayoutManagerV3,
20 | river_layout_v3::{self, RiverLayoutV3},
21 | zriver_command_callback_v1::ZriverCommandCallbackV1,
22 | zriver_control_v1::ZriverControlV1,
23 | };
24 |
25 | #[derive(Parser)]
26 | #[clap(author, version, about, long_about = None)]
27 | struct Args {
28 | /// River namespace for this instance of the layout generator.
29 | /// Multiple instances can run simultaneously
30 | /// using different namespaces.
31 | /// Instances can be switched between
32 | /// using `riverctl default-layout NAMESPACE`
33 | /// or `riverctl output-layout NAMESPACE`.
34 | #[arg(long, value_name = "NAMESPACE", default_value = "owm")]
35 | namespace: String,
36 |
37 | #[arg(long, value_name = "NON_ZERO_UINT", default_value_t = NonZeroUsize::new(320).unwrap())]
38 | min_width: NonZeroUsize,
39 |
40 | #[arg(long, value_name = "NON_ZERO_UINT", default_value_t = NonZeroUsize::new(180).unwrap())]
41 | min_height: NonZeroUsize,
42 |
43 | #[arg(long, value_name = "NON_ZERO_UINT", value_parser = non_zero_usize_option_parser, default_value = "1920")]
44 | max_width: std::option::Option,
45 |
46 | #[arg(long, value_name = "NON_ZERO_UINT", value_parser = non_zero_usize_option_parser, default_value = "")]
47 | max_height: std::option::Option,
48 |
49 | /// Set to border thickness
50 | /// to fully overlap borders.
51 | #[arg(long, value_name = "UINT", default_value = "0")]
52 | overlap_borders_by: usize,
53 |
54 | /// Importance of "minimize gaps" objective.
55 | #[arg(long, value_name = "WEIGHT", default_value_t = Weight::new(5.0).unwrap())]
56 | gaps_weight: Weight,
57 |
58 | /// Importance of "minimize overlap" objective.
59 | #[arg(long, value_name = "WEIGHT", default_value_t = Weight::new(6.0).unwrap())]
60 | overlap_weight: Weight,
61 |
62 | /// Desired area ratios between each window and the next.
63 | ///
64 | /// Values are comma-separated.
65 | /// Last value is repeated for further pairs.
66 | /// Each value must be >= 1.
67 | #[arg(
68 | long,
69 | value_name = "RATIOS",
70 | value_delimiter = ',',
71 | default_value = "3,2,1"
72 | )]
73 | area_ratios: Vec,
74 |
75 | /// Importance of "maintain area ratios" objective.
76 | #[arg(long, value_name = "WEIGHT", default_value_t = Weight::new(1.5).unwrap())]
77 | area_ratios_weight: Weight,
78 |
79 | /// Desired aspect ratios of windows.
80 | ///
81 | /// Values are comma-separated.
82 | /// Last value is repeated for further windows.
83 | /// Each value must be > 0.
84 | #[arg(
85 | long,
86 | value_name = "RATIOS",
87 | value_delimiter = ',',
88 | default_value = "1.77777"
89 | )]
90 | aspect_ratios: Vec,
91 |
92 | /// Importance of "maintain aspect ratios" objective.
93 | #[arg(long, value_name = "WEIGHT", default_value_t = Weight::new(3.0).unwrap())]
94 | aspect_ratios_weight: Weight,
95 |
96 | /// Importance of "place adjacent close" objective.
97 | #[arg(long, value_name = "WEIGHT", default_value_t = Weight::new(0.5).unwrap())]
98 | adjacent_close_weight: Weight,
99 |
100 | /// Importance of "place in reading order" objective.
101 | #[arg(long, value_name = "WEIGHT", default_value_t = Weight::new(0.5).unwrap())]
102 | reading_order_weight: Weight,
103 |
104 | /// Importance of "center main" objective.
105 | #[arg(long, value_name = "WEIGHT", default_value_t = Weight::new(1.5).unwrap())]
106 | center_main_weight: Weight,
107 |
108 | /// Importance of keeping layout consistent
109 | /// from one number of windows
110 | /// to the next.
111 | #[arg(long, value_name = "WEIGHT", default_value_t = Weight::new(1.0).unwrap())]
112 | consistency_weight: Weight,
113 | }
114 |
115 | fn non_zero_usize_option_parser(
116 | s: &str,
117 | ) -> Result