mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2026-06-22 07:52:43 +00:00
Compare commits
605 Commits
legacy
..
ec345a0c41
| Author | SHA1 | Date | |
|---|---|---|---|
| ec345a0c41 | |||
| 01ac7fe533 | |||
| 284a7a8fdf | |||
| 162d2d3aaf | |||
| 7dd8eef128 | |||
| 1d16e63d46 | |||
| 927ed93711 | |||
| 938cd817a4 | |||
| eae3d7ec62 | |||
| 739b1df535 | |||
| a8e93dcc1b | |||
| eccf2288de | |||
| 3af96163a7 | |||
| 5ba8f3ced8 | |||
| 609c4d63a7 | |||
| 585949952f | |||
| cd083aa858 | |||
| 8f5f22eb4f | |||
| 9be77b2925 | |||
| 50c6a46c35 | |||
| 83b68bee53 | |||
| 61d5f3c503 | |||
| 1c3bb1cae6 | |||
| 94b8bb3666 | |||
| fd664f946d | |||
| 38d814e1b0 | |||
| 285921afe4 | |||
| 3b4043eb14 | |||
| 7f227a0fac | |||
| 2003c92c16 | |||
| daa3981969 | |||
| 9f5193c17a | |||
| 8ba6ccd823 | |||
| 93523c00fb | |||
| 9137f21d74 | |||
| 7d54a01970 | |||
| 4df7dc7376 | |||
| ca28e6d2d8 | |||
| 955e7dec32 | |||
| 667c0fbdbe | |||
| 4f98041841 | |||
| 77b45273bf | |||
| e0999c504b | |||
| b0de2fb715 | |||
| 5cf233eb6f | |||
| 6526ab79a4 | |||
| e3476de87f | |||
| dd4dfcb71e | |||
| 9356baf802 | |||
| 06571a92bf | |||
| a90f5b63ad | |||
| 813b425117 | |||
| 8d27630729 | |||
| 2aa64763fb | |||
| 7e3e98dd7a | |||
| da47561153 | |||
| 2b67e1111d | |||
| d14cf82c6e | |||
| 2e5748edfe | |||
| 4d0bfa66b4 | |||
| 27b00008cb | |||
| 7d0de9d9a8 | |||
| 9397519870 | |||
| f1ed83eaeb | |||
| 07fe3cf50e | |||
| edf971c08c | |||
| 0ccbc9b73b | |||
| c01728c629 | |||
| 268bee3cee | |||
| 9cce9a2ca5 | |||
| 5e6df4bdb2 | |||
| 97be2a869d | |||
| 75ddb1b2c2 | |||
| e4b2e9112c | |||
| 2eda9f1f5f | |||
| dfb7ae3bbd | |||
| 28e8282191 | |||
| 5f6ffb8161 | |||
| 2d590d0ecd | |||
| 48c0f85947 | |||
| 32a21e2261 | |||
| 919741ee19 | |||
| f24e98a304 | |||
| be20c2de0e | |||
| a727409aca | |||
| 4a869141fa | |||
| 9d5c84d2b0 | |||
| ff8105d1d2 | |||
| e92e2ebbe0 | |||
| a87342897a | |||
| 9d90b0ac9d | |||
| 7d997b2b83 | |||
| 078d201431 | |||
| e85e1a7af7 | |||
| 9ac9bad1af | |||
| fb94ea5fd4 | |||
| 481477cbe5 | |||
| d4dc85dbe8 | |||
| bfdd644ffe | |||
| 6b4729e357 | |||
| 9963c556ef | |||
| 9e12e39f66 | |||
| d8c1f707cc | |||
| af8902cb15 | |||
| 6bbc99d458 | |||
| e930381da3 | |||
| 5a4093475b | |||
| 2c4ea1e4aa | |||
| da2f40c982 | |||
| 6770813364 | |||
| 9824f0429a | |||
| f87556707d | |||
| 72c5d436ab | |||
| 9477154cc2 | |||
| 5035fb9a35 | |||
| 2cd54ba5fb | |||
| b279ebde1c | |||
| af2391cb80 | |||
| 3c43c107ca | |||
| 5e744ae3ff | |||
| 45dbbf1c54 | |||
| 4e476edc87 | |||
| 8fe8bd5d65 | |||
| b8a5bf5142 | |||
| e7752b138a | |||
| abf142827c | |||
| 494baec5b1 | |||
| ae2ed4649a | |||
| 3880dd0fe4 | |||
| 038f3012a5 | |||
| 3a0b856848 | |||
| 092fa93acd | |||
| 7da37262f1 | |||
| 620e0ca35a | |||
| 9dc4bb37da | |||
| a8ea96a234 | |||
| 31f3786218 | |||
| 4386e4295f | |||
| e39a7b2a5f | |||
| 5ba7a22893 | |||
| 200ff6ee53 | |||
| 342db95db1 | |||
| a8d5ca4f94 | |||
| 8b1f9fbdb2 | |||
| d36c11db0c | |||
| c9e48802a5 | |||
| 800647a85b | |||
| a433930291 | |||
| c1ab03584e | |||
| 6b39eef5b2 | |||
| 5e1ccc9ef3 | |||
| 33bf4e208e | |||
| f4a18a4bcc | |||
| 0ed712244f | |||
| 2ac40d9676 | |||
| 084b90b98e | |||
| b1a2620e28 | |||
| 2f09c61d65 | |||
| 2ce469b149 | |||
| affb90be44 | |||
| acf27c6c8b | |||
| 8c4bd97f6b | |||
| 7c0a9f154a | |||
| 4326f809d9 | |||
| 6b4dcf2071 | |||
| fb56535660 | |||
| 545a77a01f | |||
| ee4f818f8a | |||
| 7dbddf31e5 | |||
| 055f98b37c | |||
| c96d0ae452 | |||
| 690364346d | |||
| fc6aebb916 | |||
| df29df46f2 | |||
| f830cf38e8 | |||
| 60442bb489 | |||
| 78390e597f | |||
| 3b3a071bdd | |||
| 9f1dab082c | |||
| a03db1d42b | |||
| e9d7e1bbe8 | |||
| 11845450fb | |||
| e5d935fd72 | |||
| 8ee19b4f1d | |||
| 38f6c90637 | |||
| d274bfed40 | |||
| 2ca1b5805f | |||
| 07565348c1 | |||
| 2c9f573600 | |||
| 40a59f70c8 | |||
| dc159dfd50 | |||
| dea8c80374 | |||
| b4eae7b556 | |||
| f5e0ef9eea | |||
| 060612ea3a | |||
| bcaeb13ee9 | |||
| cddd367f3e | |||
| 158de28bc6 | |||
| 3c690cfb8b | |||
| acf7519636 | |||
| 67cf08d27f | |||
| 942967d7a1 | |||
| 9fc674464c | |||
| 8588394282 | |||
| dcca4aeb7b | |||
| 1772adb7c4 | |||
| fba82babe5 | |||
| cd632cec2d | |||
| 5453b74075 | |||
| 3b093c5daa | |||
| 8a3694b588 | |||
| b6c3f3dc75 | |||
| 2929e8ac46 | |||
| 5716f26d02 | |||
| 12734cebea | |||
| f07a53ba49 | |||
| 336a30cdd2 | |||
| ed179461db | |||
| 570cf3bc31 | |||
| ca3e6cbdac | |||
| 8d2a8219a0 | |||
| 45c9a9eb02 | |||
| 65ea99519b | |||
| 6133b325e4 | |||
| a6fa4ba320 | |||
| b1ca929ee6 | |||
| 187d7f5115 | |||
| 792e87d4e5 | |||
| 12a8d4b7d5 | |||
| 373c8dd630 | |||
| 57025a8c35 | |||
| 6d9e83596b | |||
| 38fabc623d | |||
| d235f0f88e | |||
| 43ee42aeef | |||
| 4d10ef76d4 | |||
| 97c08710a7 | |||
| c830f47254 | |||
| e11139579e | |||
| 474e38a5f4 | |||
| acd2b3b60c | |||
| c77a42b16a | |||
| 2e74dc1caf | |||
| 4661de23d2 | |||
| 23b3d7bc2c | |||
| efa963d24b | |||
| 642b2559d5 | |||
| 87047eac10 | |||
| 7431893328 | |||
| 4c5d1df47f | |||
| b7b144c0c5 | |||
| 0303d84424 | |||
| e5f9cce3f2 | |||
| 413f6251ad | |||
| 5252fe728e | |||
| 6a40173c5b | |||
| 658ec0c00f | |||
| dd05729971 | |||
| ceb5a13b52 | |||
| 0a545f7826 | |||
| b62bfda94b | |||
| 42f83f3d3b | |||
| eac4feb72a | |||
| 6f873540e9 | |||
| 3f7d082ae6 | |||
| 407855647a | |||
| 05dbce217b | |||
| f19182bd0f | |||
| 0fc716315c | |||
| 67db96eae5 | |||
| 1a6825f2b8 | |||
| 1b782ea999 | |||
| 13d96b51b5 | |||
| 3a3efa39b0 | |||
| ff57f0b2e7 | |||
| 14928cda03 | |||
| 0bd725d078 | |||
| 8eaf7d071e | |||
| 02178ef444 | |||
| 2322f3efea | |||
| 4a3528407f | |||
| 20de07dc87 | |||
| 6a71cf9806 | |||
| 9a751e5020 | |||
| b7b92cfb57 | |||
| 00094598b1 | |||
| 32825de7e4 | |||
| f7f596b489 | |||
| 59d5b28396 | |||
| d59e8cca26 | |||
| 5ce3fdc2ed | |||
| f92c23c607 | |||
| ffe63546c2 | |||
| f51b935639 | |||
| b629632b7c | |||
| 438bef0317 | |||
| 3f44fb23d8 | |||
| 42e9738221 | |||
| 6ceb3e3e58 | |||
| 6f898cdbdf | |||
| 51231b4688 | |||
| 18d283d374 | |||
| f96ee44cba | |||
| c2a51a2aa7 | |||
| 4a0df63d10 | |||
| e69afc7263 | |||
| fee4da5cb6 | |||
| bddc4ea379 | |||
| 0902729bc7 | |||
| 8c75e6dbc1 | |||
| 13d0b9cdb0 | |||
| 3570f1c695 | |||
| 8cca8e4490 | |||
| 776723564c | |||
| 3112ca49c0 | |||
| 033b45cadc | |||
| ae7086dc04 | |||
| 6381929534 | |||
| 5492f432a9 | |||
| d8cdb9f186 | |||
| 6f806dc096 | |||
| 970ae42e95 | |||
| 77586bba5f | |||
| fa3688d1a2 | |||
| a54021e958 | |||
| dceece64ad | |||
| 9e98f302ea | |||
| b9be81905f | |||
| fc9f470ef3 | |||
| 2c021f570f | |||
| 6f1648cee8 | |||
| c70d13bb18 | |||
| 5bf8944850 | |||
| 12a6e0d90e | |||
| f8598a91b4 | |||
| 69dc463030 | |||
| 2fa6be6006 | |||
| bc3ffb239b | |||
| 04ac286b05 | |||
| 17b7dc6494 | |||
| 0e2955ea97 | |||
| bec2575e44 | |||
| 63975b950f | |||
| 5c2c36c7cc | |||
| 6830a60d8a | |||
| 3a5782449b | |||
| 3e0305156c | |||
| 36b055f18e | |||
| 486c375d0d | |||
| f807d2536d | |||
| 1812d4926a | |||
| 766e439ae8 | |||
| ee1c40584a | |||
| 8d9d0bdb94 | |||
| 5dd53a5977 | |||
| 6af0e5e209 | |||
| e8e969a564 | |||
| 748b4bc6a7 | |||
| 39f4447d5d | |||
| b3df1e07cd | |||
| 1fa069584a | |||
| b1198bdbee | |||
| 28ae88d385 | |||
| 08d6467153 | |||
| ebde3bd764 | |||
| e32d843417 | |||
| 70d2ea226d | |||
| 5c86e65aa0 | |||
| d400a432ad | |||
| a86c3b9239 | |||
| 3ebb0248f3 | |||
| eea38f9674 | |||
| 670f010ccc | |||
| b4f093c9cb | |||
| c91d27905e | |||
| 7db5321c54 | |||
| 611c9f5744 | |||
| c29d2464da | |||
| 168d6bf045 | |||
| 424808cd19 | |||
| b014e0e41e | |||
| 4021b0d41c | |||
| 75e17ef588 | |||
| 34c6a26ed2 | |||
| 529dfa157c | |||
| 7f93815e9c | |||
| be5dc5b9ce | |||
| 7da34dd6a7 | |||
| 3275b4b909 | |||
| fd26269b04 | |||
| 9c5d5d85f3 | |||
| d6b051f5b8 | |||
| 0c4851e4a0 | |||
| 51e07cb4b7 | |||
| e58c3ec41a | |||
| eb37047870 | |||
| 29c871d5ea | |||
| 3a4d8157f5 | |||
| 9820162b9f | |||
| 7b3d32fbc3 | |||
| 8287f9b148 | |||
| 7d7df32f29 | |||
| 47258482e2 | |||
| bbb80f7a91 | |||
| 54edef5264 | |||
| a20b75a9fd | |||
| 0c8cc199dc | |||
| ac48b764da | |||
| 6e3a57ffd1 | |||
| 7a5c342082 | |||
| be3735bc6a | |||
| 655fd2916c | |||
| b828e21717 | |||
| c676de59d5 | |||
| fc4146f306 | |||
| 2a6560c167 | |||
| 98cba933c9 | |||
| bf09845921 | |||
| b104a580a8 | |||
| 0f4e40fee4 | |||
| 5368aa392c | |||
| ad9c35ea0d | |||
| 887ad535ab | |||
| 0096e49402 | |||
| 5b226519b8 | |||
| 6ac7aa1ed8 | |||
| cece11390f | |||
| 7e367bbfd1 | |||
| 052cda672a | |||
| d7ca084f1b | |||
| 185967aa4f | |||
| 45d849cab5 | |||
| b8a97a1295 | |||
| 3c9a8e3232 | |||
| ebba19380c | |||
| fece32c65f | |||
| 56f5f5e3fa | |||
| d76b3e5a4f | |||
| c0c1b7fac9 | |||
| b76cefd279 | |||
| b917e4936e | |||
| 9147f25eca | |||
| db9f58c0ff | |||
| bb24660607 | |||
| 9a37e365ad | |||
| d5f6fbd853 | |||
| c567df584f | |||
| 63de53fa35 | |||
| 5a2ac3b42d | |||
| 4745504170 | |||
| c981ea8bd9 | |||
| 2a6e98d532 | |||
| 67f16db3df | |||
| deee415bb4 | |||
| cfac8fab2a | |||
| 924b14e6f6 | |||
| 5130d0fe27 | |||
| b6e2665050 | |||
| 060751cf0d | |||
| d48f9af544 | |||
| 2a2bb658f9 | |||
| 1c2a00f057 | |||
| 8c1016d049 | |||
| 51ca832d5c | |||
| 921574f4c2 | |||
| b6031b0c38 | |||
| fc1e77b549 | |||
| 81ab31a108 | |||
| 0150cfebbc | |||
| 83b80ddd6d | |||
| 5a314f3259 | |||
| 2723afe575 | |||
| cab910fd1a | |||
| 6379c9af6c | |||
| 7793c3facc | |||
| 95a3729334 | |||
| 35f1519770 | |||
| a10e7f4aef | |||
| 42002d1d1e | |||
| 3f9a58cde9 | |||
| cc3cc88ce0 | |||
| b4156fc8c2 | |||
| 4a53aaedf2 | |||
| 14d7455154 | |||
| 76d412227c | |||
| 635835d17d | |||
| 0c45f82fd2 | |||
| af311629bc | |||
| 684fb8b3f4 | |||
| b53fc4699d | |||
| 12b0902ef2 | |||
| aa514bf28e | |||
| 3523e24d53 | |||
| 9edefb219a | |||
| 416dc1c5c7 | |||
| 6a8af18b61 | |||
| 772abc86d0 | |||
| 3506c50d0f | |||
| c7ee39fb2c | |||
| 7ee501eaea | |||
| 8f6a71e1e9 | |||
| 4ac941e1f1 | |||
| 2555207b57 | |||
| eb063627dc | |||
| 0c5ae06e4b | |||
| 3e1e9fb294 | |||
| ca13e27743 | |||
| 7d17bbf3ea | |||
| 802a2d1af1 | |||
| b2581e4465 | |||
| 713c27856b | |||
| 70107495f3 | |||
| bde90ec194 | |||
| dc57f8e43f | |||
| 1d119cc85c | |||
| ad5c210619 | |||
| 59e4dd61f3 | |||
| 1bbf778597 | |||
| e071166664 | |||
| 6981befe48 | |||
| 7e5e4adacc | |||
| d9fe9d0fe2 | |||
| e2b487ee47 | |||
| 8a3709bf3a | |||
| 9bbae57be5 | |||
| 3a71377bb0 | |||
| ff1c7e351e | |||
| 4a339aa239 | |||
| f9390726e8 | |||
| 37c6222c2a | |||
| 71f6e6d904 | |||
| aa2c5b40cf | |||
| 11bf412a25 | |||
| 09bd313f9a | |||
| bdd3213b4b | |||
| b34818c2b4 | |||
| 2d1d755897 | |||
| 9df5c866e1 | |||
| 499d582fdc | |||
| f8a98de76a | |||
| 4cf16ae5c5 | |||
| c80dcb9a2d | |||
| 425132696f | |||
| ab65f23d4b | |||
| 84579f0e61 | |||
| 375178be4f | |||
| 79c4b8673e | |||
| a367d4315e | |||
| b03f6f13a6 | |||
| fd8cec8608 | |||
| 2e5f249820 | |||
| 8bc1939e2f | |||
| 86a43bcd97 | |||
| e47b369054 | |||
| f5c9735c35 | |||
| efd577ff89 | |||
| 68cd02b384 | |||
| f78cc828e1 | |||
| a9a4b4e019 | |||
| 523666914d | |||
| bdf407a942 | |||
| 591a36a5d9 | |||
| 9732a28a31 | |||
| 18f8ee08d8 | |||
| f86aeeede4 | |||
| 6fc039c151 | |||
| 979ea455f1 | |||
| 8e966fc380 | |||
| 0c5626a2f8 | |||
| 692d5066d6 | |||
| dcb8e6ff14 | |||
| 8a352a1b27 | |||
| 182158c899 | |||
| 1fa5075272 | |||
| ac59f12b12 | |||
| 41b108ce69 | |||
| b5c159c65e | |||
| dc80ef57b5 | |||
| bd3fa2ffcc | |||
| 03fd4cdb54 | |||
| 17e475a5df | |||
| 7b7ece4831 | |||
| 568df1c3fa | |||
| 5ecd6e48a4 | |||
| 73250a34e3 | |||
| 9acb573ea4 | |||
| 3fd8f030fe | |||
| 817a61e9b6 | |||
| 60466305f9 | |||
| cca216249a | |||
| afe7c61ce6 | |||
| 9bbeec1453 | |||
| d7e1ef2631 | |||
| f4bd84fb13 | |||
| 7fe5dd82bb | |||
| 73dcba2ea2 | |||
| 7707611555 | |||
| 24cf2edece | |||
| 0ea1704374 | |||
| 19b80e5d63 | |||
| 1d78bcad82 | |||
| c0b5f9a697 | |||
| aa1b6c92cc | |||
| 24b46819be | |||
| 98a381ac56 |
@@ -1,5 +1,87 @@
|
||||
## Welcome to [dwl-patches](https://codeberg.org/dwl/dwl-patches)!
|
||||
The dwl project is available at [https://codeberg.org/dwl/dwl](https://codeberg.org/dwl/dwl).
|
||||
This repository and the associated wiki is exclusively for dwl PATCHES.
|
||||
# dwl-patches
|
||||
* A general [dwl wiki](https://codeberg.org/dwl/dwl/wiki) is available at the main [dwl] repository.
|
||||
* This repository is exclusively for dwl PATCHES.
|
||||
|
||||
Please see the dwl-patches [wiki](https://codeberg.org/dwl/dwl-patches/wiki) for patch descriptions and for [instructions](https://codeberg.org/dwl/dwl-patches/wiki/instructions) on contributing/updating/reporting issues.
|
||||
*Note: All patches are user-submitted content. The authors of dwl do not continually monitor them. You are responsible for downloading and reviewing a patch before using it!*
|
||||
|
||||
## Reporting Issues
|
||||
- Issues with existing patches can be generated here in the dwl-patches [issues]. Please be sure to "@" reference the patch author in your issue.
|
||||
|
||||
## Contributing Patches to `dwl-patches`
|
||||
Since dwl follows [suckless](https://suckless.org/) philosophy, it doesn't provide every feature under the sun. To broaden dwl's functionality, one needs to get familiar with the concept of patching. To get your feet wet, consult [the hacking page](https://suckless.org/hacking/) of the suckless website.
|
||||
|
||||
Patches should normally target the latest dwl [release].
|
||||
If you target an older release, specify that in the `Download` link on your `README.md` page.
|
||||
If you target the unstable `main` branch, specify that in the `Download` link on your `README.md` page.
|
||||
|
||||
0. Starting from a local clone of [dwl] (not dwl-patches)
|
||||
1. If you do not have it already, add the remote for the main dwl repository in your local copy and fetch it:
|
||||
`git remote add --fetch upstream https://codeberg.org/dwl/dwl`
|
||||
2. Use git to create a branch for your new patch and hack away creating your patched version of [dwl].
|
||||
3. In your local clone of dwl, create a .patch file
|
||||
`git format-patch upstream/main...<branch-name> --stdout > PATCHNAME.patch`
|
||||
4. Now fork [dwl-patches] (not dwl) in Codeberg and clone it locally
|
||||
5. Configure your `dwl-patches` local clone
|
||||
`git config --local pull.rebase true`
|
||||
6. In your local `dwl-patches` clone, add a directory called `patches/PATCHNAME`. Place the `PATCHNAME.patch` you created in step (2) into the `patches/PATCHNAME` directory.
|
||||
7. Add a `README.md` page to the `PATCHNAME` directory using this template (add/remove sections as you like):
|
||||
```markdown
|
||||
### Description
|
||||
Insert a short summary of changes that your patch implements.
|
||||
|
||||
### Download
|
||||
- [git branch](/USERNAME/dwl/src/branch/PATCHNAME)
|
||||
^^^^^^^^^^ OPTIONAL: Patchers are no longer obligated to maintain public `dwl` branches devoted to their patches
|
||||
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/PATCHNAME/PATCHNAME.patch)
|
||||
Use the ^RAW^ patch link here
|
||||
^^^ "0.7" is an example. Use the release that your patch targets
|
||||
- [main YYYY-MM-DD](/dwl/dwl-patches/raw/branch/main/patches/PATCHNAME/PATCHNAME.patch)
|
||||
^^^^^^^^^^ Patches targeting the unstable "main" branch include a YYYY-MM-DD indicator
|
||||
### Authors - latest at top [Codeberg nick is mandatory; other contact methods optional]
|
||||
- [YOUR_NICK](https://codeberg.org/USERNAME)
|
||||
your_email@if_you_wish_to.share.it
|
||||
your_irc_nick at [Libera IRC dwl channel](https://web.libera.chat/?channels=#dwl)
|
||||
your_discord_handle at [dwl Discord](https://discord.gg/jJxZnrGPWN)
|
||||
```
|
||||
You may choose to include screenshots (hosted in your patch's subdirectory) in your `README.md`. The process is described [here](https://docs.codeberg.org/markdown/using-images/).
|
||||
|
||||
8. Use the Codeberg web interface to send a pull request to [dwl-patches] (NOT to [dwl])
|
||||
9. WHEN YOUR PULL REQUEST IS APPROVED, your Codeberg account will also be granted commit access to [dwl-patches]. Once you have write access, you can make direct modifications/upates to your patches instead of pull requests.
|
||||
|
||||
Individuals who have made known that they no longer intend to maintain their patches will have commit access to the [dwl-pathces] repository removed.
|
||||
|
||||
A returning user who formerly had commit access is welcome to open an issue on [dwl-patches] requesting commit access be reinstated. When doing so, please link to the original issue opened that granted commit access.
|
||||
|
||||
## Updating/Modifying/Adopting Existing Patches
|
||||
- If the existing patch is already being maintained by another author, do not make modifications to it.
|
||||
- Create an issue at [issues] @mentioning the current maintainer.
|
||||
- If you receive no reply for seven days, you may assume the patch abandoned and you may adopt the patch.
|
||||
- Modify the `README.md` with new links for your raw patch and for your git branch.
|
||||
- **LEAVE PREVIOUS AUTHOR(S)' NICKS/LINKS INTACT UNDER THE "Authors" HEADING!**
|
||||
- Add your own nick/link to the top of the "Authors" list.
|
||||
|
||||
## Deprecating Existing Patches
|
||||
- Patches will not be removed from this archive but may instead be deprecated if the author(s)/maintainer(s) of a patch so desire.
|
||||
- Please do not open issues or contact maintainers to request deprecation of a patch.
|
||||
- Deprecation of a patch will only occur if *all* authors or current maintainers of the patch agree to the decision to deprecate.
|
||||
- In such a circumstance the author(s)/maintainer(s):
|
||||
- Will create a commit moving the patch to the `stale-patches` directory
|
||||
- May explain in the associated `README.md` any relevant details of the decision to deprecate the patch.
|
||||
- This process allows current or future users of the patch the option to adopt, modify, or integrate stale/historical code or portions thereof.
|
||||
|
||||
## stale-patches
|
||||
Deprecated or unmaintained patches are held in the [stale-patches] directory.
|
||||
Currently, this directory also contains `.md` description files from ancient patches predating the move to Codeberg.
|
||||
|
||||
If you have the inclination to revive one of these, please follow the same procedures outlined below for contributing new patches.
|
||||
|
||||
In your initial pull request (or in the commit that revives the stale patch if you already have write access), remove the corresponding `.md` file or the patch directory from [stale-patches].
|
||||
|
||||
[stale-patches]: https://codeberg.org/dwl/dwl-patches/src/branch/main/stale-patches
|
||||
[dwl]: https://codeberg.org/dwl/dwl
|
||||
[dwl-patches]: https://codeberg.org/dwl/dwl-patches
|
||||
[issues]: https://codeberg.org/dwl/dwl-patches/issues
|
||||
[release]: https://codeberg.org/dwl/dwl/releases
|
||||
[Codeberg]: https://codeberg.org
|
||||
|
||||
##
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
This implements the DRM lease protocol, which is needed to use devices such as VR headsets.
|
||||
|
||||
### Download
|
||||
- [2023-05-26](https://github.com/djpohly/dwl/compare/main...minego:drm_lease_patch.patch)
|
||||
|
||||
### Authors
|
||||
- [Micah N Gorrell](https://github.com/minego)
|
||||
@@ -1,10 +0,0 @@
|
||||
### Description
|
||||
Utilizing the [/usr/include/X11/XF86keysym.h](https://cgit.freedesktop.org/xorg/proto/x11proto/tree/XF86keysym.h) header file to change the volume via the appropriate keys.
|
||||
|
||||
### Download
|
||||
- [2023-10-15](https://github.com/djpohly/dwl/compare/main...nakibrayan3:dwl:update-XF86keysym-patch.patch)
|
||||
- [2021-05-06](https://github.com/djpohly/dwl/compare/main...917Wolf:vol.patch)
|
||||
|
||||
### Authors
|
||||
- [917Wolf](https://github.com/917Wolf)
|
||||
- [Rayan Nakib](https://nakibrayan2.pages.dev)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Adds configurable transparency for focused and unfocused windows.
|
||||
|
||||
### Download
|
||||
- [2021-12-03](https://github.com/djpohly/dwl/compare/main...juliag2:alphafocus.patch)
|
||||
|
||||
### Authors
|
||||
- [Julia](https://github.com/juliag2)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Newly created windows are placed above the currently selected window in the stack.
|
||||
|
||||
### Download
|
||||
- [2021-01-16](https://github.com/djpohly/dwl/compare/main...ss7m:attachabove.patch)
|
||||
|
||||
### Authors
|
||||
- [sam-barr](https://github.com/ss7m)
|
||||
@@ -1,9 +0,0 @@
|
||||
### Description
|
||||
Newly created windows are placed at the bottom of the client tile stack.
|
||||
|
||||
### Download
|
||||
- [v0.4](https://github.com/djpohly/dwl/compare/main...dm1tz:04-attachbottom.patch)
|
||||
- [2021-10-05](https://github.com/djpohly/dwl/compare/main...AurelWeinhold:attachbottom.patch)
|
||||
|
||||
### Authors
|
||||
- [Aurel Weinhold](https://github.com/AurelWeinhold)
|
||||
@@ -1,40 +0,0 @@
|
||||
### Description
|
||||
Adds keybindings for screen rotation and auto rotation from an accelerometer.
|
||||
|
||||
### Setup
|
||||
Find an accelerometer device in sysfs (`cat /sys/bus/iio/devices/iio*/name`,
|
||||
or using a script: [monitor-iio.sh](https://github.com/Unprex/dotfiles/blob/main/scripts/monitor-iio.sh)) \
|
||||
Find the raw output file of the accelerometer
|
||||
(e.g. `cat /sys/bus/iio/devices/iio:device0/in_accel_x_raw` should output an integer). \
|
||||
Add the raw output file names to the dwl configuration **accel_\***.
|
||||
|
||||
Add a udev rule to uniquely identify the device, for example:
|
||||
```
|
||||
sudo echo 'SUBSYSTEM=="iio", KERNEL=="iio*", ATTR{name}=="accel_3d", GROUP="input", SYMLINK+="input/accel"' >> /etc/udev/rules.d/99-accel.rules
|
||||
sudo udevadm control --reload-rules && sudo udevadm trigger
|
||||
```
|
||||
(the device is probably already in /dev/ e.g. `/dev/iio:device0` but on my computer the number changes after a reboot)
|
||||
|
||||
A symlink to the device should now be available in `/dev/input/` and accessible to input group members. \
|
||||
Add the device path to the dwl configuration **accel_path**.
|
||||
|
||||
### Config
|
||||
* `rotation_enabled`: If the auto rotation is enabled on startup.
|
||||
* `rotation_delay`: How often to check the accelerometer values in milliseconds.
|
||||
* `rotation_flat`: Threshold on the normalized Z axis to consider the device flat and stop the auto rotation.
|
||||
* `rotation_thresh`: Rotation threshold after which the screen flips (values less than 0.5 will cause a back and forth).
|
||||
|
||||
+ `accel_path`: The path to the accelerometer device file (e.g. "/dev/input/accel").
|
||||
+ `accel_x`: The name of the sysfs file for the accelerometer x axis.
|
||||
+ `accel_y`: The name of the sysfs file for the accelerometer y axis.
|
||||
+ `accel_z`: The name of the sysfs file for the accelerometer z axis.
|
||||
|
||||
Default keybindings:
|
||||
* `<Modkey>` + `<Shift>` + `<Arrows>`: Change the screen rotation manually (doesn't disable the auto rotation).
|
||||
* `<Modkey>` + `<Shift>` + `<R>`: Enable/disable the auto rotation.
|
||||
|
||||
### Download
|
||||
- [2022-10-25](https://github.com/djpohly/dwl/compare/main...Unprex:rotation.patch)
|
||||
|
||||
### Authors
|
||||
- [Unprex](https://github.com/Unprex)
|
||||
@@ -1,10 +0,0 @@
|
||||
### Description
|
||||
Adds a rule to automatically center clients on the current monitor.
|
||||
|
||||
### Download
|
||||
- [v0.4](https://github.com/djpohly/dwl/compare/main...dm1tz:04-center.patch)
|
||||
- [v0.4-r1](https://github.com/djpohly/dwl/compare/main...dm1tz:04rc1-iscenter.patch)
|
||||
- [2022-08-27](https://github.com/djpohly/dwl/compare/main...dm1tz:iscenter.patch)
|
||||
|
||||
### Authors
|
||||
- [Dmitry Zakharchenko](https://github.com/dm1tz)
|
||||
@@ -1,27 +0,0 @@
|
||||
### Description
|
||||
Store your clipboard history using `clipman` clipboard manager without your KeePassXC passwords leaking into clipman.
|
||||
|
||||
Ensure these dependencies are installed (instructions for debian, other distros are left as an exercise...):
|
||||
|
||||
apt install clipman libmodern-perl-perl moreutils wl-clipboard
|
||||
|
||||
Change your command to launch `dwl` to something like the following:
|
||||
|
||||
dwl -s 'pee somebar dwl-getwindowtitle'
|
||||
|
||||
Ensure the following command is running in the background of your `dwl` session. Put it whereever your auto-started stuff is.
|
||||
|
||||
exec wl-paste -t text --watch dwl-clipman
|
||||
|
||||
This solution is based on the following reddit post, modified to support `dwl`. https://www.reddit.com/r/swaywm/comments/ljl0dh/keeping_secrets_secret_with_keepassxc_clipman_and/
|
||||
|
||||
Feel free to use this code however you want, but I can't guarantee it will work for what you are trying to do. Licenced under the same license as `dwl`, "WITHOUT WARRANTY OF ANY KIND".
|
||||
|
||||
|
||||
|
||||
### Download
|
||||
- [2022-12-21](https://github.com/djpohly/dwl/compare/main...bencollerson:clipboard-manager.patch)
|
||||
- [2022-12-01](https://github.com/djpohly/dwl/compare/main...bencollerson:94d0a21.patch)
|
||||
|
||||
### Authors
|
||||
- [Ben Collerson](https://github.com/bencollerson)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Adds clipboard functionality. Requires the [ipc](https://github.com/djpohly/dwl/wiki/ipc) patch for dwl and `wl-clipboard` to be installed. By default, requires [clipman](https://github.com/yory8/clipman) for the clipboard and [dwl-state](https://github.com/MadcowOG/dwl-state) for getting the appid of the focused application, but you can change these in the script if you have alternatives. You may change which applications to not record by modifying the `excludes` array in `dwl-cliboard-watcher`. Make sure `wl-paste -t text -w dwl-clipboard-watcher` is running after dwl.
|
||||
|
||||
### Downloads
|
||||
- [2023-3-01](https://github.com/djpohly/dwl/compare/main...MadcowOG:ipc-clipboard.patch)
|
||||
|
||||
### Authors
|
||||
- [MadcowOG](https://github.com/MadcowOG)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
When focus is changed, warp the cursor the the center of the new focused client (if it wasn't already within the client's geometry).
|
||||
|
||||
### Download
|
||||
- [2022-05-26](https://github.com/djpohly/dwl/compare/main...faerryn:cursor_warp.patch)
|
||||
|
||||
### Authors
|
||||
- [Faerryn](https://github.com/faerryn)
|
||||
@@ -1,9 +0,0 @@
|
||||
### Description
|
||||
Adds function to cycle through available layouts.
|
||||
|
||||
### Download
|
||||
- [v0.4](https://github.com/djpohly/dwl/compare/main...dm1tz:04-cyclelayouts.patch)
|
||||
- [2021-07-27](https://github.com/djpohly/dwl/compare/main...vnepogodin:cyclelayouts.patch)
|
||||
|
||||
### Authors
|
||||
- [Vladislav Nepogodin](https://github.com/vnepogodin)
|
||||
@@ -1,27 +0,0 @@
|
||||
### Description
|
||||
Arranges windows in a Fibonacci spiral or dwindle.
|
||||
|
||||
### Scheme
|
||||
```
|
||||
+-----------+-----------+ +-----------+-----------+
|
||||
| | | | | |
|
||||
| | 2 | | | 2 |
|
||||
| | | | | |
|
||||
| 1 +--+--+-----+ | 1 +-----+-----+
|
||||
| | 5|-.| | | | | 4 |
|
||||
| +--+--+ 3 | | | 3 +--+--+
|
||||
| | 4 | | | | | 5|-.|
|
||||
+-----------+-----+-----+ +-----------+-----+-----+
|
||||
spiral dwindle
|
||||
```
|
||||
|
||||
### Download
|
||||
- [2023-06-21](https://github.com/djpohly/dwl/compare/main...Abanoub8:fibonacci.patch)
|
||||
- [2022-09-22](http://0x0.st/oVlu.patch)
|
||||
- [2021-05-06](https://github.com/djpohly/dwl/compare/main...917Wolf:fib.patch)
|
||||
|
||||
### Authors
|
||||
- [Abanoub8](https://github.com/Abanoub8)
|
||||
- [medanisjbara](https://github.com/medanisjbara)
|
||||
- [917Wolf](https://github.com/917Wolf)
|
||||
- Niki Yoshiuchi
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Floating clients have their own border color.
|
||||
|
||||
### Download
|
||||
- [2022-03-26](https://github.com/djpohly/dwl/compare/main...PalanixYT:float_border_color.patch)
|
||||
|
||||
### Authors
|
||||
- [Palanix](https://github.com/PalanixYT)
|
||||
@@ -1,7 +0,0 @@
|
||||
### Description
|
||||
Implements `focusmon()` function that moves the cursor to the focused monitor.
|
||||
### Download
|
||||
- [2020-10-15](https://github.com/djpohly/dwl/compare/main...Stivvo:focusMonPointer.patch)
|
||||
|
||||
### Authors
|
||||
- [Stivvo](https://github.com/Stivvo)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Focus the window left, right, above or below the current focused window
|
||||
|
||||
### Download
|
||||
- [2023-19-15](https://github.com/djpohly/dwl/compare/main...XGames123:focusdir.patch)
|
||||
|
||||
### Authors
|
||||
- [ldev](https://github.com/Xgames123)
|
||||
@@ -1,9 +0,0 @@
|
||||
### Description
|
||||
Focus the master regardless of the current focus.
|
||||
|
||||
### Download
|
||||
- [2022-09-02](https://github.com/djpohly/dwl/compare/main...dm1tz:fmaster.patch)
|
||||
- [2022-08-18](https://github.com/djpohly/dwl/compare/main...PalanixYT:focusmaster.patch)
|
||||
|
||||
### Authors
|
||||
- [Palanix](https://github.com/PalanixYT)
|
||||
@@ -1,25 +0,0 @@
|
||||
### Description
|
||||
This patch is a modified version of [vanitygaps][vanitygaps] that adds gaps around clients regardless of a layout.
|
||||
It means you can apply any layout patch and the gaps will be shown properly as long as the layout does not add any gaps on its own.
|
||||
|
||||
This works by allowing a layout to place clients normally without gaps,
|
||||
and then correcting positions and dimensions of clients afterwards to add gaps around them.
|
||||
To make it work, I had to modify `resize()` function,
|
||||
and, as a side effect, this change fixed some flickering I experienced when using [snail][snail] layout.
|
||||
|
||||
[snail]: https://github.com/djpohly/dwl/wiki/snail
|
||||
[vanitygaps]: https://github.com/djpohly/dwl/wiki/vanitygaps
|
||||
|
||||
### Changelog
|
||||
|
||||
2023-11-24:
|
||||
- Refactor, it does exactly the same, just using less code.
|
||||
- Replace `gappih`, `gappiv`, `gappoh` and `gappov` with only `gappx`. They don't do anything anyways.
|
||||
|
||||
### Download
|
||||
- [2023-11-24](https://github.com/djpohly/dwl/compare/main...wochap:genericgaps.patch)
|
||||
- [2023-05-20](https://github.com/djpohly/dwl/compare/main...NikitaIvanovV:genericgaps.patch) generic gaps
|
||||
- [2023-05-20](https://github.com/djpohly/dwl/compare/main...NikitaIvanovV:genericgaps-rule.patch) generic gaps + monitor rule to enable gaps on certain monitors by default
|
||||
|
||||
### Authors
|
||||
- [Nikita Ivanov](https://github.com/NikitaIvanovV)
|
||||
@@ -1,10 +0,0 @@
|
||||
### Description
|
||||
Arranges windows in a grid of equal sizes.
|
||||
|
||||
### Download
|
||||
- [2023-06-21](https://github.com/djpohly/dwl/compare/main...Abanoub8:gridmode.patch)
|
||||
- [2021-07-24](https://github.com/djpohly/dwl/compare/main...vnepogodin:gridmode.patch)
|
||||
|
||||
### Authors
|
||||
- [Vladislav Nepogodin](https://github.com/vnepogodin)
|
||||
- [Abanoub8](https://github.com/Abanoub8)
|
||||
@@ -1,9 +0,0 @@
|
||||
### Description
|
||||
Hide the cursor when typing
|
||||
|
||||
### Download
|
||||
- [2023-10-25](https://github.com/djpohly/dwl/compare/main...apprehensions:hidecursor.patch)
|
||||
- [2023-02-19](https://github.com/djpohly/dwl/compare/main...PalanixYT:type_hide.patch)
|
||||
|
||||
### Authors
|
||||
- [Palanix](https://github.com/PalanixYT)
|
||||
@@ -1,15 +0,0 @@
|
||||
### Description
|
||||
Allow for keyboard rules to be used; This allows for keyboard-specific options or layouts.
|
||||
|
||||
The keyboard's names can be retrieved from `libinput list-devices | grep Device`, example:
|
||||
```c
|
||||
static const KeyboardRule kbrules[] = {
|
||||
{ "AT Translated Set 2 keyboard", { .options = "altwin:swap_alt_win,caps:swapescape" } },
|
||||
};
|
||||
```
|
||||
|
||||
### Download
|
||||
- [2023-09-20](https://github.com/djpohly/dwl/compare/main...apprehensions:dwl:kbrules.patch)
|
||||
|
||||
### Authors
|
||||
- [sewn](https://github.com/apprehensions)
|
||||
@@ -1,44 +0,0 @@
|
||||
### Description
|
||||
|
||||
This patch implements sequences for chained keybindings (like the dwm [keychord](https://dwm.suckless.org/patches/keychord/) patch).
|
||||
|
||||
_Notes_:
|
||||
- The maximum number of sequences is set to `5` in the `Keychord` struct for a given keybinding
|
||||
- This original motivation was better support for [stumpwm](https://stumpwm.github.io/) style of keybindings, however this is not a limitation
|
||||
|
||||
### Example
|
||||
|
||||
The default values for `MODKEY` and `PREFIXKEY` can be changed in `config.def.h` and/or `config.h`.
|
||||
|
||||
#### emacs-like
|
||||
|
||||
In the example below, the `firefox` command is bound to the key sequence `alt-s alt-u f`.
|
||||
|
||||
```C
|
||||
static const Keychord keychords[] = {
|
||||
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
|
||||
/* count key_sequences function argument */
|
||||
{ 3, {{MODKEY, XKB_KEY_s}, {MODKEY, XKB_KEY_u}, {MOD_NONE, XKB_KEY_f}}, spawn, SHCMD("firefox") },
|
||||
};
|
||||
```
|
||||
|
||||
#### vim-like
|
||||
|
||||
In the example below, the `firefox` command is bound to the key sequence `alt-s u f`.
|
||||
|
||||
```C
|
||||
static const Keychord keychords[] = {
|
||||
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
|
||||
/* count key_sequences function argument */
|
||||
{ 3, {{MODKEY, XKB_KEY_s}, {MOD_NONE, XKB_KEY_u}, {MOD_NONE, XKB_KEY_f}}, spawn,SHCMD("firefox") },
|
||||
};
|
||||
```
|
||||
|
||||
### Download
|
||||
|
||||
- [2023-03-12](https://github.com/djpohly/dwl/compare/main...yveszoundi:dwl-customization:keychord-2023-03-12.patch)
|
||||
- [2023-02-15](https://github.com/djpohly/dwl/compare/main...yveszoundi:dwl-customization:v0.4-keychord-2023-02-15.patch)
|
||||
|
||||
### Authors
|
||||
|
||||
- [Yves Zoundi](https://github.com/yveszoundi)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Print current keyboard layout to stdout
|
||||
|
||||
### Download
|
||||
- [2022-09-10](https://github.com/djpohly/dwl/compare/main...GospodinHoroshiy:keymap.patch)
|
||||
|
||||
### Authors
|
||||
- [Gospodin](https://github.com/GospodinHoroshiy)
|
||||
@@ -1,15 +0,0 @@
|
||||
### Description
|
||||
|
||||
This patch adds `menu` command, which allows dwl to interface with dmenu-like programs.
|
||||
|
||||
By default, two menus are available:
|
||||
- focusing a window by its title by pressing `Alt+o`
|
||||
- selecting a layout from a list by pressing `Alt+Shift+o`
|
||||
|
||||
Edit `menus` array and `MENU` macro in `config.h` to add/change menus and use a different dmenu program.
|
||||
|
||||
### Download
|
||||
- [2023-07-15](https://github.com/djpohly/dwl/compare/main...NikitaIvanovV:menu.patch)
|
||||
|
||||
### Authors
|
||||
- [Nikita Ivanov](https://github.com/NikitaIvanovV)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
This patch adds the option to let the cursor jump to the center of new clients, as well as move the cursor to the center of clients that gains focus.
|
||||
|
||||
### Download
|
||||
- [2023-03-17](https://github.com/djpohly/dwl/compare/main...0undefined:mouse-follows-focus.patch)
|
||||
|
||||
### Authors
|
||||
- [0undefined](https://github.com/0undefined)
|
||||
@@ -1,9 +0,0 @@
|
||||
### Description
|
||||
Extend the [movestack](https://github.com/djpohly/dwl/wiki/movestack) patch to let you also focus, or move, a client to the top or bottom of the stack.
|
||||
|
||||
### Download
|
||||
- [2023-03-12](https://github.com/djpohly/dwl/compare/main...0undefined:dwl:move-client-top.patch)
|
||||
|
||||
### Authors
|
||||
- [0undefined](https://github.com/0undefined)
|
||||
- Original movestack patch: [sam-barr](https://github.com/ss7m)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Prevent focus on mouseover.
|
||||
|
||||
### Download
|
||||
- [2023-02-05](https://github.com/djpohly/dwl/compare/main...jjjt-git:nomousefocus.patch)
|
||||
|
||||
### Authors
|
||||
- [JJJT](https://github.com/jjjt-git)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Only exit when no windows are open
|
||||
|
||||
### Download
|
||||
- [2022-09-11](https://github.com/djpohly/dwl/compare/main...GospodinHoroshiy:onlyquitonempty.patch)
|
||||
|
||||
### Authors
|
||||
- [Gospodin](https://github.com/GospodinHoroshiy)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Implement the output-power-management protocol. I don't know what this is used by, but here it is in case you need it.
|
||||
|
||||
### Download
|
||||
- [2022-03-20](https://github.com/djpohly/dwl/compare/main...guidocella:output-power-management.patch)
|
||||
|
||||
### Authors
|
||||
- [Guido Cella](https://github.com/guidocella)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Adds the -u option that allows users to pass a desired uid to drop to after becoming DRM master.
|
||||
|
||||
### Download
|
||||
- [2021-09-06](https://github.com/djpohly/dwl/compare/main...DanielMowitz:privilege-drop.patch)
|
||||
|
||||
### Authors
|
||||
- [Daniel Mowitz](https://github.com/DanielMowitz)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Adds functions `pushup` and `pushdown` to move windows within the tiling order.
|
||||
|
||||
### Download
|
||||
- [2022-12-05](https://github.com/djpohly/dwl/compare/wlroots-next...djpohly:push.patch)
|
||||
|
||||
### Authors
|
||||
- [Devin J. Pohly](https://github.com/djpohly)
|
||||
@@ -1,12 +0,0 @@
|
||||
### Description
|
||||
|
||||
When resizing windows, the mouse will no longer jump to the bottom
|
||||
right corner and only resize from that corner. Instead, the mouse will
|
||||
resize the window in the quadrant that the resize starts at. This is the
|
||||
same resize behavior as Sway and is similar to the resizehere dwm patch.
|
||||
|
||||
### Download
|
||||
- [v0.4](https://github.com/djpohly/dwl/compare/main...schance995:dwl:relative-mouse-resize.patch)
|
||||
|
||||
### Authors
|
||||
- [schance995](https://github.com/schance995)
|
||||
@@ -1,23 +0,0 @@
|
||||
### Description
|
||||
This patch allows you to restart dwl with a keybinding.
|
||||
**NOTE:** that all of your applications are gonna get killed on dwl restart.
|
||||
|
||||
The function creates a file at **/tmp/restart_dwl** and exits dwl.
|
||||
You have to modify your dwl launch script in order for this patch to work.
|
||||
Example dwl launch script:
|
||||
```sh
|
||||
do=true
|
||||
while $do || [ -f /tmp/restart_dwl ]; do
|
||||
do=false
|
||||
rm -rf /tmp/restart_dwl > /dev/null 2>&1
|
||||
dwl
|
||||
done
|
||||
```
|
||||
It's a do-while that checks if **/tmp/restart_dwl** exists after the first run of dwl.
|
||||
If this file exists delete it and start dwl again.
|
||||
|
||||
### Download
|
||||
- [2022-10-27](https://github.com/djpohly/dwl/compare/main...krypciak:patch-restartdwl.patch)
|
||||
|
||||
### Authors
|
||||
- [krypciak](https://github.com/krypciak)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
All floating windows become tiling when switching to a different layout.
|
||||
|
||||
### Download
|
||||
- [2020-08-28](https://github.com/djpohly/dwl/compare/main...Stivvo:restoreTiling.patch)
|
||||
|
||||
### Authors
|
||||
- [Stivvo](https://github.com/Stivvo)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Adds a toggleable function that makes a sticky client that is visible on all tags.
|
||||
|
||||
### Download
|
||||
- [v0.4](https://github.com/djpohly/dwl/compare/main...dm1tz:04-sticky.patch)
|
||||
|
||||
### Authors
|
||||
- [Dmitry Zakharchenko](https://github.com/dm1tz)
|
||||
@@ -1,11 +0,0 @@
|
||||
### Description
|
||||
Add a rule to clients to spawn them [sticky](sticky) on start up.
|
||||
I personally use it to make [dragon](https://github.com/mwh/dragon) show up on all tags.
|
||||
|
||||
### Download
|
||||
Apply on top of [sticky patch](sticky).
|
||||
|
||||
- [2023-05-27](https://github.com/dm1tz/dwl/compare/04-sticky...NikitaIvanovV:stickyrule.patch)
|
||||
|
||||
### Authors
|
||||
- [Nikita Ivanov](https://github.com/NikitaIvanovV)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Implements just enough of the `sway-ipc` protocol to facilitate status bars. Tested with `waybar` and `rootbar`.
|
||||
|
||||
### Download
|
||||
- [2022-06-08](https://github.com/djpohly/dwl/compare/main...StratusFearMe21:main.patch)
|
||||
|
||||
### Authors
|
||||
- [Isaac Mills](https://github.com/StratusFearMe21)
|
||||
@@ -1,8 +0,0 @@
|
||||
### Description
|
||||
Configure a default "previous" layout for `setlayout({0})` to switch back to.
|
||||
|
||||
### Download
|
||||
- [2020-07-28](https://github.com/djpohly/dwl/compare/main...guidocella:toggle-layout-immediately.patch)
|
||||
|
||||
### Authors
|
||||
- [Guido Cella](https://github.com/guidocella)
|
||||
@@ -1,11 +0,0 @@
|
||||
### Description
|
||||
Adds SIMPLE touchscreen functionality.<br>
|
||||
Currently emulates mouse movement and button presses.<br>
|
||||
|
||||
### Download
|
||||
- [2023-03-31](https://github.com/djpohly/dwl/compare/main...fauxmight:dwl:simple_touch_input.patch)
|
||||
- [2022-10-16](https://github.com/djpohly/dwl/compare/main...Unprex:touch-screen.patch)
|
||||
|
||||
### Authors
|
||||
- [fauxmight](https://github.com/fauxmight)
|
||||
- [Unprex](https://github.com/Unprex)
|
||||
@@ -1,25 +0,0 @@
|
||||
### Description
|
||||
A tiled layout optimized for wide vertical monitors.
|
||||
### Scheme
|
||||
```
|
||||
|---------------------------|
|
||||
| |
|
||||
| |
|
||||
| M |
|
||||
| |
|
||||
| |
|
||||
|---------------------------|
|
||||
| t1 |
|
||||
|---------------------------|
|
||||
| t2 |
|
||||
|---------------------------|
|
||||
| t3 |
|
||||
|---------------------------|
|
||||
```
|
||||
### Download
|
||||
- [2023-06-21](https://github.com/djpohly/dwl/compare/main...Abanoub8:vertile.patch)
|
||||
- [2021-08-15](https://github.com/djpohly/dwl/compare/main...ChausseBenjamin:vertile.patch)
|
||||
|
||||
### Authors
|
||||
- [Benjamin Chausse](https://github.com/ChausseBenjamin)
|
||||
- [Abanoub8](https://github.com/Abanoub8)
|
||||
@@ -1,9 +0,0 @@
|
||||
### Description
|
||||
|
||||
Set cursor theme and size via `XCURSOR_THEME` and `XCURSOR_SIZE` environmental variables.
|
||||
|
||||
### Download
|
||||
- [2023-07-18](https://github.com/djpohly/dwl/compare/main...NikitaIvanovV:xcursor.patch)
|
||||
|
||||
### Authors
|
||||
- [Nikita Ivanov](https://github.com/NikitaIvanovV)
|
||||
@@ -1,25 +0,0 @@
|
||||
From 95ac2fd73af8cee3ce3e556c254e60a2ca985515 Mon Sep 17 00:00:00 2001
|
||||
From: Guido Cella <guido@guidocella.xyz>
|
||||
Date: Tue, 16 Jan 2024 18:14:50 +0100
|
||||
Subject: [PATCH] center floating windows
|
||||
|
||||
---
|
||||
dwl.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 95ebee8..ac077e3 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -453,6 +453,8 @@ applyrules(Client *c)
|
||||
}
|
||||
}
|
||||
}
|
||||
+ c->geom.x = (mon->w.width - c->geom.width) / 2 + mon->m.x;
|
||||
+ c->geom.y = (mon->w.height - c->geom.height) / 2 + mon->m.y;
|
||||
setmon(c, mon, newtags);
|
||||
}
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
-1005
File diff suppressed because it is too large
Load Diff
@@ -1,128 +0,0 @@
|
||||
From 38dd71e51784ab68261d9c0479a4579d419315f1 Mon Sep 17 00:00:00 2001
|
||||
From: sewn <sewn@disroot.org>
|
||||
Date: Sun, 14 Apr 2024 08:47:04 +0300
|
||||
Subject: [PATCH] add border to bar
|
||||
|
||||
---
|
||||
config.def.h | 3 ++-
|
||||
dwl.c | 27 ++++++++++++++++-----------
|
||||
2 files changed, 18 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 0be3ad0..e5e595a 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -6,7 +6,7 @@
|
||||
/* appearance */
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||
-static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
+static const unsigned int borderpx = 1; /* border pixel of windows & bar */
|
||||
static const float rootcolor[] = COLOR(0x000000ff);
|
||||
static const float bordercolor[] = COLOR(0x444444ff);
|
||||
static const float focuscolor[] = COLOR(0x005577ff);
|
||||
@@ -19,6 +19,7 @@ static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = {"monospace:size=10"};
|
||||
static const char *fontattrs = "dpi=96";
|
||||
+static pixman_color_t borderbar = { 0x5555, 0x7777, 0x0000, 0xffff };
|
||||
static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff };
|
||||
static pixman_color_t normbarbg = { 0x2222, 0x2222, 0x2222, 0xffff };
|
||||
static pixman_color_t selbarfg = { 0xeeee, 0xeeee, 0xeeee, 0xffff };
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 54273ae..3153bfd 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -1344,7 +1344,8 @@ dirtomon(enum wlr_direction dir)
|
||||
void
|
||||
drawbar(Monitor *mon)
|
||||
{
|
||||
- int x, w, tw = 0;
|
||||
+ int x, y = borderpx, w, tw = 0;
|
||||
+ int mh, mw;
|
||||
int sel;
|
||||
int boxs = font->height / 9;
|
||||
int boxw = font->height / 6 + 2;
|
||||
@@ -1357,6 +1358,8 @@ drawbar(Monitor *mon)
|
||||
if (!mon || !mon->showbar)
|
||||
return;
|
||||
|
||||
+ mh = mon->b.height - borderpx * 2;
|
||||
+ mw = mon->b.width - borderpx * 2;
|
||||
stride = mon->b.width * 4;
|
||||
size = stride * mon->b.height;
|
||||
|
||||
@@ -1367,12 +1370,14 @@ drawbar(Monitor *mon)
|
||||
pix = pixman_image_create_bits(
|
||||
PIXMAN_a8r8g8b8, mon->b.width, mon->b.height, buf->data, stride);
|
||||
|
||||
+ drwl_rect(pix, 0, 0, mon->b.width, mon->b.height, 1, &borderbar);
|
||||
+
|
||||
/* draw status first so it can be overdrawn by tags later */
|
||||
if (mon == selmon) {
|
||||
if (stext[0] == '\0')
|
||||
strncpy(stext, "dwl-"VERSION, sizeof(stext));
|
||||
tw = TEXTW(stext) - lrpad;
|
||||
- drwl_text(pix, font, mon->b.width - tw, 0, tw, mon->b.height, 0,
|
||||
+ drwl_text(pix, font, borderpx + mw - tw, y, tw, mh, 0,
|
||||
stext, &normbarfg, &normbarbg);
|
||||
}
|
||||
|
||||
@@ -1384,37 +1389,37 @@ drawbar(Monitor *mon)
|
||||
urg |= c->tags;
|
||||
}
|
||||
c = focustop(mon);
|
||||
- x = 0;
|
||||
+ x = borderpx;
|
||||
for (i = 0; i < LENGTH(tags); i++) {
|
||||
w = TEXTW(tags[i]);
|
||||
sel = mon->tagset[mon->seltags] & 1 << i;
|
||||
|
||||
- drwl_text(pix, font, x, 0, w, mon->b.height, lrpad / 2, tags[i],
|
||||
+ drwl_text(pix, font, x, y, w, mh, lrpad / 2, tags[i],
|
||||
urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg),
|
||||
urg & 1 << i ? &selbarfg : (sel ? &selbarbg : &normbarbg));
|
||||
|
||||
if (occ & 1 << i)
|
||||
- drwl_rect(pix, x + boxs, boxs, boxw, boxw, sel,
|
||||
+ drwl_rect(pix, x + boxs, y + boxs, boxw, boxw, sel,
|
||||
urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg));
|
||||
|
||||
x += w;
|
||||
}
|
||||
|
||||
w = TEXTW(mon->ltsymbol);
|
||||
- x = drwl_text(pix, font, x, 0, w, mon->b.height, lrpad / 2,
|
||||
+ x = drwl_text(pix, font, x, y, w, mh, lrpad / 2,
|
||||
mon->ltsymbol, &normbarfg, &normbarbg);
|
||||
|
||||
- if ((w = mon->b.width - tw - x) > mon->b.height) {
|
||||
+ if ((w = mw - tw - x + borderpx) > mh) {
|
||||
if (c != NULL) {
|
||||
- drwl_text(pix, font, x, 0, w, mon->b.height, lrpad / 2,
|
||||
+ drwl_text(pix, font, x, y, w, mh, lrpad / 2,
|
||||
c ? client_get_title(c) : NULL,
|
||||
mon == selmon ? &selbarfg : &normbarfg,
|
||||
(mon == selmon && c) ? &selbarbg : &normbarbg);
|
||||
if (c && c->isfloating)
|
||||
- drwl_rect(pix, x + boxs, boxs, boxw, boxw, 0,
|
||||
+ drwl_rect(pix, x + boxs, y + boxs, boxw, boxw, 0,
|
||||
mon == selmon ? &selbarfg : &normbarfg);
|
||||
} else {
|
||||
- drwl_rect(pix, x, 0, w, mon->b.height, 1, &normbarbg);
|
||||
+ drwl_rect(pix, x, y, w, mh, 1, &normbarbg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2664,7 +2669,7 @@ setup(void)
|
||||
die("Could not load font");
|
||||
|
||||
lrpad = font->height;
|
||||
- bh = font->height + 2;
|
||||
+ bh = font->height + 2 + borderpx * 2;
|
||||
|
||||
status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy),
|
||||
STDIN_FILENO, WL_EVENT_READABLE, status_in, NULL);
|
||||
--
|
||||
2.44.0
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
From 225ce9045d0d2f101a33a61d741b466a240f30b8 Mon Sep 17 00:00:00 2001
|
||||
From: oak <oak@petrifiedoak.com>
|
||||
Date: Fri, 5 Apr 2024 14:29:10 +0200
|
||||
Subject: [PATCH] port barheight patch from dwm
|
||||
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwl.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 8fb2d68..2a90092 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -17,6 +17,7 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
/* bar */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
+static const int user_bh = 0; /* 0 means that dwl will calculate bar height, >= 1 means dwl will use user_bh as bar height */
|
||||
static const char *fonts[] = {"monospace:size=10"};
|
||||
static const char *fontattrs = "dpi=96";
|
||||
static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff };
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 056718d..4247f4c 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -2745,7 +2745,7 @@ setup(void)
|
||||
die("Could not load font");
|
||||
|
||||
lrpad = font->height;
|
||||
- bh = font->height + 2;
|
||||
+ bh = user_bh ? user_bh : font->height + 2;
|
||||
|
||||
status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy),
|
||||
STDIN_FILENO, WL_EVENT_READABLE, status_in, NULL);
|
||||
@@ -1,78 +0,0 @@
|
||||
From 7fe1a19287e1f40d90efd0c3b314c178cb27a571 Mon Sep 17 00:00:00 2001
|
||||
From: sewn <sewn@disroot.org>
|
||||
Date: Sun, 14 Apr 2024 08:02:56 +0300
|
||||
Subject: [PATCH] port barpadding patch to bar for dwl
|
||||
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
dwl.c | 13 ++++++++-----
|
||||
2 files changed, 10 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 0be3ad0..423330b 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -17,6 +17,8 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
/* bar */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
+static const int vertpad = 10; /* vertical padding of bar */
|
||||
+static const int sidepad = 10; /* horizontal padding of bar */
|
||||
static const char *fonts[] = {"monospace:size=10"};
|
||||
static const char *fontattrs = "dpi=96";
|
||||
static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff };
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 54273ae..b19d1a3 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -431,6 +431,7 @@ static struct wl_list mons;
|
||||
static Monitor *selmon;
|
||||
|
||||
static struct fcft_font *font;
|
||||
+static int vp, sp;
|
||||
static int bh;
|
||||
static int lrpad;
|
||||
static char stext[256];
|
||||
@@ -569,8 +570,8 @@ arrangelayers(Monitor *m)
|
||||
return;
|
||||
|
||||
if (m->showbar) {
|
||||
- usable_area.height -= m->b.height;
|
||||
- usable_area.y += topbar ? m->b.height : 0;
|
||||
+ usable_area.height = usable_area.height - vertpad - m->b.height;
|
||||
+ usable_area.y = topbar ? usable_area.y + m->b.height + vp : usable_area.y;
|
||||
}
|
||||
|
||||
/* Arrange exclusive surfaces from top->bottom */
|
||||
@@ -1419,8 +1420,8 @@ drawbar(Monitor *mon)
|
||||
}
|
||||
|
||||
pixman_image_unref(pix);
|
||||
- wlr_scene_node_set_position(&mon->scene_buffer->node, mon->m.x,
|
||||
- mon->m.y + (topbar ? 0 : mon->m.height - mon->b.height));
|
||||
+ wlr_scene_node_set_position(&mon->scene_buffer->node, mon->m.x + sp,
|
||||
+ mon->m.y + vp + (topbar ? 0 : mon->m.height - mon->b.height));
|
||||
wlr_scene_buffer_set_buffer(mon->scene_buffer, &buf->base);
|
||||
wlr_buffer_drop(&buf->base);
|
||||
}
|
||||
@@ -2665,6 +2666,8 @@ setup(void)
|
||||
|
||||
lrpad = font->height;
|
||||
bh = font->height + 2;
|
||||
+ sp = sidepad;
|
||||
+ vp = (topbar == 1) ? vertpad : - vertpad;
|
||||
|
||||
status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy),
|
||||
STDIN_FILENO, WL_EVENT_READABLE, status_in, NULL);
|
||||
@@ -3004,7 +3007,7 @@ updatebardims(Monitor *m)
|
||||
{
|
||||
int rw, rh;
|
||||
wlr_output_effective_resolution(m->wlr_output, &rw, &rh);
|
||||
- m->b.width = rw;
|
||||
+ m->b.width = rw - 2 * sp;
|
||||
m->b.height = bh;
|
||||
}
|
||||
|
||||
--
|
||||
2.44.0
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
From ff29aba2f45d5acdee66efaf7cf94ab66145c0ed Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Thu, 11 Apr 2024 14:19:24 -0500
|
||||
Subject: [PATCH] rules for floating windows support default x, y, width,
|
||||
height If the width or height is less than or equal to 1, then the value will
|
||||
be interpreted as a percentage. For example, 0.5 represents 50%, 0.25
|
||||
represents 25%, and 1 represents 100%. NOTE: Some clients, like Thunar, have
|
||||
minimum width/height
|
||||
|
||||
`floating_relative_to_monitor` allows the user to choose whether to position relative to the monitor or relative to the window area.
|
||||
---
|
||||
config.def.h | 7 ++++---
|
||||
dwl.c | 16 ++++++++++++++++
|
||||
2 files changed, 20 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 8847e58..ebaf1ab 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -13,6 +13,7 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
||||
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
||||
+static const int floating_relative_to_monitor = 0; /* 0 means center floating relative to the window area */
|
||||
|
||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||
#define TAGCOUNT (9)
|
||||
@@ -21,10 +22,10 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
static int log_level = WLR_ERROR;
|
||||
|
||||
static const Rule rules[] = {
|
||||
- /* app_id title tags mask isfloating monitor */
|
||||
+ /* app_id title tags mask isfloating monitor x y width height */
|
||||
/* examples: */
|
||||
- { "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
||||
- { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
|
||||
+ { "Gimp_EXAMPLE", NULL, 0, 1, -1, 0, 0, 1000, 0.75 }, /* Start on currently visible tags floating, not tiled */
|
||||
+ { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1, 0, 0, 0, 0 },/* Start on ONLY tag "9" */
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index bf763df..94e4d7d 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -228,6 +228,10 @@ typedef struct {
|
||||
uint32_t tags;
|
||||
int isfloating;
|
||||
int monitor;
|
||||
+ int x;
|
||||
+ int y;
|
||||
+ float w;
|
||||
+ float h;
|
||||
} Rule;
|
||||
|
||||
typedef struct {
|
||||
@@ -468,6 +472,18 @@ applyrules(Client *c)
|
||||
if (r->monitor == i++)
|
||||
mon = m;
|
||||
}
|
||||
+ if (c->isfloating) {
|
||||
+ struct wlr_box b = floating_relative_to_monitor ? mon->m : mon->w;
|
||||
+ int newwidth = ROUND(r->w ? (r->w <= 1 ? b.width * r->w : r->w) : c->geom.width);
|
||||
+ int newheight = ROUND(r->h ? (r->h <= 1 ? b.height * r->h : r->h) : c->geom.height);
|
||||
+
|
||||
+ resize(c, (struct wlr_box){
|
||||
+ .x = r->x ? r->x + b.x : (b.width - newwidth) / 2 + b.x,
|
||||
+ .y = r->y ? r->y + b.y : (b.height - newheight) / 2 + b.y,
|
||||
+ .width = newwidth,
|
||||
+ .height = newheight,
|
||||
+ }, 1);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
setmon(c, mon, newtags);
|
||||
--
|
||||
2.43.2
|
||||
@@ -1,75 +0,0 @@
|
||||
From 6337cf36554eda98f3d160ef4fdd12eb042f4120 Mon Sep 17 00:00:00 2001
|
||||
From: sewn <sewn@disroot.org>
|
||||
Date: Sun, 14 Apr 2024 07:58:53 +0300
|
||||
Subject: [PATCH] port hide vacant tags patch
|
||||
|
||||
---
|
||||
dwl.c | 25 ++++++++++++++++---------
|
||||
1 file changed, 16 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 54273ae..7db6273 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -651,7 +651,7 @@ void buffer_end_data_ptr_access(struct wlr_buffer *buffer) {
|
||||
void
|
||||
buttonpress(struct wl_listener *listener, void *data)
|
||||
{
|
||||
- unsigned int i = 0, x = 0;
|
||||
+ unsigned int i = 0, x = 0, occ = 0;
|
||||
unsigned int click;
|
||||
struct wlr_pointer_button_event *event = data;
|
||||
struct wlr_keyboard *keyboard;
|
||||
@@ -672,9 +672,17 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
if ((node = wlr_scene_node_at(&layers[LyrBottom]->node, cursor->x, cursor->y, NULL, NULL)) &&
|
||||
(buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) {
|
||||
x = selmon->m.x;
|
||||
- do
|
||||
- x += TEXTW(tags[i]);
|
||||
- while (cursor->x >= x && ++i < LENGTH(tags));
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (c->mon != selmon)
|
||||
+ continue;
|
||||
+ occ |= c->tags == TAGMASK ? 0 : c->tags;
|
||||
+ }
|
||||
+ do {
|
||||
+ /* Do not reserve space for vacant tags */
|
||||
+ if (!(occ & 1 << i || selmon->tagset[selmon->seltags] & 1 << i))
|
||||
+ continue;
|
||||
+ x += TEXTW(tags[i]);
|
||||
+ } while (cursor->x >= x && ++i < LENGTH(tags));
|
||||
if (i < LENGTH(tags)) {
|
||||
click = ClkTagBar;
|
||||
arg.ui = 1 << i;
|
||||
@@ -1379,13 +1387,16 @@ drawbar(Monitor *mon)
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (c->mon != mon)
|
||||
continue;
|
||||
- occ |= c->tags;
|
||||
+ occ |= c->tags == TAGMASK ? 0 : c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
}
|
||||
c = focustop(mon);
|
||||
x = 0;
|
||||
for (i = 0; i < LENGTH(tags); i++) {
|
||||
+ /* Do not draw vacant tags */
|
||||
+ if(!(occ & 1 << i || mon->tagset[mon->seltags] & 1 << i))
|
||||
+ continue;
|
||||
w = TEXTW(tags[i]);
|
||||
sel = mon->tagset[mon->seltags] & 1 << i;
|
||||
|
||||
@@ -1393,10 +1404,6 @@ drawbar(Monitor *mon)
|
||||
urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg),
|
||||
urg & 1 << i ? &selbarfg : (sel ? &selbarbg : &normbarbg));
|
||||
|
||||
- if (occ & 1 << i)
|
||||
- drwl_rect(pix, x + boxs, boxs, boxw, boxw, sel,
|
||||
- urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg));
|
||||
-
|
||||
x += w;
|
||||
}
|
||||
|
||||
--
|
||||
2.44.0
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
From a0c758953fe0cbb20ea74d0acfa3e44b8173d12d Mon Sep 17 00:00:00 2001
|
||||
From: ForzCross <forzcross@gmail.com>
|
||||
Date: Sun, 21 Jan 2024 15:52:31 +0300
|
||||
Subject: [PATCH] Add per client keyboard layout and status bar info
|
||||
|
||||
---
|
||||
config.def.h | 3 +++
|
||||
dwl.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 67 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 9009517..81bb10d 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -13,6 +13,9 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
||||
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */
|
||||
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
||||
+/* keyboard layout change notification for status bar */
|
||||
+static const char kblayout_file[] = "/tmp/dwl-keymap";
|
||||
+static const char *kblayout_cmd[] = {"pkill", "-RTMIN+3", "someblocks", NULL};
|
||||
|
||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||
#define TAGCOUNT (9)
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index bf02a6d..17c8fa4 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -135,6 +135,7 @@ typedef struct {
|
||||
uint32_t tags;
|
||||
int isfloating, isurgent, isfullscreen;
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
+ xkb_layout_index_t layout_idx;
|
||||
} Client;
|
||||
|
||||
typedef struct {
|
||||
@@ -155,6 +156,7 @@ typedef struct {
|
||||
|
||||
struct wl_listener modifiers;
|
||||
struct wl_listener key;
|
||||
+ xkb_layout_index_t layout_idx;
|
||||
} KeyboardGroup;
|
||||
|
||||
typedef struct {
|
||||
@@ -273,6 +275,7 @@ static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||
static void handlesig(int signo);
|
||||
static void incnmaster(const Arg *arg);
|
||||
static void inputdevice(struct wl_listener *listener, void *data);
|
||||
+static void kblayoutnotify(KeyboardGroup *kb, int update);
|
||||
static int keybinding(uint32_t mods, xkb_keysym_t sym);
|
||||
static void keypress(struct wl_listener *listener, void *data);
|
||||
static void keypressmod(struct wl_listener *listener, void *data);
|
||||
@@ -385,6 +388,8 @@ static struct wlr_box sgeom;
|
||||
static struct wl_list mons;
|
||||
static Monitor *selmon;
|
||||
|
||||
+xkb_layout_index_t status_layout_idx = -1;
|
||||
+
|
||||
#ifdef XWAYLAND
|
||||
static void activatex11(struct wl_listener *listener, void *data);
|
||||
static void associatex11(struct wl_listener *listener, void *data);
|
||||
@@ -772,6 +777,7 @@ createkeyboard(struct wlr_keyboard *keyboard)
|
||||
|
||||
/* Add the new keyboard to the group */
|
||||
wlr_keyboard_group_add_keyboard(kb_group.wlr_group, keyboard);
|
||||
+ kblayoutnotify(&kb_group, 1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -927,6 +933,7 @@ createnotify(struct wl_listener *listener, void *data)
|
||||
struct wlr_xdg_surface *xdg_surface = data;
|
||||
Client *c = NULL;
|
||||
LayerSurface *l = NULL;
|
||||
+ struct wlr_keyboard *kb = wlr_seat_get_keyboard(seat);
|
||||
|
||||
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
||||
struct wlr_xdg_popup *popup = xdg_surface->popup;
|
||||
@@ -949,6 +956,9 @@ createnotify(struct wl_listener *listener, void *data)
|
||||
c = xdg_surface->data = ecalloc(1, sizeof(*c));
|
||||
c->surface.xdg = xdg_surface;
|
||||
c->bw = borderpx;
|
||||
+ c->layout_idx = kb
|
||||
+ ? xkb_state_serialize_layout(kb->xkb_state, XKB_STATE_LAYOUT_EFFECTIVE)
|
||||
+ : 0;
|
||||
|
||||
wlr_xdg_toplevel_set_wm_capabilities(xdg_surface->toplevel,
|
||||
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
|
||||
@@ -1165,6 +1175,9 @@ focusclient(Client *c, int lift)
|
||||
int unused_lx, unused_ly, old_client_type;
|
||||
Client *old_c = NULL;
|
||||
LayerSurface *old_l = NULL;
|
||||
+ xkb_mod_mask_t mdepr, mlatc, mlock;
|
||||
+ xkb_layout_index_t ldepr, llatc, llock;
|
||||
+ struct wlr_keyboard *kb = wlr_seat_get_keyboard(seat);
|
||||
|
||||
if (locked)
|
||||
return;
|
||||
@@ -1217,6 +1230,17 @@ focusclient(Client *c, int lift)
|
||||
}
|
||||
printstatus();
|
||||
|
||||
+ /* Update keyboard layout */
|
||||
+ if (kb) {
|
||||
+ mdepr = xkb_state_serialize_mods(kb->xkb_state, XKB_STATE_MODS_DEPRESSED);
|
||||
+ mlatc = xkb_state_serialize_mods(kb->xkb_state, XKB_STATE_MODS_LATCHED);
|
||||
+ mlock = xkb_state_serialize_mods(kb->xkb_state, XKB_STATE_MODS_LOCKED);
|
||||
+ ldepr = xkb_state_serialize_layout(kb->xkb_state, XKB_STATE_LAYOUT_DEPRESSED);
|
||||
+ llatc = xkb_state_serialize_layout(kb->xkb_state, XKB_STATE_LAYOUT_LATCHED);
|
||||
+ llock = c ? c->layout_idx : 0;
|
||||
+ xkb_state_update_mask(kb->xkb_state, mdepr, mlatc, mlock, ldepr, llatc, llock);
|
||||
+ }
|
||||
+
|
||||
if (!c) {
|
||||
/* With no client, all we have left is to clear focus */
|
||||
wlr_seat_keyboard_notify_clear_focus(seat);
|
||||
@@ -1227,7 +1251,7 @@ focusclient(Client *c, int lift)
|
||||
motionnotify(0);
|
||||
|
||||
/* Have a client, so focus its top-level wlr_surface */
|
||||
- client_notify_enter(client_surface(c), wlr_seat_get_keyboard(seat));
|
||||
+ client_notify_enter(client_surface(c), kb);
|
||||
|
||||
/* Activate the new client */
|
||||
client_activate_surface(client_surface(c), 1);
|
||||
@@ -1352,6 +1376,41 @@ inputdevice(struct wl_listener *listener, void *data)
|
||||
wlr_seat_set_capabilities(seat, caps);
|
||||
}
|
||||
|
||||
+void
|
||||
+kblayoutnotify(KeyboardGroup *kb, int update)
|
||||
+{
|
||||
+ FILE *f;
|
||||
+ Client *c;
|
||||
+ xkb_layout_index_t old = kb->layout_idx;
|
||||
+
|
||||
+ if (update) {
|
||||
+ kb->layout_idx = xkb_state_serialize_layout(kb->wlr_group->keyboard.xkb_state,
|
||||
+ XKB_STATE_LAYOUT_EFFECTIVE);
|
||||
+
|
||||
+ // Update client layout
|
||||
+ if (kb->layout_idx != old && (c = focustop(selmon)))
|
||||
+ c->layout_idx = kb->layout_idx;
|
||||
+ }
|
||||
+
|
||||
+ // If layout did not change, do nothing
|
||||
+ if (status_layout_idx == kb->layout_idx)
|
||||
+ return;
|
||||
+ status_layout_idx = kb->layout_idx;
|
||||
+
|
||||
+ // Save current layout to kblayout_file
|
||||
+ if (*kblayout_file && (f = fopen(kblayout_file, "w"))) {
|
||||
+ fputs(xkb_keymap_layout_get_name(kb->wlr_group->keyboard.keymap,
|
||||
+ kb->layout_idx), f);
|
||||
+ fclose(f);
|
||||
+ }
|
||||
+
|
||||
+ // Run kblayout_cmd
|
||||
+ if (kblayout_cmd[0] && fork() == 0) {
|
||||
+ execvp(kblayout_cmd[0], (char *const *)kblayout_cmd);
|
||||
+ die("dwl: execvp %s failed:", kblayout_cmd[0]);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
int
|
||||
keybinding(uint32_t mods, xkb_keysym_t sym)
|
||||
{
|
||||
@@ -1391,6 +1450,8 @@ keypress(struct wl_listener *listener, void *data)
|
||||
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
|
||||
+ kblayoutnotify(group, 0);
|
||||
+
|
||||
/* On _press_ if there is no active screen locker,
|
||||
* attempt to process a compositor keybinding. */
|
||||
if (!locked && event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||
@@ -1429,6 +1490,8 @@ keypressmod(struct wl_listener *listener, void *data)
|
||||
/* Send modifiers to the client. */
|
||||
wlr_seat_keyboard_notify_modifiers(seat,
|
||||
&group->wlr_group->keyboard.modifiers);
|
||||
+
|
||||
+ kblayoutnotify(group, 1);
|
||||
}
|
||||
|
||||
int
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,598 +0,0 @@
|
||||
From 8e58ce22afe6a7cca34ff69d8862c89497156f40 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
||||
<leohdz172@proton.me>
|
||||
Date: Fri, 4 Jun 2021 16:51:01 -0500
|
||||
Subject: [PATCH 1/2] allow use keycodes instead keysyms
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
||||
---
|
||||
config.def.h | 85 +++++++++---------
|
||||
dwl.c | 35 +++-----
|
||||
keys.h | 242 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 297 insertions(+), 65 deletions(-)
|
||||
create mode 100644 keys.h
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a8ed61d..40e13af 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -104,11 +104,11 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
|
||||
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
|
||||
#define MODKEY WLR_MODIFIER_ALT
|
||||
|
||||
-#define TAGKEYS(KEY,SKEY,TAG) \
|
||||
+#define TAGKEYS(KEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|WLR_MODIFIER_CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
- { MODKEY|WLR_MODIFIER_SHIFT, SKEY, tag, {.ui = 1 << TAG} }, \
|
||||
- { MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} }
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, KEY, tag, {.ui = 1 << TAG} }, \
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,KEY,toggletag, {.ui = 1 << TAG} }
|
||||
|
||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
@@ -117,51 +117,52 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
|
||||
static const char *termcmd[] = { "foot", NULL };
|
||||
static const char *menucmd[] = { "bemenu-run", NULL };
|
||||
|
||||
+#include "keys.h"
|
||||
static const Key keys[] = {
|
||||
- /* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
|
||||
- /* modifier key function argument */
|
||||
- { MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
|
||||
- { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
||||
- { MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||
- { MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||
- { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
- { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||
- { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
|
||||
- { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} },
|
||||
- { MODKEY, XKB_KEY_Return, zoom, {0} },
|
||||
- { MODKEY, XKB_KEY_Tab, view, {0} },
|
||||
- { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
||||
- { MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||
- { MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||
- { MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||
- { MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||
- { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||
- { MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
- { MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
||||
- { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
||||
- { MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
- { MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||
- { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
- { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||
- TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
||||
- TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
||||
- TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
||||
- TAGKEYS( XKB_KEY_4, XKB_KEY_dollar, 3),
|
||||
- TAGKEYS( XKB_KEY_5, XKB_KEY_percent, 4),
|
||||
- TAGKEYS( XKB_KEY_6, XKB_KEY_asciicircum, 5),
|
||||
- TAGKEYS( XKB_KEY_7, XKB_KEY_ampersand, 6),
|
||||
- TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
|
||||
- TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8),
|
||||
- { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q, quit, {0} },
|
||||
+ /* modifier key function argument */
|
||||
+ { MODKEY, Key_p, spawn, {.v = menucmd} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, Key_Return, spawn, {.v = termcmd} },
|
||||
+ { MODKEY, Key_j, focusstack, {.i = +1} },
|
||||
+ { MODKEY, Key_k, focusstack, {.i = -1} },
|
||||
+ { MODKEY, Key_i, incnmaster, {.i = +1} },
|
||||
+ { MODKEY, Key_d, incnmaster, {.i = -1} },
|
||||
+ { MODKEY, Key_h, setmfact, {.f = -0.05} },
|
||||
+ { MODKEY, Key_l, setmfact, {.f = +0.05} },
|
||||
+ { MODKEY, Key_Return, zoom, {0} },
|
||||
+ { MODKEY, Key_Tab, view, {0} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, Key_c, killclient, {0} },
|
||||
+ { MODKEY, Key_t, setlayout, {.v = &layouts[0]} },
|
||||
+ { MODKEY, Key_f, setlayout, {.v = &layouts[1]} },
|
||||
+ { MODKEY, Key_m, setlayout, {.v = &layouts[2]} },
|
||||
+ { MODKEY, Key_space, setlayout, {0} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, Key_space, togglefloating, {0} },
|
||||
+ { MODKEY, Key_e, togglefullscreen, {0} },
|
||||
+ { MODKEY, Key_0, view, {.ui = ~0} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, Key_0, tag, {.ui = ~0} },
|
||||
+ { MODKEY, Key_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
+ { MODKEY, Key_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, Key_comma, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, Key_period, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||
+ TAGKEYS( Key_1, 0),
|
||||
+ TAGKEYS( Key_2, 1),
|
||||
+ TAGKEYS( Key_3, 2),
|
||||
+ TAGKEYS( Key_4, 3),
|
||||
+ TAGKEYS( Key_5, 4),
|
||||
+ TAGKEYS( Key_6, 5),
|
||||
+ TAGKEYS( Key_7, 6),
|
||||
+ TAGKEYS( Key_8, 7),
|
||||
+ TAGKEYS( Key_9, 8),
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, Key_q, quit, {0} },
|
||||
|
||||
/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
|
||||
- { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} },
|
||||
+ { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,Key_BackSpace, quit, {0} },
|
||||
+#define CHVT(KEY,n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT, KEY, chvt, {.ui = (n)} }
|
||||
/* Ctrl-Alt-Fx is used to switch to another VT, if you don't know what a VT is
|
||||
* do not remove them.
|
||||
*/
|
||||
-#define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }
|
||||
- CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
|
||||
- CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
|
||||
+ CHVT(Key_F1, 1), CHVT(Key_F2, 2), CHVT(Key_F3, 3), CHVT(Key_F4, 4),
|
||||
+ CHVT(Key_F5, 5), CHVT(Key_F6, 6), CHVT(Key_F7, 7), CHVT(Key_F8, 8),
|
||||
+ CHVT(Key_F9, 9), CHVT(Key_F10, 10), CHVT(Key_F11, 11), CHVT(Key_F12, 12),
|
||||
};
|
||||
|
||||
static const Button buttons[] = {
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 10d5a5b..33fb251 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -138,7 +138,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
uint32_t mod;
|
||||
- xkb_keysym_t keysym;
|
||||
+ xkb_keycode_t keycode;
|
||||
void (*func)(const Arg *);
|
||||
const Arg arg;
|
||||
} Key;
|
||||
@@ -147,9 +147,8 @@ typedef struct {
|
||||
struct wl_list link;
|
||||
struct wlr_keyboard_group *wlr_group;
|
||||
|
||||
- int nsyms;
|
||||
- const xkb_keysym_t *keysyms; /* invalid if nsyms == 0 */
|
||||
- uint32_t mods; /* invalid if nsyms == 0 */
|
||||
+ xkb_keycode_t keycode;
|
||||
+ uint32_t mods; /* invalid if keycode == 0 */
|
||||
struct wl_event_source *key_repeat_source;
|
||||
|
||||
struct wl_listener modifiers;
|
||||
@@ -272,7 +271,7 @@ static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||
static void handlesig(int signo);
|
||||
static void incnmaster(const Arg *arg);
|
||||
static void inputdevice(struct wl_listener *listener, void *data);
|
||||
-static int keybinding(uint32_t mods, xkb_keysym_t sym);
|
||||
+static int keybinding(uint32_t mods, xkb_keycode_t keycode);
|
||||
static void keypress(struct wl_listener *listener, void *data);
|
||||
static void keypressmod(struct wl_listener *listener, void *data);
|
||||
static int keyrepeat(void *data);
|
||||
@@ -1351,7 +1350,7 @@ inputdevice(struct wl_listener *listener, void *data)
|
||||
}
|
||||
|
||||
int
|
||||
-keybinding(uint32_t mods, xkb_keysym_t sym)
|
||||
+keybinding(uint32_t mods, xkb_keycode_t keycode)
|
||||
{
|
||||
/*
|
||||
* Here we handle compositor keybindings. This is when the compositor is
|
||||
@@ -1361,7 +1360,7 @@ keybinding(uint32_t mods, xkb_keysym_t sym)
|
||||
const Key *k;
|
||||
for (k = keys; k < END(keys); k++) {
|
||||
if (CLEANMASK(mods) == CLEANMASK(k->mod)
|
||||
- && sym == k->keysym && k->func) {
|
||||
+ && keycode == k->keycode && k->func) {
|
||||
k->func(&k->arg);
|
||||
return 1;
|
||||
}
|
||||
@@ -1372,17 +1371,12 @@ keybinding(uint32_t mods, xkb_keysym_t sym)
|
||||
void
|
||||
keypress(struct wl_listener *listener, void *data)
|
||||
{
|
||||
- int i;
|
||||
/* This event is raised when a key is pressed or released. */
|
||||
KeyboardGroup *group = wl_container_of(listener, group, key);
|
||||
struct wlr_keyboard_key_event *event = data;
|
||||
|
||||
/* Translate libinput keycode -> xkbcommon */
|
||||
uint32_t keycode = event->keycode + 8;
|
||||
- /* Get a list of keysyms based on the keymap for this keyboard */
|
||||
- const xkb_keysym_t *syms;
|
||||
- int nsyms = xkb_state_key_get_syms(
|
||||
- group->wlr_group->keyboard.xkb_state, keycode, &syms);
|
||||
|
||||
int handled = 0;
|
||||
uint32_t mods = wlr_keyboard_get_modifiers(&group->wlr_group->keyboard);
|
||||
@@ -1391,19 +1385,16 @@ keypress(struct wl_listener *listener, void *data)
|
||||
|
||||
/* On _press_ if there is no active screen locker,
|
||||
* attempt to process a compositor keybinding. */
|
||||
- if (!locked && event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||
- for (i = 0; i < nsyms; i++)
|
||||
- handled = keybinding(mods, syms[i]) || handled;
|
||||
- }
|
||||
+ if (!locked && event->state == WL_KEYBOARD_KEY_STATE_PRESSED)
|
||||
+ handled = keybinding(mods, keycode);
|
||||
|
||||
if (handled && group->wlr_group->keyboard.repeat_info.delay > 0) {
|
||||
group->mods = mods;
|
||||
- group->keysyms = syms;
|
||||
- group->nsyms = nsyms;
|
||||
+ group->keycode = keycode;
|
||||
wl_event_source_timer_update(group->key_repeat_source,
|
||||
group->wlr_group->keyboard.repeat_info.delay);
|
||||
} else {
|
||||
- group->nsyms = 0;
|
||||
+ group->keycode = 0;
|
||||
wl_event_source_timer_update(group->key_repeat_source, 0);
|
||||
}
|
||||
|
||||
@@ -1433,15 +1424,13 @@ int
|
||||
keyrepeat(void *data)
|
||||
{
|
||||
KeyboardGroup *group = data;
|
||||
- int i;
|
||||
- if (!group->nsyms || group->wlr_group->keyboard.repeat_info.rate <= 0)
|
||||
+ if (!group->keycode || group->wlr_group->keyboard.repeat_info.rate <= 0)
|
||||
return 0;
|
||||
|
||||
wl_event_source_timer_update(group->key_repeat_source,
|
||||
1000 / group->wlr_group->keyboard.repeat_info.rate);
|
||||
|
||||
- for (i = 0; i < group->nsyms; i++)
|
||||
- keybinding(group->mods, group->keysyms[i]);
|
||||
+ keybinding(group->mods, group->keycode);
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff --git a/keys.h b/keys.h
|
||||
new file mode 100644
|
||||
index 0000000..e732f80
|
||||
--- /dev/null
|
||||
+++ b/keys.h
|
||||
@@ -0,0 +1,242 @@
|
||||
+/* You can use the macros within this file
|
||||
+ * instead of search the keycodes yourself
|
||||
+ * with wev or something like that
|
||||
+ * Also probably you search this:
|
||||
+ * Key_XF86AudioMute
|
||||
+ * Key_XF86AudioLowerVolume
|
||||
+ * Key_XF86AudioRaiseVolume
|
||||
+ * Key_XF86MonBrightnessDown
|
||||
+ * Key_XF86MonBrightnessUp
|
||||
+*/
|
||||
+
|
||||
+#define Key_Escape 9
|
||||
+#define Key_1 10
|
||||
+#define Key_2 11
|
||||
+#define Key_3 12
|
||||
+#define Key_4 13
|
||||
+#define Key_5 14
|
||||
+#define Key_6 15
|
||||
+#define Key_7 16
|
||||
+#define Key_8 17
|
||||
+#define Key_9 18
|
||||
+#define Key_0 19
|
||||
+#define Key_minus 20
|
||||
+#define Key_equal 21
|
||||
+#define Key_BackSpace 22
|
||||
+#define Key_Tab 23
|
||||
+#define Key_q 24
|
||||
+#define Key_w 25
|
||||
+#define Key_e 26
|
||||
+#define Key_r 27
|
||||
+#define Key_t 28
|
||||
+#define Key_y 29
|
||||
+#define Key_u 30
|
||||
+#define Key_i 31
|
||||
+#define Key_o 32
|
||||
+#define Key_p 33
|
||||
+#define Key_bracketleft 34
|
||||
+#define Key_bracketright 35
|
||||
+#define Key_Return 36
|
||||
+#define Key_Control_L 37
|
||||
+#define Key_a 38
|
||||
+#define Key_s 39
|
||||
+#define Key_d 40
|
||||
+#define Key_f 41
|
||||
+#define Key_g 42
|
||||
+#define Key_h 43
|
||||
+#define Key_j 44
|
||||
+#define Key_k 45
|
||||
+#define Key_l 46
|
||||
+#define Key_semicolon 47
|
||||
+#define Key_apostrophe 48
|
||||
+#define Key_grave 49
|
||||
+#define Key_Shift_L 50
|
||||
+#define Key_backslash 51
|
||||
+#define Key_z 52
|
||||
+#define Key_x 53
|
||||
+#define Key_c 54
|
||||
+#define Key_v 55
|
||||
+#define Key_b 56
|
||||
+#define Key_n 57
|
||||
+#define Key_m 58
|
||||
+#define Key_comma 59
|
||||
+#define Key_period 60
|
||||
+#define Key_slash 61
|
||||
+#define Key_Shift_R 62
|
||||
+#define Key_KP_Multiply 63
|
||||
+#define Key_Alt_L 64
|
||||
+#define Key_space 65
|
||||
+#define Key_Caps_Lock 66
|
||||
+#define Key_F1 67
|
||||
+#define Key_F2 68
|
||||
+#define Key_F3 69
|
||||
+#define Key_F4 70
|
||||
+#define Key_F5 71
|
||||
+#define Key_F6 72
|
||||
+#define Key_F7 73
|
||||
+#define Key_F8 74
|
||||
+#define Key_F9 75
|
||||
+#define Key_F10 76
|
||||
+#define Key_Num_Lock 77
|
||||
+#define Key_Scroll_Lock 78
|
||||
+#define Key_KP_Home 79
|
||||
+#define Key_KP_7 Key_KP_Home
|
||||
+#define Key_KP_Up 80
|
||||
+#define Key_KP_8 Key_KP_Up
|
||||
+#define Key_KP_Prior 81
|
||||
+#define Key_KP_9 Key_KP_Prior
|
||||
+#define Key_KP_Subtract 82
|
||||
+#define Key_KP_Left 83
|
||||
+#define Key_KP_4 Key_KP_Left
|
||||
+#define Key_KP_Begin 84
|
||||
+#define Key_KP_5 Key_KP_Begin
|
||||
+#define Key_KP_Right 85
|
||||
+#define Key_KP_6 Key_KP_Right
|
||||
+#define Key_KP_Add 86
|
||||
+#define Key_KP_End 87
|
||||
+#define Key_KP_1 Key_KP_End
|
||||
+#define Key_KP_Down 88
|
||||
+#define Key_KP_2 Key_KP_Down
|
||||
+#define Key_KP_Next 89
|
||||
+#define Key_KP_3 Key_KP_Next
|
||||
+#define Key_KP_Insert 90
|
||||
+#define Key_KP_0 Key_KP_Insert
|
||||
+#define Key_KP_Delete 91
|
||||
+#define Key_KP_Period Key_KP_Insert
|
||||
+#define Key_ISO_Level3_Shift 92
|
||||
+#define Key_less 94
|
||||
+#define Key_F11 95
|
||||
+#define Key_F12 96
|
||||
+#define Key_Katakana 98
|
||||
+#define Key_Hiragana 99
|
||||
+#define Key_Henkan_Mode 100
|
||||
+#define Key_Hiragana_Katakana 101
|
||||
+#define Key_Muhenkan 102
|
||||
+#define Key_KP_Enter 104
|
||||
+#define Key_Control_R 105
|
||||
+#define Key_KP_Divide 106
|
||||
+#define Key_Print 107
|
||||
+#define Key_Alt_R 108
|
||||
+#define Key_Linefeed 109
|
||||
+#define Key_Home 110
|
||||
+#define Key_Up 111
|
||||
+#define Key_Prior 112
|
||||
+#define Key_Left 113
|
||||
+#define Key_Right 114
|
||||
+#define Key_End 115
|
||||
+#define Key_Down 116
|
||||
+#define Key_Next 117
|
||||
+#define Key_Insert 118
|
||||
+#define Key_Delete 119
|
||||
+#define Key_XF86AudioMute 121
|
||||
+#define Key_XF86AudioLowerVolume 122
|
||||
+#define Key_XF86AudioRaiseVolume 123
|
||||
+#define Key_XF86PowerOff 124
|
||||
+#define Key_KP_Equal 125
|
||||
+#define Key_plusminus 126
|
||||
+#define Key_Pause 127
|
||||
+#define Key_XF86LaunchA 128
|
||||
+#define Key_KP_Decimal 129
|
||||
+#define Key_Hangul 130
|
||||
+#define Key_Hangul_Hanja 131
|
||||
+#define Key_Super_L 133
|
||||
+#define Key_Super_R 134
|
||||
+#define Key_Menu 135
|
||||
+#define Key_Cancel 136
|
||||
+#define Key_Redo 137
|
||||
+#define Key_SunProps 138
|
||||
+#define Key_Undo 139
|
||||
+#define Key_SunFront 140
|
||||
+#define Key_XF86Copy 141
|
||||
+#define Key_XF86Open 142
|
||||
+#define Key_XF86Paste 143
|
||||
+#define Key_Find 144
|
||||
+#define Key_XF86Cut 145
|
||||
+#define Key_Help 146
|
||||
+#define Key_XF86MenuKB 147
|
||||
+#define Key_XF86Calculator 148
|
||||
+#define Key_XF86Sleep 150
|
||||
+#define Key_XF86WakeUp 151
|
||||
+#define Key_XF86Explorer 152
|
||||
+#define Key_XF86Send 153
|
||||
+#define Key_XF86Xfer 155
|
||||
+#define Key_XF86Launch1 156
|
||||
+#define Key_XF86Launch2 157
|
||||
+#define Key_XF86WWW 158
|
||||
+#define Key_XF86DOS 159
|
||||
+#define Key_XF86ScreenSaver 160
|
||||
+#define Key_XF86RotateWindows 161
|
||||
+#define Key_XF86TaskPane 162
|
||||
+#define Key_XF86Mail 163
|
||||
+#define Key_XF86Favorites 164
|
||||
+#define Key_XF86MyComputer 165
|
||||
+#define Key_XF86Back 166
|
||||
+#define Key_XF86Forward 167
|
||||
+#define Key_XF86Eject1 169
|
||||
+#define Key_XF86Eject2 170
|
||||
+#define Key_XF86AudioNext 171
|
||||
+#define Key_XF86AudioPlay 172
|
||||
+#define Key_XF86AudioPrev 173
|
||||
+#define Key_XF86AudioStop 174
|
||||
+#define Key_XF86AudioRecord 175
|
||||
+#define Key_XF86AudioRewind 176
|
||||
+#define Key_XF86Phone 177
|
||||
+#define Key_XF86Tools 179
|
||||
+#define Key_XF86HomePage 180
|
||||
+#define Key_XF86Reload 181
|
||||
+#define Key_XF86Close 182
|
||||
+#define Key_XF86ScrollUp 185
|
||||
+#define Key_XF86ScrollDown 186
|
||||
+#define Key_parenleft 187
|
||||
+#define Key_parenright 188
|
||||
+#define Key_XF86New 189
|
||||
+#define Key_Redo2 190
|
||||
+#define Key_XF86Tools2 191
|
||||
+#define Key_XF86Launch5 192
|
||||
+#define Key_XF86Launch6 193
|
||||
+#define Key_XF86Launch7 194
|
||||
+#define Key_XF86Launch8 195
|
||||
+#define Key_XF86Launch9 196
|
||||
+#define Key_XF86AudioMicMute 198
|
||||
+#define Key_XF86TouchpadToggle 199
|
||||
+#define Key_XF86TouchpadOn 200
|
||||
+#define Key_XF86TouchpadOff 201
|
||||
+#define Key_Mode_switch 203
|
||||
+#define Key_XF86AudioPlay2 208
|
||||
+#define Key_XF86AudioPause 209
|
||||
+#define Key_XF86Launch3 210
|
||||
+#define Key_XF86Launch4 211
|
||||
+#define Key_XF86LaunchB 212
|
||||
+#define Key_XF86Suspend 213
|
||||
+#define Key_XF86Close2 214
|
||||
+#define Key_XF86AudioPlay3 215
|
||||
+#define Key_XF86AudioForward 216
|
||||
+#define Key_Print2 218
|
||||
+#define Key_XF86WebCam 220
|
||||
+#define Key_XF86AudioPreset 221
|
||||
+#define Key_XF86Mail2 223
|
||||
+#define Key_XF86Messenger 224
|
||||
+#define Key_XF86Search 225
|
||||
+#define Key_XF86Go 226
|
||||
+#define Key_XF86Finance 227
|
||||
+#define Key_XF86Game 228
|
||||
+#define Key_XF86Shop 229
|
||||
+#define Key_Cancel2 231
|
||||
+#define Key_XF86MonBrightnessDown 232
|
||||
+#define Key_XF86MonBrightnessUp 233
|
||||
+#define Key_XF86AudioMedia 234
|
||||
+#define Key_XF86Display 235
|
||||
+#define Key_XF86KbdLightOnOff 236
|
||||
+#define Key_XF86KbdBrightnessDown 237
|
||||
+#define Key_XF86KbdBrightnessUp 238
|
||||
+#define Key_XF86Send2 239
|
||||
+#define Key_XF86Reply 240
|
||||
+#define Key_XF86MailForward 241
|
||||
+#define Key_XF86Save 242
|
||||
+#define Key_XF86Documents 243
|
||||
+#define Key_XF86Battery 244
|
||||
+#define Key_XF86Bluetooth 245
|
||||
+#define Key_XF86WLAN 246
|
||||
+#define Key_XF86MonBrightnessCycle 251
|
||||
+#define Key_XF86WWAN 254
|
||||
+#define Key_XF86RFKill 255
|
||||
--
|
||||
2.43.0
|
||||
|
||||
|
||||
From 9d24eaa9b2bd2c87c975882cd0b2adba978db564 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
||||
<leohdz172@proton.me>
|
||||
Date: Sun, 19 Mar 2023 15:50:07 -0600
|
||||
Subject: [PATCH 2/2] add program to generate keys.h
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
||||
---
|
||||
generate-keys.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 82 insertions(+)
|
||||
create mode 100644 generate-keys.c
|
||||
|
||||
diff --git a/generate-keys.c b/generate-keys.c
|
||||
new file mode 100644
|
||||
index 0000000..83458fb
|
||||
--- /dev/null
|
||||
+++ b/generate-keys.c
|
||||
@@ -0,0 +1,82 @@
|
||||
+/******************************************************************
|
||||
+ * Copyright 2023 Leonardo Hernández Hernández
|
||||
+ *
|
||||
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
+ * of this software and associated documentation files (the “Software”), to
|
||||
+ * deal in the Software without restriction, including without limitation the
|
||||
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
+ * sell copies of the Software, and to permit persons to whom the Software is
|
||||
+ * furnished to do so, subject to the following conditions:
|
||||
+ *
|
||||
+ * The above copyright notice and this permission notice shall be included in
|
||||
+ * all copies or substantial portions of the Software.
|
||||
+ *
|
||||
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
+ * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+ *
|
||||
+ ******************************************************************/
|
||||
+
|
||||
+/* cc -lxkbcommon -o generate-keys generate-keys.c */
|
||||
+
|
||||
+#include <errno.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+#include <xkbcommon/xkbcommon.h>
|
||||
+
|
||||
+int
|
||||
+main(void)
|
||||
+{
|
||||
+ struct xkb_context *context;
|
||||
+ /* Allow generate keys with a different layout and variant.
|
||||
+ * You can also use XKB_DEFAULT_* environmental variables and let this as is */
|
||||
+ struct xkb_rule_names rules = {
|
||||
+ 0
|
||||
+ };
|
||||
+ struct xkb_keymap *keymap;
|
||||
+ struct xkb_state *state;
|
||||
+ xkb_keycode_t keycode, min_keycode, max_keycode;
|
||||
+ int i, nsyms;
|
||||
+ const xkb_keysym_t *syms;
|
||||
+ char keyname[64];
|
||||
+ FILE *f = fopen("keys.h", "w");
|
||||
+ if (!f) {
|
||||
+ perror("Couldn't open keys.h");
|
||||
+ return EXIT_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ if (!(context = xkb_context_new(XKB_CONTEXT_NO_FLAGS))) {
|
||||
+ fputs("Couldn't create xkbcommon context\n", stderr);
|
||||
+ return EXIT_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ if (!(keymap = xkb_keymap_new_from_names(context, &rules,
|
||||
+ XKB_KEYMAP_COMPILE_NO_FLAGS))) {
|
||||
+ fputs("Couldn't create xkbcommon keymap\n", stderr);
|
||||
+ return EXIT_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ if (!(state = xkb_state_new(keymap))) {
|
||||
+ fputs("Couldn't create xkbcommon state\n", stderr);
|
||||
+ return EXIT_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ min_keycode = xkb_keymap_min_keycode(keymap);
|
||||
+ max_keycode = xkb_keymap_max_keycode(keymap);
|
||||
+
|
||||
+ for (keycode = min_keycode; keycode <= max_keycode; keycode++) {
|
||||
+ nsyms = xkb_state_key_get_syms(state, keycode, &syms);
|
||||
+ for (i = 0; i < nsyms; i++) {
|
||||
+ xkb_keysym_get_name(syms[i], keyname, sizeof(keyname) / sizeof(keyname[0]));
|
||||
+ fprintf(f, "#define Key_%-24s %d\n", keyname, keycode);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ xkb_state_unref(state);
|
||||
+ xkb_keymap_unref(keymap);
|
||||
+ xkb_context_unref(context);
|
||||
+}
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
From b051f50233033b399db324b29ab24227257ac141 Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Tue, 5 Mar 2024 23:31:51 -0500
|
||||
Subject: [PATCH] apply NikitaIvanovV movestack patch
|
||||
|
||||
source: https://github.com/djpohly/dwl/wiki/movestack
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
dwl.c | 35 +++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 37 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index db0babc..778a0dc 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -122,6 +122,8 @@ static const Key keys[] = {
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
||||
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_J, movestack, {.i = +1} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_K, movestack, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index ef27a1d..69b9756 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -279,6 +279,7 @@ static void maplayersurfacenotify(struct wl_listener *listener, void *data);
|
||||
static void mapnotify(struct wl_listener *listener, void *data);
|
||||
static void maximizenotify(struct wl_listener *listener, void *data);
|
||||
static void monocle(Monitor *m);
|
||||
+static void movestack(const Arg *arg);
|
||||
static void motionabsolute(struct wl_listener *listener, void *data);
|
||||
static void motionnotify(uint32_t time);
|
||||
static void motionrelative(struct wl_listener *listener, void *data);
|
||||
@@ -1603,6 +1604,40 @@ monocle(Monitor *m)
|
||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||
}
|
||||
|
||||
+void
|
||||
+movestack(const Arg *arg)
|
||||
+{
|
||||
+ Client *c, *sel = focustop(selmon);
|
||||
+
|
||||
+ if (!sel) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (wl_list_length(&clients) <= 1) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (arg->i > 0) {
|
||||
+ wl_list_for_each(c, &sel->link, link) {
|
||||
+ if (VISIBLEON(c, selmon) || &c->link == &clients) {
|
||||
+ break; /* found it */
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ wl_list_for_each_reverse(c, &sel->link, link) {
|
||||
+ if (VISIBLEON(c, selmon) || &c->link == &clients) {
|
||||
+ break; /* found it */
|
||||
+ }
|
||||
+ }
|
||||
+ /* backup one client */
|
||||
+ c = wl_container_of(c->link.prev, c, link);
|
||||
+ }
|
||||
+
|
||||
+ wl_list_remove(&sel->link);
|
||||
+ wl_list_insert(&c->link, &sel->link);
|
||||
+ arrange(selmon);
|
||||
+}
|
||||
+
|
||||
void
|
||||
motionabsolute(struct wl_listener *listener, void *data)
|
||||
{
|
||||
--
|
||||
2.42.0
|
||||
@@ -1,421 +0,0 @@
|
||||
From 0dc34efe899c9e6dca6eb8770f3dedd2afe5ee83 Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Wed, 22 Nov 2023 18:55:15 -0500
|
||||
Subject: [PATCH 1/6] apply main...loumray:namedscratchpads.patch
|
||||
|
||||
---
|
||||
config.def.h | 9 +++++++--
|
||||
dwl.c | 39 +++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 46 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index db0babc..157aee4 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -20,11 +20,12 @@ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can al
|
||||
static int log_level = WLR_ERROR;
|
||||
|
||||
static const Rule rules[] = {
|
||||
- /* app_id title tags mask isfloating monitor */
|
||||
+ /* app_id title tags mask isfloating monitor scratchkey */
|
||||
/* examples:
|
||||
{ "Gimp", NULL, 0, 1, -1 },
|
||||
*/
|
||||
- { "firefox", NULL, 1 << 8, 0, -1 },
|
||||
+ { "firefox", NULL, 1 << 8, 0, -1, 0 },
|
||||
+ { NULL, "scratchpad", 0, 1, -1, 's' },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@@ -115,11 +116,15 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
|
||||
static const char *termcmd[] = { "foot", NULL };
|
||||
static const char *menucmd[] = { "bemenu-run", NULL };
|
||||
|
||||
+/* named scratchpads - First arg only serves to match against key in rules*/
|
||||
+static const char *scratchpadcmd[] = { "s", "alacritty", "-t", "scratchpad", NULL };
|
||||
+
|
||||
static const Key keys[] = {
|
||||
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
||||
+ { MODKEY, XKB_KEY_grave, togglescratch, {.v = scratchpadcmd } },
|
||||
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index ef27a1d..81e5db8 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -130,6 +130,7 @@ typedef struct {
|
||||
uint32_t tags;
|
||||
int isfloating, isurgent, isfullscreen;
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
+ char scratchkey;
|
||||
} Client;
|
||||
|
||||
typedef struct {
|
||||
@@ -215,6 +216,7 @@ typedef struct {
|
||||
uint32_t tags;
|
||||
int isfloating;
|
||||
int monitor;
|
||||
+ const char scratchkey;
|
||||
} Rule;
|
||||
|
||||
typedef struct {
|
||||
@@ -307,12 +309,14 @@ static void setpsel(struct wl_listener *listener, void *data);
|
||||
static void setsel(struct wl_listener *listener, void *data);
|
||||
static void setup(void);
|
||||
static void spawn(const Arg *arg);
|
||||
+static void spawnscratch(const Arg *arg);
|
||||
static void startdrag(struct wl_listener *listener, void *data);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
+static void togglescratch(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void unlocksession(struct wl_listener *listener, void *data);
|
||||
@@ -424,6 +428,7 @@ applyrules(Client *c)
|
||||
Monitor *mon = selmon, *m;
|
||||
|
||||
c->isfloating = client_is_float_type(c);
|
||||
+ c->scratchkey = 0;
|
||||
if (!(appid = client_get_appid(c)))
|
||||
appid = broken;
|
||||
if (!(title = client_get_title(c)))
|
||||
@@ -433,6 +438,7 @@ applyrules(Client *c)
|
||||
if ((!r->title || strstr(title, r->title))
|
||||
&& (!r->id || strstr(appid, r->id))) {
|
||||
c->isfloating = r->isfloating;
|
||||
+ c->scratchkey = r->scratchkey;
|
||||
newtags |= r->tags;
|
||||
i = 0;
|
||||
wl_list_for_each(m, &mons, link)
|
||||
@@ -2372,6 +2378,16 @@ spawn(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
+void spawnscratch(const Arg *arg)
|
||||
+{
|
||||
+ if (fork() == 0) {
|
||||
+ dup2(STDERR_FILENO, STDOUT_FILENO);
|
||||
+ setsid();
|
||||
+ execvp(((char **)arg->v)[1], ((char **)arg->v)+1);
|
||||
+ die("dwl: execvp %s failed:", ((char **)arg->v)[1]);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
startdrag(struct wl_listener *listener, void *data)
|
||||
{
|
||||
@@ -2454,6 +2470,29 @@ togglefullscreen(const Arg *arg)
|
||||
setfullscreen(sel, !sel->isfullscreen);
|
||||
}
|
||||
|
||||
+void
|
||||
+togglescratch(const Arg *arg)
|
||||
+{
|
||||
+ Client *c;
|
||||
+ unsigned int found = 0;
|
||||
+
|
||||
+ /* search for first window that matches the scratchkey */
|
||||
+ wl_list_for_each(c, &clients, link)
|
||||
+ if (c->scratchkey == ((char**)arg->v)[0][0]) {
|
||||
+ found = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (found) {
|
||||
+ c->tags = VISIBLEON(c, selmon) ? 0 : selmon->tagset[selmon->seltags];
|
||||
+
|
||||
+ focusclient(c->tags == 0 ? focustop(selmon) : c, 1);
|
||||
+ arrange(selmon);
|
||||
+ } else{
|
||||
+ spawnscratch(arg);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.42.0
|
||||
|
||||
|
||||
From e750aa243a25ec78e611883b5e72314067326746 Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Wed, 22 Nov 2023 18:58:57 -0500
|
||||
Subject: [PATCH 2/6] add focusortogglescratch function
|
||||
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwl.c | 37 +++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 38 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 157aee4..0f672d4 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -125,6 +125,7 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
||||
{ MODKEY, XKB_KEY_grave, togglescratch, {.v = scratchpadcmd } },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_grave, focusortogglescratch, {.v = scratchpadcmd } },
|
||||
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 81e5db8..83d771e 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -317,6 +317,7 @@ static void tile(Monitor *m);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
static void togglescratch(const Arg *arg);
|
||||
+static void focusortogglescratch(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void unlocksession(struct wl_listener *listener, void *data);
|
||||
@@ -2493,6 +2494,42 @@ togglescratch(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+focusortogglescratch(const Arg *arg)
|
||||
+{
|
||||
+ Client *c;
|
||||
+ Client *cwithfocus;
|
||||
+ unsigned int found = 0;
|
||||
+
|
||||
+ /* search for first window that matches the scratchkey */
|
||||
+ wl_list_for_each(c, &clients, link)
|
||||
+ if (c->scratchkey == ((char**)arg->v)[0][0]) {
|
||||
+ found = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (found) {
|
||||
+ if (VISIBLEON(c, selmon)) {
|
||||
+ cwithfocus = focustop(selmon);
|
||||
+ if (cwithfocus == c) {
|
||||
+ // hide
|
||||
+ c->tags = 0;
|
||||
+ focusclient(cwithfocus, 1);
|
||||
+ } else {
|
||||
+ // focus
|
||||
+ focusclient(c, 1);
|
||||
+ }
|
||||
+ } else {
|
||||
+ // show
|
||||
+ c->tags = selmon->tagset[selmon->seltags];
|
||||
+ focusclient(c, 1);
|
||||
+ }
|
||||
+ arrange(selmon);
|
||||
+ } else{
|
||||
+ spawnscratch(arg);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.42.0
|
||||
|
||||
|
||||
From 5ee62daed7e4fb60d09ba72793bf872307697203 Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Wed, 22 Nov 2023 20:42:20 -0500
|
||||
Subject: [PATCH 3/6] fix focus after hiding
|
||||
|
||||
---
|
||||
dwl.c | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 83d771e..6b5d55d 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -2498,7 +2498,6 @@ void
|
||||
focusortogglescratch(const Arg *arg)
|
||||
{
|
||||
Client *c;
|
||||
- Client *cwithfocus;
|
||||
unsigned int found = 0;
|
||||
|
||||
/* search for first window that matches the scratchkey */
|
||||
@@ -2510,11 +2509,10 @@ focusortogglescratch(const Arg *arg)
|
||||
|
||||
if (found) {
|
||||
if (VISIBLEON(c, selmon)) {
|
||||
- cwithfocus = focustop(selmon);
|
||||
- if (cwithfocus == c) {
|
||||
+ if (focustop(selmon) == c) {
|
||||
// hide
|
||||
c->tags = 0;
|
||||
- focusclient(cwithfocus, 1);
|
||||
+ focusclient(focustop(selmon), 1);
|
||||
} else {
|
||||
// focus
|
||||
focusclient(c, 1);
|
||||
--
|
||||
2.42.0
|
||||
|
||||
|
||||
From 0b3d70706a0aca6d4414d20a3f2ac4928e70d04e Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Wed, 6 Mar 2024 14:36:48 -0500
|
||||
Subject: [PATCH 4/6] add focusortogglematchingscratch
|
||||
|
||||
works like focusortoggle but it also hides all others scratchpads
|
||||
---
|
||||
dwl.c | 43 +++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 43 insertions(+)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 6b5d55d..e179940 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -318,6 +318,7 @@ static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
static void togglescratch(const Arg *arg);
|
||||
static void focusortogglescratch(const Arg *arg);
|
||||
+static void focusortogglematchingscratch(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void unlocksession(struct wl_listener *listener, void *data);
|
||||
@@ -2528,6 +2529,48 @@ focusortogglescratch(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+focusortogglematchingscratch(const Arg *arg)
|
||||
+{
|
||||
+ Client *c;
|
||||
+ unsigned int found = 0;
|
||||
+
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (c->scratchkey == 0) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (c->scratchkey == ((char**)arg->v)[0][0]) {
|
||||
+ found = 1;
|
||||
+ if (VISIBLEON(c, selmon)) {
|
||||
+ if (focustop(selmon) == c) {
|
||||
+ // hide
|
||||
+ c->tags = 0;
|
||||
+ focusclient(focustop(selmon), 1);
|
||||
+ } else {
|
||||
+ // focus
|
||||
+ focusclient(c, 1);
|
||||
+ }
|
||||
+ } else {
|
||||
+ // show
|
||||
+ c->tags = selmon->tagset[selmon->seltags];
|
||||
+ // focus
|
||||
+ focusclient(c, 1);
|
||||
+ }
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (VISIBLEON(c, selmon)) {
|
||||
+ // hide
|
||||
+ c->tags = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (found) {
|
||||
+ arrange(selmon);
|
||||
+ } else {
|
||||
+ spawnscratch(arg);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.42.0
|
||||
|
||||
|
||||
From a14d6da36f1a77cd73daf751828224dd407e78f9 Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Wed, 6 Mar 2024 15:20:45 -0500
|
||||
Subject: [PATCH 5/6] fix: edge case where there are more than 1 window with
|
||||
the same scratchkey
|
||||
|
||||
---
|
||||
dwl.c | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index e179940..4c40f86 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -2534,18 +2534,26 @@ focusortogglematchingscratch(const Arg *arg)
|
||||
{
|
||||
Client *c;
|
||||
unsigned int found = 0;
|
||||
+ unsigned int hide = 0;
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (c->scratchkey == 0) {
|
||||
continue;
|
||||
}
|
||||
if (c->scratchkey == ((char**)arg->v)[0][0]) {
|
||||
- found = 1;
|
||||
if (VISIBLEON(c, selmon)) {
|
||||
+ if (found == 1) {
|
||||
+ if (hide == 1) {
|
||||
+ c->tags = 0;
|
||||
+ focusclient(focustop(selmon), 1);
|
||||
+ }
|
||||
+ continue;
|
||||
+ }
|
||||
if (focustop(selmon) == c) {
|
||||
// hide
|
||||
c->tags = 0;
|
||||
focusclient(focustop(selmon), 1);
|
||||
+ hide = 1;
|
||||
} else {
|
||||
// focus
|
||||
focusclient(c, 1);
|
||||
@@ -2556,6 +2564,7 @@ focusortogglematchingscratch(const Arg *arg)
|
||||
// focus
|
||||
focusclient(c, 1);
|
||||
}
|
||||
+ found = 1;
|
||||
continue;
|
||||
}
|
||||
if (VISIBLEON(c, selmon)) {
|
||||
--
|
||||
2.42.0
|
||||
|
||||
|
||||
From 8d86b275615f4f6242828d2ce4606380ba309c58 Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Wed, 6 Mar 2024 15:22:24 -0500
|
||||
Subject: [PATCH 6/6] add examples
|
||||
|
||||
---
|
||||
config.def.h | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 0f672d4..3205165 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -125,7 +125,8 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
||||
{ MODKEY, XKB_KEY_grave, togglescratch, {.v = scratchpadcmd } },
|
||||
- { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_grave, focusortogglescratch, {.v = scratchpadcmd } },
|
||||
+ // { MODKEY, XKB_KEY_grave, focusortogglescratch, {.v = scratchpadcmd } },
|
||||
+ // { MODKEY, XKB_KEY_grave, focusortogglematchingscratch, {.v = scratchpadcmd } },
|
||||
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
--
|
||||
2.42.0
|
||||
@@ -1,105 +0,0 @@
|
||||
From f8761928cc1eb5c9c694cf43cf6442579ea40150 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
||||
<leohdz172@protonmail.com>
|
||||
Date: Sun, 4 Apr 2021 19:56:09 -0500
|
||||
Subject: [PATCH] add option to enable numlock/capslock
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
||||
---
|
||||
config.def.h | 4 ++++
|
||||
dwl.c | 31 ++++++++++++++++++++++++++-----
|
||||
2 files changed, 30 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a8ed61d..87f91d7 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -56,6 +56,10 @@ static const struct xkb_rule_names xkb_rules = {
|
||||
.options = NULL,
|
||||
};
|
||||
|
||||
+/* numlock and capslock */
|
||||
+static const int numlock = 1;
|
||||
+static const int capslock = 0;
|
||||
+
|
||||
static const int repeat_rate = 25;
|
||||
static const int repeat_delay = 600;
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 10d5a5b..962748b 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/backend.h>
|
||||
#include <wlr/backend/libinput.h>
|
||||
+#include <wlr/interfaces/wlr_keyboard.h>
|
||||
#include <wlr/render/allocator.h>
|
||||
#include <wlr/render/wlr_renderer.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
@@ -336,6 +337,7 @@ static void zoom(const Arg *arg);
|
||||
static const char broken[] = "broken";
|
||||
static pid_t child_pid = -1;
|
||||
static int locked;
|
||||
+static uint32_t locked_mods = 0;
|
||||
static void *exclusive_focus;
|
||||
static struct wl_display *dpy;
|
||||
static struct wlr_backend *backend;
|
||||
@@ -768,6 +770,8 @@ createkeyboard(struct wlr_keyboard *keyboard)
|
||||
wlr_keyboard_set_keymap(keyboard, kb_group.wlr_group->keyboard.keymap);
|
||||
wlr_keyboard_set_repeat_info(keyboard, repeat_rate, repeat_delay);
|
||||
|
||||
+ wlr_keyboard_notify_modifiers(keyboard, 0, 0, locked_mods, 0);
|
||||
+
|
||||
/* Add the new keyboard to the group */
|
||||
wlr_keyboard_group_add_keyboard(kb_group.wlr_group, keyboard);
|
||||
}
|
||||
@@ -2354,13 +2358,9 @@ setup(void)
|
||||
XKB_KEYMAP_COMPILE_NO_FLAGS)))
|
||||
die("failed to compile keymap");
|
||||
|
||||
+ wlr_seat_set_keyboard(seat, &kb_group.wlr_group->keyboard);
|
||||
wlr_keyboard_set_keymap(&kb_group.wlr_group->keyboard, keymap);
|
||||
wlr_keyboard_set_keymap(&vkb_group.wlr_group->keyboard, keymap);
|
||||
- xkb_keymap_unref(keymap);
|
||||
- xkb_context_unref(context);
|
||||
-
|
||||
- wlr_keyboard_set_repeat_info(&kb_group.wlr_group->keyboard, repeat_rate, repeat_delay);
|
||||
- wlr_keyboard_set_repeat_info(&vkb_group.wlr_group->keyboard, repeat_rate, repeat_delay);
|
||||
|
||||
/* Set up listeners for keyboard events */
|
||||
LISTEN(&kb_group.wlr_group->keyboard.events.key, &kb_group.key, keypress);
|
||||
@@ -2368,6 +2368,27 @@ setup(void)
|
||||
LISTEN(&vkb_group.wlr_group->keyboard.events.key, &vkb_group.key, keypress);
|
||||
LISTEN(&vkb_group.wlr_group->keyboard.events.modifiers, &vkb_group.modifiers, keypressmod);
|
||||
|
||||
+ if (numlock) {
|
||||
+ xkb_mod_index_t mod_index = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_NUM);
|
||||
+ if (mod_index != XKB_MOD_INVALID)
|
||||
+ locked_mods |= (uint32_t)1 << mod_index;
|
||||
+ }
|
||||
+
|
||||
+ if (capslock) {
|
||||
+ xkb_mod_index_t mod_index = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CAPS);
|
||||
+ if (mod_index != XKB_MOD_INVALID)
|
||||
+ locked_mods |= (uint32_t)1 << mod_index;
|
||||
+ }
|
||||
+
|
||||
+ if (locked_mods)
|
||||
+ wlr_keyboard_notify_modifiers(&kb_group.wlr_group->keyboard, 0, 0, locked_mods, 0);
|
||||
+
|
||||
+ xkb_keymap_unref(keymap);
|
||||
+ xkb_context_unref(context);
|
||||
+
|
||||
+ wlr_keyboard_set_repeat_info(&kb_group.wlr_group->keyboard, repeat_rate, repeat_delay);
|
||||
+ wlr_keyboard_set_repeat_info(&vkb_group.wlr_group->keyboard, repeat_rate, repeat_delay);
|
||||
+
|
||||
kb_group.key_repeat_source = wl_event_loop_add_timer(
|
||||
wl_display_get_event_loop(dpy), keyrepeat, &kb_group);
|
||||
vkb_group.key_repeat_source = wl_event_loop_add_timer(
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
### Description
|
||||
Port of dwm's accessnthmon. Adds functions to tag and focus monitor by index.
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/Rutherther/dwl/src/branch/patch/accessnthmonitor)
|
||||
- [2024-05-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/accessnthmon/accessnthmon.patch)
|
||||
### Authors
|
||||
- [Rutherther](https://codeberg.org/Rutherther)
|
||||
- [Palanix](https://codeberg.org/Palanix)
|
||||
@@ -0,0 +1,122 @@
|
||||
From 5f531bfb1387ded7b8817faf7df760d3b998742b Mon Sep 17 00:00:00 2001
|
||||
From: Rutherther <rutherther@proton.me>
|
||||
Date: Sat, 27 Apr 2024 21:25:16 +0200
|
||||
Subject: [PATCH] feat: access nth monitor
|
||||
|
||||
---
|
||||
config.def.h | 4 +++-
|
||||
dwl.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 49 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 8847e58..4709c5d 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -108,7 +108,9 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|WLR_MODIFIER_CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, SKEY, tag, {.ui = 1 << TAG} }, \
|
||||
- { MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} }
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} }, \
|
||||
+ { WLR_MODIFIER_ALT, KEY, focusnthmon, {.ui = TAG} }, \
|
||||
+ { WLR_MODIFIER_ALT|WLR_MODIFIER_SHIFT, SKEY, tagnthmon, {.ui = TAG} }
|
||||
|
||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index bf763df..1d42caf 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <wayland-server-core.h>
|
||||
+#include <wayland-util.h>
|
||||
#include <wlr/backend.h>
|
||||
#include <wlr/backend/libinput.h>
|
||||
#include <wlr/render/allocator.h>
|
||||
@@ -278,8 +279,10 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data);
|
||||
static void destroysessionlock(struct wl_listener *listener, void *data);
|
||||
static void destroysessionmgr(struct wl_listener *listener, void *data);
|
||||
static Monitor *dirtomon(enum wlr_direction dir);
|
||||
+static Monitor *numtomon(int num);
|
||||
static void focusclient(Client *c, int lift);
|
||||
static void focusmon(const Arg *arg);
|
||||
+static void focusnthmon(const Arg *arg);
|
||||
static void focusstack(const Arg *arg);
|
||||
static Client *focustop(Monitor *m);
|
||||
static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||
@@ -329,6 +332,7 @@ static void spawn(const Arg *arg);
|
||||
static void startdrag(struct wl_listener *listener, void *data);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
+static void tagnthmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
@@ -1233,6 +1237,25 @@ dirtomon(enum wlr_direction dir)
|
||||
return selmon;
|
||||
}
|
||||
|
||||
+Monitor *
|
||||
+numtomon(int num)
|
||||
+{
|
||||
+ Monitor *m = NULL;
|
||||
+ int found = 0;
|
||||
+ int i = 0;
|
||||
+
|
||||
+ wl_list_for_each(m, &mons, link) {
|
||||
+ if (!m->wlr_output->enabled)
|
||||
+ i--;
|
||||
+ else if (i == num) {
|
||||
+ found = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
+ return found ? m : NULL;
|
||||
+}
|
||||
+
|
||||
void
|
||||
focusclient(Client *c, int lift)
|
||||
{
|
||||
@@ -1320,6 +1343,16 @@ focusmon(const Arg *arg)
|
||||
focusclient(focustop(selmon), 1);
|
||||
}
|
||||
|
||||
+void
|
||||
+focusnthmon(const Arg *arg)
|
||||
+{
|
||||
+ Monitor *m = numtomon(arg->i);
|
||||
+ if (!m || m == selmon)
|
||||
+ return;
|
||||
+ selmon = m;
|
||||
+ focusclient(focustop(selmon), 1);
|
||||
+}
|
||||
+
|
||||
void
|
||||
focusstack(const Arg *arg)
|
||||
{
|
||||
@@ -2569,6 +2602,19 @@ tagmon(const Arg *arg)
|
||||
setmon(sel, dirtomon(arg->i), 0);
|
||||
}
|
||||
|
||||
+void
|
||||
+tagnthmon(const Arg *arg)
|
||||
+{
|
||||
+ Client *sel = focustop(selmon);
|
||||
+ Monitor *m = numtomon(arg->i);
|
||||
+ if (!m || !sel)
|
||||
+ return;
|
||||
+ setmon(sel, m, 0);
|
||||
+
|
||||
+ arrange(selmon);
|
||||
+ arrange(m);
|
||||
+}
|
||||
+
|
||||
void
|
||||
tile(Monitor *m)
|
||||
{
|
||||
--
|
||||
2.44.0
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
### Description
|
||||
Automatically center floating windows.
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/guidocella/dwl/src/branch/alwayscenter)
|
||||
- [2024-06-05](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/alwayscenter/alwayscenter.patch)
|
||||
|
||||
### Authors
|
||||
- [Guido Cella](https://codeberg.org/guidocella)
|
||||
@@ -0,0 +1,39 @@
|
||||
From f43a49324c2ddd21100d6308d1adde9d894746e2 Mon Sep 17 00:00:00 2001
|
||||
From: Guido Cella <guido@guidocella.xyz>
|
||||
Date: Wed, 5 Jun 2024 12:05:16 +0200
|
||||
Subject: [PATCH] center floating windows
|
||||
|
||||
---
|
||||
dwl.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 12f441e..c377c67 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -499,6 +499,11 @@ applyrules(Client *c)
|
||||
}
|
||||
}
|
||||
|
||||
+ if (mon) {
|
||||
+ c->geom.x = (mon->w.width - c->geom.width) / 2 + mon->m.x;
|
||||
+ c->geom.y = (mon->w.height - c->geom.height) / 2 + mon->m.y;
|
||||
+ }
|
||||
+
|
||||
c->isfloating |= client_is_float_type(c);
|
||||
setmon(c, mon, newtags);
|
||||
}
|
||||
@@ -1787,6 +1792,10 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
* If there is no parent, apply rules */
|
||||
if ((p = client_get_parent(c))) {
|
||||
c->isfloating = 1;
|
||||
+ if (p->mon) {
|
||||
+ c->geom.x = (p->mon->w.width - c->geom.width) / 2 + p->mon->m.x;
|
||||
+ c->geom.y = (p->mon->w.height - c->geom.height) / 2 + p->mon->m.y;
|
||||
+ }
|
||||
setmon(c, p->mon, p->tags);
|
||||
} else {
|
||||
applyrules(c);
|
||||
--
|
||||
2.49.0
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
### Description
|
||||
Newly created windows are placed at the bottom of the client tile stack.
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/bencc/dwl/src/branch/attachbottom)
|
||||
- [2024-05-16](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/attachbottom/attachbottom.patch)
|
||||
|
||||
### Authors
|
||||
- [Ben Collerson](https://codeberg.org/bencc)
|
||||
- [Aurel Weinhold](https://github.com/AurelWeinhold)
|
||||
@@ -0,0 +1,29 @@
|
||||
From 0dda3ed8634154fd3887b71133b451d66a11b61d Mon Sep 17 00:00:00 2001
|
||||
From: Ben Collerson <benc@benc.cc>
|
||||
Date: Thu, 4 Jan 2024 23:31:41 +1000
|
||||
Subject: [PATCH] attachbottom
|
||||
|
||||
---
|
||||
dwl.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index bf763dfc..12e08e2b 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -1605,7 +1605,11 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
c->geom.height += 2 * c->bw;
|
||||
|
||||
/* Insert this client into client lists. */
|
||||
- wl_list_insert(&clients, &c->link);
|
||||
+ if (clients.prev)
|
||||
+ // tile at the bottom
|
||||
+ wl_list_insert(clients.prev, &c->link);
|
||||
+ else
|
||||
+ wl_list_insert(&clients, &c->link);
|
||||
wl_list_insert(&fstack, &c->flink);
|
||||
|
||||
/* Set initial monitor, tags, floating status, and focus:
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
### Description
|
||||
Makes windows attach below the currently active window.
|
||||
|
||||
KNOWN ISSUES: Upon closing the last client when using multiple monitors, the last client will briefly flash on all
|
||||
monitors before closing.
|
||||
|
||||
### Download
|
||||
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/attachfocused/attachfocused.patch)
|
||||
|
||||
### Authors
|
||||
- [MayOrMayNotBeACat](https://codeberg.org/MayOrMayNotBeACat)
|
||||
@@ -0,0 +1,29 @@
|
||||
From d03851c14073874f5b3d19a095e184dc24d219cd Mon Sep 17 00:00:00 2001
|
||||
From: MayOrMayNotBeACat <maybeacat804@gmail.com>
|
||||
Date: Sun, 11 May 2025 20:24:51 -0400
|
||||
Subject: [PATCH] Make new windows attach to active client
|
||||
|
||||
---
|
||||
dwl.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index cf3ef70..1907c5f 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -1726,7 +1726,11 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
c->geom.height += 2 * c->bw;
|
||||
|
||||
/* Insert this client into client lists. */
|
||||
- wl_list_insert(&clients, &c->link);
|
||||
+ Client* focused = focustop(selmon);
|
||||
+ if (focused)
|
||||
+ wl_list_insert(&focused->link, &c->link);
|
||||
+ else
|
||||
+ wl_list_insert(&clients, &c->link);
|
||||
wl_list_insert(&fstack, &c->flink);
|
||||
|
||||
/* Set initial monitor, tags, floating status, and focus:
|
||||
--
|
||||
2.49.0
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
### Description
|
||||
|
||||
This is a port of attachtop patch for dwm: https://dwm.suckless.org/patches/attachtop
|
||||
|
||||
New client attaches below the last master/on top of the stack.
|
||||
@@ -7,7 +6,8 @@ New client attaches below the last master/on top of the stack.
|
||||
Behavior feels very intuitive as it doesn't disrupt existing masters no matter the amount of them, it only pushes the clients in stack down.
|
||||
|
||||
### Download
|
||||
- [2023-07-15](https://github.com/djpohly/dwl/compare/main...NikitaIvanovV:attachtop.patch)
|
||||
- [git branch](https://codeberg.org/nikitaivanov/dwl/src/branch/attachtop)
|
||||
- [2025-06-16](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/attachtop/attachtop.patch)
|
||||
|
||||
### Authors
|
||||
- [Nikita Ivanov](https://github.com/NikitaIvanovV)
|
||||
- [Nikita Ivanov](https://codeberg.org/nikitaivanov)
|
||||
@@ -1,4 +1,4 @@
|
||||
From 42a66d6e06c38e913766ce625f049fdbc3dd0d12 Mon Sep 17 00:00:00 2001
|
||||
From 29e6a4bef02c473cc5bd04804fe508bda265077d Mon Sep 17 00:00:00 2001
|
||||
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
||||
Date: Sun, 7 Apr 2024 21:10:17 +0200
|
||||
Subject: [PATCH] New client are attached on top of the stack
|
||||
@@ -8,7 +8,7 @@ Subject: [PATCH] New client are attached on top of the stack
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index bf763df..c0a3d74 100644
|
||||
index bf763df..02e3d07 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -1605,7 +1605,18 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
@@ -18,7 +18,7 @@ index bf763df..c0a3d74 100644
|
||||
- wl_list_insert(&clients, &c->link);
|
||||
+ i = 0;
|
||||
+ wl_list_for_each(w, &clients, link) {
|
||||
+ if (!VISIBLEON(w, selmon) || c->isfloating)
|
||||
+ if (!VISIBLEON(w, selmon) || w->isfloating)
|
||||
+ continue;
|
||||
+ p = w;
|
||||
+ if (++i >= selmon->nmaster)
|
||||
@@ -32,5 +32,5 @@ index bf763df..c0a3d74 100644
|
||||
|
||||
/* Set initial monitor, tags, floating status, and focus:
|
||||
--
|
||||
2.44.0
|
||||
2.49.0
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
### Description
|
||||
Allow dwl to execute commands from autostart array in your config.h file. And when you exit dwl all processes from autostart array will be killed.
|
||||
|
||||
Note: Commands from array are executed using execvp(). So if you need to execute shell command you need to prefix it with "sh", "-c" (change sh to any shell you like).
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/sevz/dwl/src/branch/autostart)
|
||||
- [2025-01-20](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart.patch)
|
||||
- [0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/autostart/autostart-0.7.patch)
|
||||
|
||||
### Authors
|
||||
- [sevz](https://codeberg.org/sevz)
|
||||
- [Rayan Nakib](https://nakibrayan2.pages.dev/)
|
||||
- [NFVblog](https://github.com/nf02)
|
||||
@@ -1,4 +1,4 @@
|
||||
From 51d56a433f23e13ac711b283a03c7903068febf6 Mon Sep 17 00:00:00 2001
|
||||
From 787f7252d63945996f009828aff3c44afd0f7781 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
||||
<leohdz172@proton.me>
|
||||
Date: Sat, 8 Jul 2023 17:11:36 -0600
|
||||
@@ -15,10 +15,10 @@ Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
||||
2 files changed, 61 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a8ed61d..3585711 100644
|
||||
index 22d2171..8dc6502 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -20,6 +20,13 @@ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can al
|
||||
@@ -20,6 +20,13 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
/* logging */
|
||||
static int log_level = WLR_ERROR;
|
||||
|
||||
@@ -29,14 +29,14 @@ index a8ed61d..3585711 100644
|
||||
+};
|
||||
+
|
||||
+
|
||||
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
||||
static const Rule rules[] = {
|
||||
/* app_id title tags mask isfloating monitor */
|
||||
/* examples:
|
||||
/* app_id title tags mask isfloating monitor */
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 10d5a5b..bbbef2b 100644
|
||||
index 5bf995e..e8b8727 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -236,6 +236,7 @@ static void arrange(Monitor *m);
|
||||
@@ -249,6 +249,7 @@ static void arrange(Monitor *m);
|
||||
static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||
struct wlr_box *usable_area, int exclusive);
|
||||
static void arrangelayers(Monitor *m);
|
||||
@@ -44,7 +44,7 @@ index 10d5a5b..bbbef2b 100644
|
||||
static void axisnotify(struct wl_listener *listener, void *data);
|
||||
static void buttonpress(struct wl_listener *listener, void *data);
|
||||
static void chvt(const Arg *arg);
|
||||
@@ -403,6 +404,9 @@ static xcb_atom_t netatom[NetLast];
|
||||
@@ -432,6 +433,9 @@ static xcb_atom_t netatom[NetLast];
|
||||
/* attempt to encapsulate suck into one file */
|
||||
#include "client.h"
|
||||
|
||||
@@ -54,7 +54,7 @@ index 10d5a5b..bbbef2b 100644
|
||||
/* function implementations */
|
||||
void
|
||||
applybounds(Client *c, struct wlr_box *bbox)
|
||||
@@ -533,6 +537,27 @@ arrangelayers(Monitor *m)
|
||||
@@ -580,6 +584,27 @@ arrangelayers(Monitor *m)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ index 10d5a5b..bbbef2b 100644
|
||||
void
|
||||
axisnotify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
@@ -630,11 +655,21 @@ checkidleinhibitor(struct wlr_surface *exclude)
|
||||
@@ -676,11 +701,21 @@ checkidleinhibitor(struct wlr_surface *exclude)
|
||||
void
|
||||
cleanup(void)
|
||||
{
|
||||
@@ -102,9 +102,9 @@ index 10d5a5b..bbbef2b 100644
|
||||
+ }
|
||||
+
|
||||
if (child_pid > 0) {
|
||||
kill(child_pid, SIGTERM);
|
||||
kill(-child_pid, SIGTERM);
|
||||
waitpid(child_pid, NULL, 0);
|
||||
@@ -1294,18 +1329,31 @@ void
|
||||
@@ -1497,18 +1532,31 @@ void
|
||||
handlesig(int signo)
|
||||
{
|
||||
if (signo == SIGCHLD) {
|
||||
@@ -141,7 +141,7 @@ index 10d5a5b..bbbef2b 100644
|
||||
} else if (signo == SIGINT || signo == SIGTERM) {
|
||||
quit(NULL);
|
||||
}
|
||||
@@ -1965,6 +2013,7 @@ run(char *startup_cmd)
|
||||
@@ -2224,6 +2272,7 @@ run(char *startup_cmd)
|
||||
die("startup: backend_start");
|
||||
|
||||
/* Now that the socket exists and the backend is started, run the startup command */
|
||||
@@ -150,5 +150,5 @@ index 10d5a5b..bbbef2b 100644
|
||||
int piperw[2];
|
||||
if (pipe(piperw) < 0)
|
||||
--
|
||||
2.43.0
|
||||
2.45.2
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
From 3b0b0249d900121a90528616f4d11f733c7a5ca2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
||||
<leohdz172@proton.me>
|
||||
Date: Sat, 8 Jul 2023 17:11:36 -0600
|
||||
Subject: [PATCH] port autostart patch from dwm
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
https://dwm.suckless.org/patches/cool_autostart/
|
||||
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
||||
---
|
||||
config.def.h | 7 +++++++
|
||||
dwl.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
2 files changed, 62 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 22d2171d..8dc6502c 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -20,6 +20,13 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
/* logging */
|
||||
static int log_level = WLR_ERROR;
|
||||
|
||||
+/* Autostart */
|
||||
+static const char *const autostart[] = {
|
||||
+ "wbg", "/path/to/your/image", NULL,
|
||||
+ NULL /* terminate */
|
||||
+};
|
||||
+
|
||||
+
|
||||
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
||||
static const Rule rules[] = {
|
||||
/* app_id title tags mask isfloating monitor */
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index ad21e1ba..3118e07f 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -246,6 +246,7 @@ static void arrange(Monitor *m);
|
||||
static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||
struct wlr_box *usable_area, int exclusive);
|
||||
static void arrangelayers(Monitor *m);
|
||||
+static void autostartexec(void);
|
||||
static void axisnotify(struct wl_listener *listener, void *data);
|
||||
static void buttonpress(struct wl_listener *listener, void *data);
|
||||
static void chvt(const Arg *arg);
|
||||
@@ -455,6 +456,9 @@ static struct wlr_xwayland *xwayland;
|
||||
/* attempt to encapsulate suck into one file */
|
||||
#include "client.h"
|
||||
|
||||
+static pid_t *autostart_pids;
|
||||
+static size_t autostart_len;
|
||||
+
|
||||
/* function implementations */
|
||||
void
|
||||
applybounds(Client *c, struct wlr_box *bbox)
|
||||
@@ -599,6 +603,27 @@ arrangelayers(Monitor *m)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+autostartexec(void) {
|
||||
+ const char *const *p;
|
||||
+ size_t i = 0;
|
||||
+
|
||||
+ /* count entries */
|
||||
+ for (p = autostart; *p; autostart_len++, p++)
|
||||
+ while (*++p);
|
||||
+
|
||||
+ autostart_pids = calloc(autostart_len, sizeof(pid_t));
|
||||
+ for (p = autostart; *p; i++, p++) {
|
||||
+ if ((autostart_pids[i] = fork()) == 0) {
|
||||
+ setsid();
|
||||
+ execvp(*p, (char *const *)p);
|
||||
+ die("dwl: execvp %s:", *p);
|
||||
+ }
|
||||
+ /* skip arguments */
|
||||
+ while (*++p);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
axisnotify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
@@ -695,12 +720,23 @@ checkidleinhibitor(struct wlr_surface *exclude)
|
||||
void
|
||||
cleanup(void)
|
||||
{
|
||||
+ size_t i;
|
||||
+
|
||||
cleanuplisteners();
|
||||
#ifdef XWAYLAND
|
||||
wlr_xwayland_destroy(xwayland);
|
||||
xwayland = NULL;
|
||||
#endif
|
||||
wl_display_destroy_clients(dpy);
|
||||
+
|
||||
+ /* kill child processes */
|
||||
+ for (i = 0; i < autostart_len; i++) {
|
||||
+ if (0 < autostart_pids[i]) {
|
||||
+ kill(autostart_pids[i], SIGTERM);
|
||||
+ waitpid(autostart_pids[i], NULL, 0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (child_pid > 0) {
|
||||
kill(-child_pid, SIGTERM);
|
||||
waitpid(child_pid, NULL, 0);
|
||||
@@ -1551,10 +1587,25 @@ gpureset(struct wl_listener *listener, void *data)
|
||||
void
|
||||
handlesig(int signo)
|
||||
{
|
||||
- if (signo == SIGCHLD)
|
||||
- while (waitpid(-1, NULL, WNOHANG) > 0);
|
||||
- else if (signo == SIGINT || signo == SIGTERM)
|
||||
+ if (signo == SIGCHLD) {
|
||||
+ pid_t pid, *p, *lim;
|
||||
+ while ((pid = waitpid(-1, NULL, WNOHANG)) > 0) {
|
||||
+ if (pid == child_pid)
|
||||
+ child_pid = -1;
|
||||
+ if (!(p = autostart_pids))
|
||||
+ continue;
|
||||
+ lim = &p[autostart_len];
|
||||
+
|
||||
+ for (; p < lim; p++) {
|
||||
+ if (*p == pid) {
|
||||
+ *p = -1;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ } else if (signo == SIGINT || signo == SIGTERM) {
|
||||
quit(NULL);
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2241,6 +2292,7 @@ run(char *startup_cmd)
|
||||
die("startup: backend_start");
|
||||
|
||||
/* Now that the socket exists and the backend is started, run the startup command */
|
||||
+ autostartexec();
|
||||
if (startup_cmd) {
|
||||
int piperw[2];
|
||||
if (pipe(piperw) < 0)
|
||||
--
|
||||
2.48.0
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
### Description
|
||||
Add a system tray to the [bar](/dwl/dwl-patches/src/branch/main/patches/bar).
|
||||
|
||||
To keep dependencies to minimum, icon(svg) loading from the filesystem is not
|
||||
supported. Applications that expect this will show the initial letter of the
|
||||
program name, instead of a real icon.
|
||||
|
||||
Menus for the icons are handled by a dmenu-like program of the user's choice.
|
||||
|
||||
### Dependencies
|
||||
- [bar.patch](/dwl/dwl-patches/src/branch/main/patches/bar)
|
||||
- [libdbus](https://gitlab.freedesktop.org/dbus/dbus)
|
||||
|
||||
### Download
|
||||
- [git branch](/janetski/dwl/src/branch/0.7-bar-systray)
|
||||
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/bar-systray/bar-systray-0.7.patch)
|
||||
|
||||
### Authors
|
||||
- [janetski](https://codeberg.org/janetski) ([.vetu](https://discordapp.com/users/355488216469471242) on discord)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
||||
### Description
|
||||
|
||||
Add a bar identical to dwm's bar.
|
||||
|
||||
To use a status-bar, you can pass in status text via stdin:
|
||||
```
|
||||
slstatus -s | dwl
|
||||
```
|
||||
|
||||
### Dependencies
|
||||
* tllist (build dependency, required & pulled automatically by fcft)
|
||||
* fcft
|
||||
* pixman
|
||||
|
||||
### Download
|
||||
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/bar/bar-0.7.patch)
|
||||
- [0.6](/dwl/dwl-patches/raw/branch/main/patches/bar/bar-0.6.patch)
|
||||
|
||||
It is required to remove, regenerate or update `config.h` after applying the patch,
|
||||
since it makes changes to the configuration structure.
|
||||
For example, in the `pertag` patch, `TAGCOUNT` must be replaced with `LENGTH(tags)`.
|
||||
|
||||
Below is a preview of the patch.
|
||||
|
||||

|
||||
|
||||
### Authors
|
||||
- [sewn](https://codeberg.org/sewn)
|
||||
|
||||
### Credits
|
||||
- [MadcowOG](https://github.com/MadcowOG)
|
||||
- [kolumni](https://github.com/kolunmi/dwlb)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@@ -0,0 +1,10 @@
|
||||
### Description
|
||||
|
||||
Add a border around the [bar](/dwl/dwl-patches/wiki/bar) similar to how a client is given a border.
|
||||
|
||||
### Download
|
||||
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/barborder/barborder.patch)
|
||||
|
||||
### Authors
|
||||
- [sewn](https://codeberg.org/sewn)
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
From 7d95ce0fba8f172748bbd71b4c03ce12acd54eea Mon Sep 17 00:00:00 2001
|
||||
From: sewn <sewn@disroot.org>
|
||||
Date: Fri, 23 Aug 2024 14:11:37 +0300
|
||||
Subject: [PATCH] add border to bar
|
||||
|
||||
---
|
||||
config.def.h | 3 ++-
|
||||
dwl.c | 32 +++++++++++++++++++-------------
|
||||
2 files changed, 21 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 5d1dc2b..4763482 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -6,7 +6,7 @@
|
||||
/* appearance */
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||
-static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
+static const unsigned int borderpx = 1; /* border pixel of windows & bar */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = {"monospace:size=10"};
|
||||
@@ -18,6 +18,7 @@ static uint32_t colors[][3] = {
|
||||
[SchemeNorm] = { 0xbbbbbbff, 0x222222ff, 0x444444ff },
|
||||
[SchemeSel] = { 0xeeeeeeff, 0x005577ff, 0x005577ff },
|
||||
[SchemeUrg] = { 0, 0, 0x770000ff },
|
||||
+ [SchemeBar] = { 0, 0, 0x557700ff },
|
||||
};
|
||||
|
||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index ece537a..c637da4 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -85,7 +85,7 @@
|
||||
#define TEXTW(mon, text) (drwl_font_getwidth(mon->drw, text) + mon->lrpad)
|
||||
|
||||
/* enums */
|
||||
-enum { SchemeNorm, SchemeSel, SchemeUrg }; /* color schemes */
|
||||
+enum { SchemeNorm, SchemeSel, SchemeUrg, SchemeBar }; /* color schemes */
|
||||
enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
|
||||
enum { XDGShell, LayerShell, X11 }; /* client types */
|
||||
enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrBlock, NUM_LAYERS }; /* scene layers */
|
||||
@@ -750,7 +750,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
if (!c && !exclusive_focus &&
|
||||
(node = wlr_scene_node_at(&layers[LyrBottom]->node, cursor->x, cursor->y, NULL, NULL)) &&
|
||||
(buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) {
|
||||
- cx = (cursor->x - selmon->m.x) * selmon->wlr_output->scale;
|
||||
+ cx = (cursor->x - selmon->m.x - borderpx) * selmon->wlr_output->scale;
|
||||
do
|
||||
x += TEXTW(selmon, tags[i]);
|
||||
while (cx >= x && ++i < LENGTH(tags));
|
||||
@@ -1506,10 +1506,12 @@ dirtomon(enum wlr_direction dir)
|
||||
void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
- int x, w, tw = 0;
|
||||
+ int x, y = borderpx, w, tw = 0;
|
||||
+ int mh = m->b.height - borderpx * 2, mw = m->b.width - borderpx * 2;
|
||||
int boxs = m->drw->font->height / 9;
|
||||
int boxw = m->drw->font->height / 6 + 2;
|
||||
uint32_t i, occ = 0, urg = 0;
|
||||
+ uint32_t borderscm[] = { colors[SchemeBar][ColBorder] };
|
||||
Client *c;
|
||||
Buffer *buf;
|
||||
|
||||
@@ -1518,11 +1520,15 @@ drawbar(Monitor *m)
|
||||
if (!(buf = bufmon(m)))
|
||||
return;
|
||||
|
||||
+ drwl_setscheme(m->drw, borderscm);
|
||||
+ drwl_rect(m->drw, 0, 0, m->b.width, m->b.height, 1, 0);
|
||||
+ drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||
+
|
||||
/* draw status first so it can be overdrawn by tags later */
|
||||
if (m == selmon) { /* status is only drawn on selected monitor */
|
||||
drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||
tw = TEXTW(m, stext) - m->lrpad + 2; /* 2px right padding */
|
||||
- drwl_text(m->drw, m->b.width - tw, 0, tw, m->b.height, 0, stext, 0);
|
||||
+ drwl_text(m->drw, borderpx + mw - tw, y, tw, mh, 0, stext, 0);
|
||||
}
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
@@ -1532,31 +1538,31 @@ drawbar(Monitor *m)
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
}
|
||||
- x = 0;
|
||||
+ x = borderpx;
|
||||
c = focustop(m);
|
||||
for (i = 0; i < LENGTH(tags); i++) {
|
||||
w = TEXTW(m, tags[i]);
|
||||
drwl_setscheme(m->drw, colors[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
||||
- drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, tags[i], urg & 1 << i);
|
||||
+ drwl_text(m->drw, x, y, w, mh, m->lrpad / 2, tags[i], urg & 1 << i);
|
||||
if (occ & 1 << i)
|
||||
- drwl_rect(m->drw, x + boxs, boxs, boxw, boxw,
|
||||
+ drwl_rect(m->drw, x + boxs, y + boxs, boxw, boxw,
|
||||
m == selmon && c && c->tags & 1 << i,
|
||||
urg & 1 << i);
|
||||
x += w;
|
||||
}
|
||||
w = TEXTW(m, m->ltsymbol);
|
||||
drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||
- x = drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, m->ltsymbol, 0);
|
||||
+ x = drwl_text(m->drw, x, y, w, mh, m->lrpad / 2, m->ltsymbol, 0);
|
||||
|
||||
- if ((w = m->b.width - tw - x) > m->b.height) {
|
||||
+ if ((w = mw - tw - x + borderpx) > mh) {
|
||||
if (c) {
|
||||
drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]);
|
||||
- drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, client_get_title(c), 0);
|
||||
+ drwl_text(m->drw, x, y, w, mh, m->lrpad / 2, client_get_title(c), 0);
|
||||
if (c && c->isfloating)
|
||||
- drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, 0, 0);
|
||||
+ drwl_rect(m->drw, x + boxs, y + boxs, boxw, boxw, 0, 0);
|
||||
} else {
|
||||
drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||
- drwl_rect(m->drw, x, 0, w, m->b.height, 1, 1);
|
||||
+ drwl_rect(m->drw, x, y, w, mh, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3183,7 +3189,7 @@ updatebar(Monitor *m)
|
||||
|
||||
m->b.scale = m->wlr_output->scale;
|
||||
m->lrpad = m->drw->font->height;
|
||||
- m->b.height = m->drw->font->height + 2;
|
||||
+ m->b.height = m->drw->font->height + 2 + borderpx * 2;
|
||||
m->b.real_height = (int)((float)m->b.height / m->wlr_output->scale);
|
||||
}
|
||||
|
||||
--
|
||||
2.46.0
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
### Description
|
||||
Add support for colored status text to the [bar](/dwl/dwl-patches/src/branch/main/patches/bar). Text can be colored in the same manner as with dwlb, namely by wrapping it between `^fg(color)` and `^fg()` or `^bg(color)` and `^bg()`, where `color` is a 6-digit hexadecimal value.
|
||||
|
||||
### Download
|
||||
- [git branch](/kerberoge/dwl/src/branch/barcolors)
|
||||
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/barcolors/barcolors.patch)
|
||||
|
||||
### Authors
|
||||
- [kerberoge](https://codeberg.org/kerberoge)
|
||||
@@ -0,0 +1,144 @@
|
||||
From d2b529d9ebee6b2e625afd5c89c2ede5bb0ca91b Mon Sep 17 00:00:00 2001
|
||||
From: Kerberoge <sjoerdenjh@gmail.com>
|
||||
Date: Sun, 25 Aug 2024 22:41:55 +0200
|
||||
Subject: [PATCH 1/1] updated barcolors
|
||||
|
||||
---
|
||||
dwl.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 87 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index ece537a..6663399 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -83,6 +83,7 @@
|
||||
#define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L)))
|
||||
#define LISTEN_STATIC(E, H) do { static struct wl_listener _l = {.notify = (H)}; wl_signal_add((E), &_l); } while (0)
|
||||
#define TEXTW(mon, text) (drwl_font_getwidth(mon->drw, text) + mon->lrpad)
|
||||
+#define PREFIX(str, prefix) !strncmp(str, prefix, strlen(prefix))
|
||||
|
||||
/* enums */
|
||||
enum { SchemeNorm, SchemeSel, SchemeUrg }; /* color schemes */
|
||||
@@ -318,6 +319,7 @@ static void destroykeyboardgroup(struct wl_listener *listener, void *data);
|
||||
static Monitor *dirtomon(enum wlr_direction dir);
|
||||
static void drawbar(Monitor *m);
|
||||
static void drawbars(void);
|
||||
+static int drawstatus(Monitor *m);
|
||||
static void focusclient(Client *c, int lift);
|
||||
static void focusmon(const Arg *arg);
|
||||
static void focusstack(const Arg *arg);
|
||||
@@ -448,7 +450,7 @@ static struct wlr_box sgeom;
|
||||
static struct wl_list mons;
|
||||
static Monitor *selmon;
|
||||
|
||||
-static char stext[256];
|
||||
+static char stext[512];
|
||||
static struct wl_event_source *status_event_source;
|
||||
|
||||
static const struct wlr_buffer_impl buffer_impl = {
|
||||
@@ -1519,11 +1521,8 @@ drawbar(Monitor *m)
|
||||
return;
|
||||
|
||||
/* draw status first so it can be overdrawn by tags later */
|
||||
- if (m == selmon) { /* status is only drawn on selected monitor */
|
||||
- drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||
- tw = TEXTW(m, stext) - m->lrpad + 2; /* 2px right padding */
|
||||
- drwl_text(m->drw, m->b.width - tw, 0, tw, m->b.height, 0, stext, 0);
|
||||
- }
|
||||
+ if (m == selmon) /* status is only drawn on selected monitor */
|
||||
+ tw = drawstatus(m);
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (c->mon != m)
|
||||
@@ -1577,6 +1576,88 @@ drawbars(void)
|
||||
drawbar(m);
|
||||
}
|
||||
|
||||
+int
|
||||
+drawstatus(Monitor *m)
|
||||
+{
|
||||
+ int x, tw, iw;
|
||||
+ char rstext[512] = "";
|
||||
+ char *p, *argstart, *argend, *itext;
|
||||
+ uint32_t scheme[3], *color;
|
||||
+
|
||||
+ /* calculate real width of stext */
|
||||
+ for (p = stext; *p; p++) {
|
||||
+ if (PREFIX(p, "^^")) {
|
||||
+ strncat(rstext, p, 2);
|
||||
+ p++;
|
||||
+ } else if (PREFIX(p, "^fg(") || PREFIX(p, "^bg(")) {
|
||||
+ argend = strchr(p, ')');
|
||||
+ if (!argend) { /* ignore this command */
|
||||
+ argstart = strchr(p, '(') + 1;
|
||||
+ strncat(rstext, p, argstart - p);
|
||||
+ p = argstart - 1;
|
||||
+ } else {
|
||||
+ p = argend;
|
||||
+ }
|
||||
+ } else {
|
||||
+ strncat(rstext, p, 1);
|
||||
+ }
|
||||
+ }
|
||||
+ tw = TEXTW(m, rstext) - m->lrpad;
|
||||
+
|
||||
+ x = m->b.width - tw;
|
||||
+ itext = stext;
|
||||
+ scheme[0] = colors[SchemeNorm][0];
|
||||
+ scheme[1] = colors[SchemeNorm][1];
|
||||
+ drwl_setscheme(m->drw, scheme);
|
||||
+ for (p = stext; *p; p++) {
|
||||
+ if (PREFIX(p, "^^")) {
|
||||
+ p++;
|
||||
+ } else if (PREFIX(p, "^fg(") || PREFIX(p, "^bg(")) {
|
||||
+ argstart = strchr(p, '(') + 1;
|
||||
+ argend = strchr(argstart, ')');
|
||||
+ if (!argend) { /* ignore this command */
|
||||
+ p = argstart - 1;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ *p = '\0';
|
||||
+ iw = TEXTW(m, itext) - m->lrpad;
|
||||
+ if (*itext) /* only draw text if there is something to draw */
|
||||
+ x = drwl_text(m->drw, x, 0, iw, m->b.height, 0, itext, 0);
|
||||
+ *p = '^';
|
||||
+
|
||||
+ if (PREFIX(p, "^fg("))
|
||||
+ color = &scheme[0];
|
||||
+ else
|
||||
+ color = &scheme[1];
|
||||
+
|
||||
+ if (argend != argstart) {
|
||||
+ *argend = '\0';
|
||||
+ *color = strtoul(argstart, NULL, 16);
|
||||
+ *color = *color << 8 | 0xff; /* add alpha channel */
|
||||
+ *argend = ')';
|
||||
+ } else {
|
||||
+ *color = 0; /* reset */
|
||||
+ }
|
||||
+
|
||||
+ /* reset color back to normal if none was provided */
|
||||
+ if (!scheme[0])
|
||||
+ scheme[0] = colors[SchemeNorm][0];
|
||||
+ if (!scheme[1])
|
||||
+ scheme[1] = colors[SchemeNorm][1];
|
||||
+
|
||||
+ itext = argend + 1;
|
||||
+ drwl_setscheme(m->drw, scheme);
|
||||
+ p = argend;
|
||||
+ }
|
||||
+ }
|
||||
+ iw = TEXTW(m, itext) - m->lrpad;
|
||||
+ if (*itext)
|
||||
+ drwl_text(m->drw, x, 0, iw, m->b.height, 0, itext, 0);
|
||||
+
|
||||
+ return tw;
|
||||
+}
|
||||
+
|
||||
void
|
||||
focusclient(Client *c, int lift)
|
||||
{
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
### Description
|
||||
|
||||
Adds the ability to change the [bar's](https://codeberg.org/dwl/dwl-patches/wiki/bar) height.
|
||||
|
||||
### Download
|
||||
- [0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barheight/barheight.patch) (bar 0.7)
|
||||
- [git branch](https://codeberg.org/Oak/dwl/src/branch/barheight)
|
||||
|
||||
### Authors
|
||||
- [Oak](https://codeberg.org/oak)
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From d2f3ac840845802eaf9ff7daf406f04722fd02aa Mon Sep 17 00:00:00 2001
|
||||
From: Oak <Oak@petrifiedoak.com>
|
||||
Date: Sun, 25 Aug 2024 17:43:17 +0200
|
||||
Subject: [PATCH] Implement barheight patch
|
||||
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwl.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 5d1dc2b..f11089c 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -7,6 +7,7 @@
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
+static const int user_bh = 30; /* 0 means that dwl will calculate barheight, >= 1 means dwl will use user_bh as the bar height. */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = {"monospace:size=10"};
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index ece537a..2863202 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -3183,7 +3183,7 @@ updatebar(Monitor *m)
|
||||
|
||||
m->b.scale = m->wlr_output->scale;
|
||||
m->lrpad = m->drw->font->height;
|
||||
- m->b.height = m->drw->font->height + 2;
|
||||
+ m->b.height = user_bh ? user_bh : m->drw->font->height + 2;
|
||||
m->b.real_height = (int)((float)m->b.height / m->wlr_output->scale);
|
||||
}
|
||||
|
||||
--
|
||||
2.46.0
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
### Description
|
||||
|
||||
Add vertical and horizontal space between the [bar](/dwl/dwl-patches/wiki/bar) and the edge of the screen.
|
||||
|
||||
### Download
|
||||
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/barpadding/barpadding.patch)
|
||||
|
||||
### Authors
|
||||
- [sewn](https://codeberg.org/sewn)
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
From f01cea73042155e856b2f41452724fe5c895eee4 Mon Sep 17 00:00:00 2001
|
||||
From: sewn <sewn@disroot.org>
|
||||
Date: Fri, 23 Aug 2024 09:59:03 +0300
|
||||
Subject: [PATCH] add vertical and horizontal spacing to bar
|
||||
|
||||
https://dwm.suckless.org/patches/barpadding/
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
dwl.c | 14 +++++++-------
|
||||
2 files changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 5d1dc2b..756b1ae 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -9,6 +9,8 @@ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
+static const int vertpad = 10; /* vertical padding of bar */
|
||||
+static const int sidepad = 10; /* horizontal padding of bar */
|
||||
static const char *fonts[] = {"monospace:size=10"};
|
||||
static const float rootcolor[] = COLOR(0x000000ff);
|
||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index ece537a..380549a 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -598,8 +598,8 @@ arrangelayers(Monitor *m)
|
||||
return;
|
||||
|
||||
if (m->scene_buffer->node.enabled) {
|
||||
- usable_area.height -= m->b.real_height;
|
||||
- usable_area.y += topbar ? m->b.real_height : 0;
|
||||
+ usable_area.height -= m->b.real_height + vertpad;
|
||||
+ usable_area.y += topbar ? m->b.real_height + vertpad : 0;
|
||||
}
|
||||
|
||||
/* Arrange exclusive surfaces from top->bottom */
|
||||
@@ -750,7 +750,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
if (!c && !exclusive_focus &&
|
||||
(node = wlr_scene_node_at(&layers[LyrBottom]->node, cursor->x, cursor->y, NULL, NULL)) &&
|
||||
(buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) {
|
||||
- cx = (cursor->x - selmon->m.x) * selmon->wlr_output->scale;
|
||||
+ cx = (cursor->x - selmon->m.x - sidepad) * selmon->wlr_output->scale;
|
||||
do
|
||||
x += TEXTW(selmon, tags[i]);
|
||||
while (cx >= x && ++i < LENGTH(tags));
|
||||
@@ -1562,8 +1562,8 @@ drawbar(Monitor *m)
|
||||
|
||||
wlr_scene_buffer_set_dest_size(m->scene_buffer,
|
||||
m->b.real_width, m->b.real_height);
|
||||
- wlr_scene_node_set_position(&m->scene_buffer->node, m->m.x,
|
||||
- m->m.y + (topbar ? 0 : m->m.height - m->b.real_height));
|
||||
+ wlr_scene_node_set_position(&m->scene_buffer->node, m->m.x + sidepad,
|
||||
+ m->m.y + (topbar ? vertpad : m->m.height - m->b.real_height - vertpad));
|
||||
wlr_scene_buffer_set_buffer(m->scene_buffer, &buf->base);
|
||||
wlr_buffer_unlock(&buf->base);
|
||||
}
|
||||
@@ -3162,8 +3162,8 @@ updatebar(Monitor *m)
|
||||
char fontattrs[12];
|
||||
|
||||
wlr_output_transformed_resolution(m->wlr_output, &rw, &rh);
|
||||
- m->b.width = rw;
|
||||
- m->b.real_width = (int)((float)m->b.width / m->wlr_output->scale);
|
||||
+ m->b.width = rw - (2 * sidepad);
|
||||
+ m->b.real_width = (int)((float)rw / m->wlr_output->scale) - (2 * sidepad);
|
||||
|
||||
wlr_scene_node_set_enabled(&m->scene_buffer->node, m->wlr_output->enabled ? showbar : 0);
|
||||
|
||||
--
|
||||
2.46.0
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
### Description
|
||||
A homegrown port of dwm's _truecenteredtitle_ patch, with the addition of a config option to toggle its effects.<br>Requires [the bar patch](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/bar) to be applied beforehand.
|
||||
|
||||

|
||||
|
||||
### Download
|
||||
- [v0.7/v0.6](/dwl/dwl-patches/raw/branch/main/patches/bartruecenteredtitle/bartruecenteredtitle.patch)<br>Works on both v0.7 and v0.6.
|
||||
|
||||
### Author
|
||||
- [moonsabre](https://codeberg.org/moonsabre)
|
||||
- [sewn](https://codeberg.org/sewn)
|
||||
@@ -0,0 +1,46 @@
|
||||
From 17501c9f28226b1f332d6842be0d7f50ba618a29 Mon Sep 17 00:00:00 2001
|
||||
From: moonsabre <moonsabre@tuta.io>
|
||||
Date: Fri, 14 Mar 2025 16:04:25 -0700
|
||||
Subject: [PATCH] Bar title centering parameter.
|
||||
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwl.c | 9 +++++++--
|
||||
2 files changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 5d1dc2b..8ac3a8b 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -9,6 +9,7 @@ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
+static const int centeredtitle = 1; /* 1 means centered title */
|
||||
static const char *fonts[] = {"monospace:size=10"};
|
||||
static const float rootcolor[] = COLOR(0x000000ff);
|
||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index ece537a..9eb816b 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -1551,9 +1551,14 @@ drawbar(Monitor *m)
|
||||
if ((w = m->b.width - tw - x) > m->b.height) {
|
||||
if (c) {
|
||||
drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]);
|
||||
- drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, client_get_title(c), 0);
|
||||
+ tw = TEXTW(selmon, client_get_title(c));
|
||||
+ drwl_text(m->drw, x, 0, w, m->b.height,
|
||||
+ !centeredtitle || tw > w ? m->lrpad / 2 : (w - tw) / 2,
|
||||
+ client_get_title(c), 0);
|
||||
if (c && c->isfloating)
|
||||
- drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, 0, 0);
|
||||
+ drwl_rect(m->drw,
|
||||
+ !centeredtitle || tw > w ? x + boxs : x + ((w - tw) / 2 - boxs * 8),
|
||||
+ boxs, boxw, boxw, 0, 0);
|
||||
} else {
|
||||
drwl_setscheme(m->drw, colors[SchemeNorm]);
|
||||
drwl_rect(m->drw, x, 0, w, m->b.height, 1, 1);
|
||||
--
|
||||
2.48.1
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,37 @@
|
||||
### Description
|
||||
Adds 2 more borders to each side (top, bottom, left, right) of every window.
|
||||
|
||||
|
||||
|
||||
<details>
|
||||
<summary>Preview</summary>
|
||||
<pre>
|
||||
With the following config:
|
||||
|
||||
```c
|
||||
static const unsigned int borderpx = 9; /* border pixel of windows */
|
||||
static const unsigned int borderspx = 3; /* width of the border that start from outside the windows */
|
||||
static const unsigned int borderepx = 3; /* width of the border that start from inside the windows */
|
||||
```
|
||||
|
||||
and `border_color_type` set to `BrdOriginal`:
|
||||
<img src="https://i.imgur.com/msead2K.png"/>
|
||||
|
||||
and `border_color_type` set to `BrdStart`:
|
||||
<img src="https://i.imgur.com/ssgPG36.png"/>
|
||||
|
||||
and `border_color_type` set to `BrdEnd`:
|
||||
<img src="https://i.imgur.com/i2Xtjy6.png"/>
|
||||
|
||||
and `border_color_type` set to `BrdStartEnd`:
|
||||
<img src="https://i.imgur.com/fnkitdR.png"/>
|
||||
</pre>
|
||||
</details>
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/wochap/dwl/src/branch/v0.5/borders)
|
||||
- [2024-06-04](https://codeberg.org/dwl/dwl-patches/raw/commit/1a6825f2b8cd23044312c8040d0bf63ee7f85bc5/patches/borders/borders.patch)
|
||||
- [v0.5](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/borders/borders.patch)
|
||||
|
||||
### Authors
|
||||
- [wochap](https://codeberg.org/wochap)
|
||||
@@ -1,19 +1,21 @@
|
||||
From 18abc170273690fd3fbbdcbe88b348a0b802ba91 Mon Sep 17 00:00:00 2001
|
||||
From b12cfff672f0705d8259cf26b3a574faa5ca43ae Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Wed, 6 Mar 2024 11:45:30 -0500
|
||||
Subject: [PATCH] add 2 more borders for each side
|
||||
Date: Tue, 4 Jun 2024 16:02:25 -0500
|
||||
Subject: [PATCH] implement borders patch
|
||||
|
||||
tihs patch adds 2 extra borders relative to the client, they don't
|
||||
change the size of the client
|
||||
---
|
||||
client.h | 16 +++++++++++++---
|
||||
config.def.h | 7 +++++++
|
||||
dwl.c | 41 +++++++++++++++++++++++++++++++++++++----
|
||||
3 files changed, 57 insertions(+), 7 deletions(-)
|
||||
config.def.h | 8 ++++++++
|
||||
dwl.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
3 files changed, 70 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/client.h b/client.h
|
||||
index 71c7d76..c65f3ec 100644
|
||||
index 800b867..33fd579 100644
|
||||
--- a/client.h
|
||||
+++ b/client.h
|
||||
@@ -309,11 +309,21 @@ client_send_close(Client *c)
|
||||
@@ -325,11 +325,21 @@ client_send_close(Client *c)
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -39,10 +41,10 @@ index 71c7d76..c65f3ec 100644
|
||||
|
||||
static inline void
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index db0babc..bc03d24 100644
|
||||
index 8847e58..2d6bbe5 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -7,7 +7,14 @@
|
||||
@@ -7,8 +7,16 @@
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
@@ -50,18 +52,20 @@ index db0babc..bc03d24 100644
|
||||
+static const unsigned int borderepx = 0; /* width of the border that start from inside the windows */
|
||||
+static const unsigned int borderspx_offset = 0; /* offset of the border that start from outside the windows */
|
||||
+static const unsigned int borderepx_negative_offset = 0; /* offset of the border that start from inside the windows */
|
||||
static const float rootcolor[] = COLOR(0x222222ff);
|
||||
static const float bordercolor[] = COLOR(0x444444ff);
|
||||
+static const float borderscolor[] = COLOR(0x444444ff); /* color of the border that start from outside the windows */
|
||||
+static const float borderecolor[] = COLOR(0x444444ff); /* color of the border that start from inside the windows */
|
||||
+static const int border_color_type = BrdOriginal; /* borders to be colored (focuscolor, urgentcolor) */
|
||||
+static const int borders_only_floating = 0;
|
||||
static const float focuscolor[] = COLOR(0x005577ff);
|
||||
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */
|
||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index ef27a1d..e11b185 100644
|
||||
index bf763df..303832a 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -80,6 +80,7 @@ enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrFS, LyrTop, LyrOverlay, LyrBlock,
|
||||
@@ -86,6 +86,7 @@ enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrBlock,
|
||||
enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar,
|
||||
NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */
|
||||
#endif
|
||||
@@ -69,7 +73,7 @@ index ef27a1d..e11b185 100644
|
||||
|
||||
typedef union {
|
||||
int i;
|
||||
@@ -103,6 +104,8 @@ typedef struct {
|
||||
@@ -109,6 +110,8 @@ typedef struct {
|
||||
Monitor *mon;
|
||||
struct wlr_scene_tree *scene;
|
||||
struct wlr_scene_rect *border[4]; /* top, bottom, left, right */
|
||||
@@ -78,7 +82,7 @@ index ef27a1d..e11b185 100644
|
||||
struct wlr_scene_tree *scene_surface;
|
||||
struct wl_list link;
|
||||
struct wl_list flink;
|
||||
@@ -127,6 +130,8 @@ typedef struct {
|
||||
@@ -136,6 +139,8 @@ typedef struct {
|
||||
struct wl_listener set_hints;
|
||||
#endif
|
||||
unsigned int bw;
|
||||
@@ -87,16 +91,16 @@ index ef27a1d..e11b185 100644
|
||||
uint32_t tags;
|
||||
int isfloating, isurgent, isfullscreen;
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
@@ -971,6 +976,8 @@ createnotify(struct wl_listener *listener, void *data)
|
||||
@@ -973,6 +978,8 @@ createnotify(struct wl_listener *listener, void *data)
|
||||
c = xdg_surface->data = ecalloc(1, sizeof(*c));
|
||||
c->surface.xdg = xdg_surface;
|
||||
c->bw = borderpx;
|
||||
+ c->bws = borderspx;
|
||||
+ c->bwe = borderepx;
|
||||
+ c->bws = borders_only_floating ? 0 : borderspx;
|
||||
+ c->bwe = borders_only_floating ? 0 : borderepx;
|
||||
|
||||
wlr_xdg_toplevel_set_wm_capabilities(xdg_surface->toplevel,
|
||||
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
|
||||
@@ -1205,7 +1212,7 @@ focusclient(Client *c, int lift)
|
||||
@@ -1268,7 +1275,7 @@ focusclient(Client *c, int lift)
|
||||
/* Don't change border color if there is an exclusive focus or we are
|
||||
* handling a drag operation */
|
||||
if (!exclusive_focus && !seat->drag)
|
||||
@@ -105,7 +109,7 @@ index ef27a1d..e11b185 100644
|
||||
}
|
||||
|
||||
/* Deactivate old client if focus is changing */
|
||||
@@ -1222,7 +1229,7 @@ focusclient(Client *c, int lift)
|
||||
@@ -1285,7 +1292,7 @@ focusclient(Client *c, int lift)
|
||||
/* Don't deactivate old client if the new one wants focus, as this causes issues with winecfg
|
||||
* and probably other clients */
|
||||
} else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) {
|
||||
@@ -114,9 +118,9 @@ index ef27a1d..e11b185 100644
|
||||
|
||||
client_activate_surface(old, 0);
|
||||
}
|
||||
@@ -1535,6 +1542,12 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
for (i = 0; i < 4; i++) {
|
||||
c->border[i] = wlr_scene_rect_create(c->scene, 0, 0, bordercolor);
|
||||
@@ -1597,6 +1604,12 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
c->border[i] = wlr_scene_rect_create(c->scene, 0, 0,
|
||||
c->isurgent ? urgentcolor : bordercolor);
|
||||
c->border[i]->node.data = c;
|
||||
+
|
||||
+ c->borders[i] = wlr_scene_rect_create(c->scene, 0, 0, borderscolor);
|
||||
@@ -127,7 +131,20 @@ index ef27a1d..e11b185 100644
|
||||
}
|
||||
|
||||
/* Initialize client geometry with room for border */
|
||||
@@ -1951,6 +1964,24 @@ resize(Client *c, struct wlr_box geo, int interact)
|
||||
@@ -1618,6 +1631,12 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
} else {
|
||||
applyrules(c);
|
||||
}
|
||||
+
|
||||
+ if (borders_only_floating) {
|
||||
+ c->bws = c->isfloating ? borderspx : 0;
|
||||
+ c->bwe = c->isfloating ? borderepx : 0;
|
||||
+ }
|
||||
+
|
||||
printstatus();
|
||||
|
||||
unset_fullscreen:
|
||||
@@ -2051,6 +2070,24 @@ resize(Client *c, struct wlr_box geo, int interact)
|
||||
wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw);
|
||||
wlr_scene_node_set_position(&c->border[3]->node, c->geom.width - c->bw, c->bw);
|
||||
|
||||
@@ -152,7 +169,20 @@ index ef27a1d..e11b185 100644
|
||||
/* this is a no-op if size hasn't changed */
|
||||
c->resize = client_set_size(c, c->geom.width - 2 * c->bw,
|
||||
c->geom.height - 2 * c->bw);
|
||||
@@ -2063,6 +2094,8 @@ setfullscreen(Client *c, int fullscreen)
|
||||
@@ -2151,6 +2188,12 @@ setfloating(Client *c, int floating)
|
||||
c->isfloating = floating;
|
||||
if (!c->mon)
|
||||
return;
|
||||
+
|
||||
+ if (borders_only_floating) {
|
||||
+ c->bws = c->isfloating ? borderspx : 0;
|
||||
+ c->bwe = c->isfloating ? borderepx : 0;
|
||||
+ }
|
||||
+
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen ||
|
||||
(p && p->isfullscreen) ? LyrFS
|
||||
: c->isfloating ? LyrFloat : LyrTile]);
|
||||
@@ -2165,6 +2208,8 @@ setfullscreen(Client *c, int fullscreen)
|
||||
if (!c->mon)
|
||||
return;
|
||||
c->bw = fullscreen ? 0 : borderpx;
|
||||
@@ -161,24 +191,23 @@ index ef27a1d..e11b185 100644
|
||||
client_set_fullscreen(c, fullscreen);
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen
|
||||
? LyrFS : c->isfloating ? LyrFloat : LyrTile]);
|
||||
@@ -2651,7 +2684,7 @@ urgent(struct wl_listener *listener, void *data)
|
||||
return;
|
||||
@@ -2819,7 +2864,7 @@ urgent(struct wl_listener *listener, void *data)
|
||||
printstatus();
|
||||
|
||||
if (client_surface(c)->mapped)
|
||||
- client_set_border_color(c, urgentcolor);
|
||||
+ client_set_border_color(c, urgentcolor, urgentcolor, urgentcolor);
|
||||
c->isurgent = 1;
|
||||
printstatus();
|
||||
}
|
||||
@@ -2835,7 +2868,7 @@ sethints(struct wl_listener *listener, void *data)
|
||||
c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints);
|
||||
|
||||
void
|
||||
@@ -3023,7 +3068,7 @@ sethints(struct wl_listener *listener, void *data)
|
||||
printstatus();
|
||||
|
||||
if (c->isurgent && surface && surface->mapped)
|
||||
- client_set_border_color(c, urgentcolor);
|
||||
+ client_set_border_color(c, urgentcolor, urgentcolor, urgentcolor);
|
||||
|
||||
printstatus();
|
||||
}
|
||||
|
||||
void
|
||||
--
|
||||
2.42.0
|
||||
|
||||
2.44.1
|
||||
@@ -0,0 +1,27 @@
|
||||
### Description
|
||||
bstack and bstackhoriz are two stack layouts for dwl.
|
||||
### Scheme
|
||||
```
|
||||
bstack (TTT) bstackhoriz (===)
|
||||
+-----------------+ +-----------------+
|
||||
| | | |
|
||||
| | | |
|
||||
| | | |
|
||||
+-----+-----+-----+ +-----------------+
|
||||
| | | | +-----------------+
|
||||
| | | | +-----------------+
|
||||
+-----+-----+-----+ +-----------------+
|
||||
```
|
||||
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/wochap/dwl/src/branch/v0.6-b/bottomstack)
|
||||
- [2024-07-09](https://codeberg.org/dwl/dwl-patches/raw/commit/20de07dc8759200c8a4c9651475acb331d245890/patches/bottomstack/bottomstack.patch)
|
||||
- [2024-04-11](https://codeberg.org/dwl/dwl-patches/raw/commit/0f4e40fee49d1b8b430778e241b29496ae3b3b70/bottomstack/bottomstack.patch)
|
||||
- [v0.5](https://codeberg.org/dwl/dwl-patches/raw/commit/5368aa392c7ebf8d7d24c232b80cfae1be457d41/bottomstack/bottomstack.patch)
|
||||
|
||||
### Authors
|
||||
- [wochap](https://codeberg.org/wochap)
|
||||
- [DanielMowitz](https://github.com/DanielMowitz)
|
||||
- [Abanoub8](https://github.com/Abanoub8)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 589c964e47965d84ffd3a2b036e75feddd619eed Mon Sep 17 00:00:00 2001
|
||||
From b352fb08f40b1ee2d8c4748be4922df711e3aaa9 Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Thu, 11 Apr 2024 16:50:20 -0500
|
||||
Subject: [PATCH] add bstack and bstackhoriz layouts
|
||||
Date: Fri, 5 Jul 2024 10:44:29 -0500
|
||||
Subject: [PATCH] implement bottomstack
|
||||
|
||||
---
|
||||
config.def.h | 4 +++
|
||||
@@ -9,10 +9,10 @@ Subject: [PATCH] add bstack and bstackhoriz layouts
|
||||
2 files changed, 88 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 8847e58..68b62db 100644
|
||||
index 22d2171..5aac3e9 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -33,6 +33,8 @@ static const Layout layouts[] = {
|
||||
@@ -34,6 +34,8 @@ static const Layout layouts[] = {
|
||||
{ "[]=", tile },
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
@@ -21,7 +21,7 @@ index 8847e58..68b62db 100644
|
||||
};
|
||||
|
||||
/* monitors */
|
||||
@@ -134,6 +136,8 @@ static const Key keys[] = {
|
||||
@@ -139,6 +141,8 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||
@@ -31,10 +31,10 @@ index 8847e58..68b62db 100644
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index bf763df..dc3d000 100644
|
||||
index dc0437e..5648d5f 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -55,6 +55,7 @@
|
||||
@@ -57,6 +57,7 @@
|
||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
||||
#include <wlr/types/wlr_xdg_shell.h>
|
||||
@@ -42,7 +42,7 @@ index bf763df..dc3d000 100644
|
||||
#include <wlr/util/log.h>
|
||||
#include <wlr/util/region.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
@@ -347,6 +348,8 @@ static Monitor *xytomon(double x, double y);
|
||||
@@ -351,6 +352,8 @@ static Monitor *xytomon(double x, double y);
|
||||
static void xytonode(double x, double y, struct wlr_surface **psurface,
|
||||
Client **pc, LayerSurface **pl, double *nx, double *ny);
|
||||
static void zoom(const Arg *arg);
|
||||
@@ -51,7 +51,7 @@ index bf763df..dc3d000 100644
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
@@ -3088,3 +3091,84 @@ main(int argc, char *argv[])
|
||||
@@ -3160,3 +3163,84 @@ main(int argc, char *argv[])
|
||||
usage:
|
||||
die("Usage: %s [-v] [-d] [-s startup command]", argv[0]);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ index bf763df..dc3d000 100644
|
||||
+ return;
|
||||
+
|
||||
+ if (n > m->nmaster) {
|
||||
+ mh = ROUND(m->nmaster ? m->mfact * m->w.height : 0);
|
||||
+ mh = (int)round(m->nmaster ? m->mfact * m->w.height : 0);
|
||||
+ tw = m->w.width / (n - m->nmaster);
|
||||
+ ty = m->w.y + mh;
|
||||
+ } else {
|
||||
@@ -111,7 +111,7 @@ index bf763df..dc3d000 100644
|
||||
+ return;
|
||||
+
|
||||
+ if (n > m->nmaster) {
|
||||
+ mh = ROUND(m->nmaster ? m->mfact * m->w.height : 0);
|
||||
+ mh = (int)round(m->nmaster ? m->mfact * m->w.height : 0);
|
||||
+ th = (m->w.height - mh) / (n - m->nmaster);
|
||||
+ ty = m->w.y + mh;
|
||||
+ } else {
|
||||
@@ -137,5 +137,4 @@ index bf763df..dc3d000 100644
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.43.2
|
||||
|
||||
2.45.1
|
||||
@@ -0,0 +1,103 @@
|
||||
### Description
|
||||
|
||||
# btrtile — A Focus-Driven Tiling Layout
|
||||
|
||||
It provides a focus-driven, mouse- and keyboard-friendly tiling layout that grants you granular control over how clients are placed and resized.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
# Why btrtile
|
||||
|
||||
While dwl’s patches folder is full of different layouts, I couldn't find suitable layout that would work well with my workflow and single ultrawide monitor setup. btrtile aims to solve that by introducing a layout strategy that splits clients according to user focus and pointer position.
|
||||
|
||||
---
|
||||
|
||||
# Features
|
||||
|
||||
- **Combined Tiling and Management**
|
||||
Combines tiling layout and management of clients under one patchset.
|
||||
|
||||
- **Focus-Driven Splits**
|
||||
When you add a new client, btrtile checks where your pointer is relative to the focused client’s geometry.
|
||||
- If the pointer is on the left half (for a horizontally large client), the new client spawns on the left side, and vice versa.
|
||||
- By default, new splits are 50/50.
|
||||
|
||||
- **Adaptive Splitting**
|
||||
- If the area to be split is wider than its height, btrtile does a vertical split.
|
||||
- Otherwise, it does a horizontal split.
|
||||
|
||||
- **Keyboard and Mouse Driven**
|
||||
- Supports keyboard-based commands for quick ratio adjustments and client swapping.
|
||||
- Mouse-based resizing and moving are integrated for more intuitive manipulation.
|
||||
|
||||
---
|
||||
|
||||
# How It Works
|
||||
|
||||
btrtile organizes clients using a binary tree data structure that represents splits either vertically or horizontally.
|
||||
|
||||
When a new client appears:
|
||||
1. **Focused Client Detection**
|
||||
btrtile checks your pointer location to find which client (if any) you’re interacting with.
|
||||
2. **Split Creation**
|
||||
- If there’s a focused client, btrtile creates a split node around it, placing the new client on the side where your pointer is.
|
||||
|
||||
3. **Ratio Management**
|
||||
Each split node has a `split_ratio` (defaulting to 0.5). This ratio defines how much space is allocated to each child node. You can adjust this ratio using keyboard or mouse actions.
|
||||
|
||||
---
|
||||
|
||||
# What It Doesn’t Handle
|
||||
|
||||
- **Suckless philosophy**
|
||||
- Yea, it's a bloat. I tried to hide the suck inside a single file as much I could. While this approach is not ideal, it's how it's at least for now.
|
||||
|
||||
---
|
||||
|
||||
# Configuring btrtile
|
||||
|
||||
btrtile adds couple variables to config.h to fine tune the mouse resizing of tiled clients.
|
||||
|
||||
1. **resize_factor**
|
||||
- A multiplier to transfer pointer movement to client weight ratio. Depends heavily on mouse sensivity.
|
||||
Defaults to 0.0002f.
|
||||
|
||||
2. **resize_interval_ms**
|
||||
- A time based resize call limiter. Depends on framerate and screen refresh rate.
|
||||
Defaults to 16ms. (~60 resize updates per second)
|
||||
|
||||
Fine tune these values to find the best values for your setup, smoother resizing can significally increase cpu overhead.
|
||||
If mouse resizing feels sluggish, you can try compiling dwl with more aggressive optimization flags like -O2/-O3.
|
||||
|
||||
---
|
||||
|
||||
# Patch recommendations
|
||||
|
||||
1. **Patches that I use with my btrtile**
|
||||
|
||||
- [focusdir](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/focusdir)
|
||||
Great patch to move focus between clients.
|
||||
|
||||
- [rotatetags](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/rotatetags)
|
||||
Good patch to rotate the view or shift clients between tags.
|
||||
|
||||
- [warpcursor](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/warpcursor)
|
||||
Moves cursor location to focused client.
|
||||
|
||||
- [pertag](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/pertag)
|
||||
Allows each tag to have individual layout setups.
|
||||
|
||||
- [gaps](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/gaps)
|
||||
Add gaps between clients.
|
||||
|
||||
---
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/julmajustus/dwl/src/branch/btrtile-dev)
|
||||
- [0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/btrtile/btrtile-v0.7.patch)
|
||||
- [0.7 WITH gaps](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/btrtile/btrtile-v0.7-gaps.patch)
|
||||
|
||||
### Authors
|
||||
- [julmajustus](https://codeberg.org/julmajustus)
|
||||
@@ -0,0 +1,922 @@
|
||||
From 858ef20d36c2d5e6a23a69b3b5909a80fab05f97 Mon Sep 17 00:00:00 2001
|
||||
From: julmajustus <julmajustus@tutanota.com>
|
||||
Date: Thu, 13 Feb 2025 23:25:20 +0200
|
||||
Subject: [PATCH] btrtile-gaps with multi-tag support
|
||||
|
||||
---
|
||||
btrtile.c | 582 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
config.def.h | 12 ++
|
||||
dwl.c | 152 +++++++++++---
|
||||
3 files changed, 717 insertions(+), 29 deletions(-)
|
||||
create mode 100644 btrtile.c
|
||||
|
||||
diff --git a/btrtile.c b/btrtile.c
|
||||
new file mode 100644
|
||||
index 0000000..650cab5
|
||||
--- /dev/null
|
||||
+++ b/btrtile.c
|
||||
@@ -0,0 +1,582 @@
|
||||
+/* ************************************************************************** */
|
||||
+/* */
|
||||
+/* ::: :::::::: */
|
||||
+/* btrtile.c :+: :+: :+: */
|
||||
+/* +:+ +:+ +:+ */
|
||||
+/* By: jmakkone <jmakkone@student.hive.fi> +#+ +:+ +#+ */
|
||||
+/* +#+#+#+#+#+ +#+ */
|
||||
+/* Created: 2024/12/15 00:26:07 by jmakkone #+# #+# */
|
||||
+/* Updated: 2025/02/13 23:25:03 by jmakkone ### ########.fr */
|
||||
+/* */
|
||||
+/* ************************************************************************** */
|
||||
+
|
||||
+typedef struct LayoutNode {
|
||||
+ unsigned int is_client_node;
|
||||
+ unsigned int is_split_vertically;
|
||||
+ float split_ratio;
|
||||
+ struct LayoutNode *left;
|
||||
+ struct LayoutNode *right;
|
||||
+ struct LayoutNode *split_node;
|
||||
+ Client *client;
|
||||
+} LayoutNode;
|
||||
+
|
||||
+static void apply_layout(Monitor *m, LayoutNode *node,
|
||||
+ struct wlr_box area, unsigned int is_root);
|
||||
+static void btrtile(Monitor *m);
|
||||
+static LayoutNode *create_client_node(Client *c);
|
||||
+static LayoutNode *create_split_node(unsigned int is_split_vertically,
|
||||
+ LayoutNode *left, LayoutNode *right);
|
||||
+static void destroy_node(LayoutNode *node);
|
||||
+static void destroy_tree(Monitor *m);
|
||||
+static LayoutNode *find_client_node(LayoutNode *node, Client *c);
|
||||
+static LayoutNode *find_suitable_split(LayoutNode *start, unsigned int need_vert);
|
||||
+static void init_tree(Monitor *m);
|
||||
+static void insert_client(Monitor *m, Client *focused_client, Client *new_client);
|
||||
+static LayoutNode *remove_client_node(LayoutNode *node, Client *c);
|
||||
+static void remove_client(Monitor *m, Client *c);
|
||||
+static void setratio_h(const Arg *arg);
|
||||
+static void setratio_v(const Arg *arg);
|
||||
+static void swapclients(const Arg *arg);
|
||||
+static unsigned int visible_count(LayoutNode *node, Monitor *m);
|
||||
+static Client *xytoclient(double x, double y);
|
||||
+
|
||||
+static int resizing_from_mouse = 0;
|
||||
+static double resize_last_update_x, resize_last_update_y;
|
||||
+static uint32_t last_resize_time = 0;
|
||||
+
|
||||
+void
|
||||
+apply_layout(Monitor *m, LayoutNode *node,
|
||||
+ struct wlr_box area, unsigned int is_root)
|
||||
+{
|
||||
+ Client *c;
|
||||
+ float ratio;
|
||||
+ unsigned int left_count, right_count, mid, e = m->gaps;
|
||||
+ struct wlr_box left_area, right_area;
|
||||
+
|
||||
+ if (!node)
|
||||
+ return;
|
||||
+
|
||||
+ if (is_root && e) {
|
||||
+ area.x += gappx;
|
||||
+ area.y += gappx;
|
||||
+ area.width -= 2 * gappx;
|
||||
+ area.height -= 2 * gappx;
|
||||
+ }
|
||||
+
|
||||
+ /* If this node is a client node, check if it is visible. */
|
||||
+ if (node->is_client_node) {
|
||||
+ c = node->client;
|
||||
+ if (!c || !VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
+ return;
|
||||
+ resize(c, area, 0);
|
||||
+ c->old_geom = area;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* For a split node, we see how many visible children are on each side: */
|
||||
+ left_count = visible_count(node->left, m);
|
||||
+ right_count = visible_count(node->right, m);
|
||||
+
|
||||
+ if (left_count == 0 && right_count == 0) {
|
||||
+ return;
|
||||
+ } else if (left_count > 0 && right_count == 0) {
|
||||
+ apply_layout(m, node->left, area, 0);
|
||||
+ return;
|
||||
+ } else if (left_count == 0 && right_count > 0) {
|
||||
+ apply_layout(m, node->right, area, 0);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* If we’re here, we have visible clients in both subtrees. */
|
||||
+ ratio = node->split_ratio;
|
||||
+ if (ratio < 0.05f)
|
||||
+ ratio = 0.05f;
|
||||
+ if (ratio > 0.95f)
|
||||
+ ratio = 0.95f;
|
||||
+
|
||||
+ memset(&left_area, 0, sizeof(left_area));
|
||||
+ memset(&right_area, 0, sizeof(right_area));
|
||||
+
|
||||
+ if (node->is_split_vertically) {
|
||||
+ mid = (unsigned int)(area.width * ratio);
|
||||
+ left_area.x = area.x;
|
||||
+ left_area.y = area.y;
|
||||
+ left_area.width = mid;
|
||||
+ left_area.height = area.height;
|
||||
+
|
||||
+ right_area.x = area.x + mid;
|
||||
+ right_area.y = area.y;
|
||||
+ right_area.width = area.width - mid;
|
||||
+ right_area.height = area.height;
|
||||
+
|
||||
+ if (e) {
|
||||
+ left_area.width -= gappx / 2;
|
||||
+ right_area.x += gappx / 2;
|
||||
+ right_area.width -= gappx / 2;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* horizontal split */
|
||||
+ mid = (unsigned int)(area.height * ratio);
|
||||
+ left_area.x = area.x;
|
||||
+ left_area.y = area.y;
|
||||
+ left_area.width = area.width;
|
||||
+ left_area.height = mid;
|
||||
+
|
||||
+ right_area.x = area.x;
|
||||
+ right_area.y = area.y + mid;
|
||||
+ right_area.width = area.width;
|
||||
+ right_area.height= area.height - mid;
|
||||
+
|
||||
+ if (e) {
|
||||
+ left_area.height -= gappx / 2;
|
||||
+ right_area.y += gappx / 2;
|
||||
+ right_area.height -= gappx / 2;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ apply_layout(m, node->left, left_area, 0);
|
||||
+ apply_layout(m, node->right, right_area, 0);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+btrtile(Monitor *m)
|
||||
+{
|
||||
+ Client *c, *focused = NULL;
|
||||
+ int n = 0;
|
||||
+ LayoutNode *found;
|
||||
+ struct wlr_box full_area;
|
||||
+
|
||||
+ if (!m || !m->root)
|
||||
+ return;
|
||||
+
|
||||
+ /* Remove non tiled clients from tree. */
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (c->mon == m && !c->isfloating && !c->isfullscreen) {
|
||||
+ } else {
|
||||
+ remove_client(m, c);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* If no client is found under cursor, fallback to focustop(m) */
|
||||
+ if (!(focused = xytoclient(cursor->x, cursor->y)))
|
||||
+ focused = focustop(m);
|
||||
+
|
||||
+ /* Insert visible clients that are not part of the tree. */
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen && c->mon == m) {
|
||||
+ found = find_client_node(m->root, c);
|
||||
+ if (!found) {
|
||||
+ insert_client(m, focused, c);
|
||||
+ }
|
||||
+ n++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (n == 0)
|
||||
+ return;
|
||||
+
|
||||
+ full_area = m->w;
|
||||
+ apply_layout(m, m->root, full_area, 1);
|
||||
+}
|
||||
+
|
||||
+LayoutNode *
|
||||
+create_client_node(Client *c)
|
||||
+{
|
||||
+ LayoutNode *node = calloc(1, sizeof(LayoutNode));
|
||||
+
|
||||
+ if (!node)
|
||||
+ return NULL;
|
||||
+ node->is_client_node = 1;
|
||||
+ node->split_ratio = 0.5f;
|
||||
+ node->client = c;
|
||||
+ return node;
|
||||
+}
|
||||
+
|
||||
+LayoutNode *
|
||||
+create_split_node(unsigned int is_split_vertically,
|
||||
+ LayoutNode *left, LayoutNode *right)
|
||||
+{
|
||||
+ LayoutNode *node = calloc(1, sizeof(LayoutNode));
|
||||
+
|
||||
+ if (!node)
|
||||
+ return NULL;
|
||||
+ node->is_client_node = 0;
|
||||
+ node->split_ratio = 0.5f;
|
||||
+ node->is_split_vertically = is_split_vertically;
|
||||
+ node->left = left;
|
||||
+ node->right = right;
|
||||
+ if (left)
|
||||
+ left->split_node = node;
|
||||
+ if (right)
|
||||
+ right->split_node = node;
|
||||
+ return node;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+destroy_node(LayoutNode *node)
|
||||
+{
|
||||
+ if (!node)
|
||||
+ return;
|
||||
+ if (!node->is_client_node) {
|
||||
+ destroy_node(node->left);
|
||||
+ destroy_node(node->right);
|
||||
+ }
|
||||
+ free(node);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+destroy_tree(Monitor *m)
|
||||
+{
|
||||
+ if (!m || !m->root)
|
||||
+ return;
|
||||
+ destroy_node(m->root);
|
||||
+ m->root = NULL;
|
||||
+}
|
||||
+
|
||||
+LayoutNode *
|
||||
+find_client_node(LayoutNode *node, Client *c)
|
||||
+{
|
||||
+ LayoutNode *res;
|
||||
+
|
||||
+ if (!node || !c)
|
||||
+ return NULL;
|
||||
+ if (node->is_client_node) {
|
||||
+ return (node->client == c) ? node : NULL;
|
||||
+ }
|
||||
+ res = find_client_node(node->left, c);
|
||||
+ return res ? res : find_client_node(node->right, c);
|
||||
+}
|
||||
+
|
||||
+LayoutNode *
|
||||
+find_suitable_split(LayoutNode *start_node, unsigned int need_vertical)
|
||||
+{
|
||||
+ LayoutNode *n = start_node;
|
||||
+ /* if we started from a client node, jump to its parent: */
|
||||
+ if (n && n->is_client_node)
|
||||
+ n = n->split_node;
|
||||
+
|
||||
+ while (n) {
|
||||
+ if (!n->is_client_node && n->is_split_vertically == need_vertical &&
|
||||
+ visible_count(n->left, selmon) > 0 && visible_count(n->right, selmon) > 0)
|
||||
+ return n;
|
||||
+ n = n->split_node;
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+init_tree(Monitor *m)
|
||||
+{
|
||||
+ if (!m)
|
||||
+ return;
|
||||
+ m->root = calloc(1, sizeof(LayoutNode));
|
||||
+ if (!m->root)
|
||||
+ m->root = NULL;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+insert_client(Monitor *m, Client *focused_client, Client *new_client)
|
||||
+{
|
||||
+ Client *old_client;
|
||||
+ LayoutNode **root = &m->root, *old_root,
|
||||
+ *focused_node, *new_client_node, *old_client_node;
|
||||
+ unsigned int wider, mid_x, mid_y;
|
||||
+
|
||||
+ /* If no root , new client becomes the root. */
|
||||
+ if (!*root) {
|
||||
+ *root = create_client_node(new_client);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Find the focused_client node,
|
||||
+ * if not found split the root. */
|
||||
+ focused_node = focused_client ?
|
||||
+ find_client_node(*root, focused_client) : NULL;
|
||||
+ if (!focused_node) {
|
||||
+ old_root = *root;
|
||||
+ new_client_node = create_client_node(new_client);
|
||||
+ *root = create_split_node(1, old_root, new_client_node);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Turn focused node from a client node into a split node,
|
||||
+ * and attach old_client + new_client. */
|
||||
+ old_client = focused_node->client;
|
||||
+ old_client_node = create_client_node(old_client);
|
||||
+ new_client_node = create_client_node(new_client);
|
||||
+
|
||||
+ /* Decide split direction. */
|
||||
+ wider = (focused_client->geom.width >= focused_client->geom.height);
|
||||
+ focused_node->is_client_node = 0;
|
||||
+ focused_node->client = NULL;
|
||||
+ focused_node->is_split_vertically = (wider ? 1 : 0);
|
||||
+
|
||||
+ /* Pick new_client side depending on the cursor position. */
|
||||
+ mid_x = focused_client->geom.x + focused_client->geom.width / 2;
|
||||
+ mid_y = focused_client->geom.y + focused_client->geom.height / 2;
|
||||
+
|
||||
+ if (wider) {
|
||||
+ /* vertical split => left vs right */
|
||||
+ if (cursor->x <= mid_x) {
|
||||
+ focused_node->left = new_client_node;
|
||||
+ focused_node->right = old_client_node;
|
||||
+ } else {
|
||||
+ focused_node->left = old_client_node;
|
||||
+ focused_node->right = new_client_node;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* horizontal split => top vs bottom */
|
||||
+ if (cursor->y <= mid_y) {
|
||||
+ focused_node->left = new_client_node;
|
||||
+ focused_node->right = old_client_node;
|
||||
+ } else {
|
||||
+ focused_node->left = old_client_node;
|
||||
+ focused_node->right = new_client_node;
|
||||
+ }
|
||||
+ }
|
||||
+ old_client_node->split_node = focused_node;
|
||||
+ new_client_node->split_node = focused_node;
|
||||
+ focused_node->split_ratio = 0.5f;
|
||||
+}
|
||||
+
|
||||
+LayoutNode *
|
||||
+remove_client_node(LayoutNode *node, Client *c)
|
||||
+{
|
||||
+ LayoutNode *tmp;
|
||||
+ if (!node)
|
||||
+ return NULL;
|
||||
+ if (node->is_client_node) {
|
||||
+ /* If this client_node is the client we're removing,
|
||||
+ * return NULL to remove it */
|
||||
+ if (node->client == c) {
|
||||
+ free(node);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ return node;
|
||||
+ }
|
||||
+
|
||||
+ node->left = remove_client_node(node->left, c);
|
||||
+ node->right = remove_client_node(node->right, c);
|
||||
+
|
||||
+ /* If one of the client node is NULL after removal and the other is not,
|
||||
+ * we "lift" the other client node up to replace this split node. */
|
||||
+ if (!node->left && node->right) {
|
||||
+ tmp = node->right;
|
||||
+
|
||||
+ /* Save pointer to split node */
|
||||
+ if (tmp)
|
||||
+ tmp->split_node = node->split_node;
|
||||
+
|
||||
+ free(node);
|
||||
+ return tmp;
|
||||
+ }
|
||||
+
|
||||
+ if (!node->right && node->left) {
|
||||
+ tmp = node->left;
|
||||
+
|
||||
+ /* Save pointer to split node */
|
||||
+ if (tmp)
|
||||
+ tmp->split_node = node->split_node;
|
||||
+
|
||||
+ free(node);
|
||||
+ return tmp;
|
||||
+ }
|
||||
+
|
||||
+ /* If both children exist or both are NULL (empty tree),
|
||||
+ * return node as is. */
|
||||
+ return node;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+remove_client(Monitor *m, Client *c)
|
||||
+{
|
||||
+ if (!m->root || !c)
|
||||
+ return;
|
||||
+ m->root = remove_client_node(m->root, c);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+setratio_h(const Arg *arg)
|
||||
+{
|
||||
+ Client *sel = focustop(selmon);
|
||||
+ LayoutNode *client_node, *split_node;
|
||||
+ float new_ratio;
|
||||
+
|
||||
+ if (!sel || !selmon || !selmon->lt[selmon->sellt]->arrange)
|
||||
+ return;
|
||||
+
|
||||
+ client_node = find_client_node(selmon->root, sel);
|
||||
+ if (!client_node)
|
||||
+ return;
|
||||
+
|
||||
+ split_node = find_suitable_split(client_node, 1);
|
||||
+ if (!split_node)
|
||||
+ return;
|
||||
+
|
||||
+ new_ratio = (arg->f != 0.0f) ? (split_node->split_ratio + arg->f) : 0.5f;
|
||||
+ if (new_ratio < 0.05f)
|
||||
+ new_ratio = 0.05f;
|
||||
+ if (new_ratio > 0.95f)
|
||||
+ new_ratio = 0.95f;
|
||||
+ split_node->split_ratio = new_ratio;
|
||||
+
|
||||
+ /* Skip the arrange if done resizing by mouse,
|
||||
+ * we call arrange from motionotify */
|
||||
+ if (!resizing_from_mouse) {
|
||||
+ arrange(selmon);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+setratio_v(const Arg *arg)
|
||||
+{
|
||||
+ Client *sel = focustop(selmon);
|
||||
+ LayoutNode *client_node, *split_node;
|
||||
+ float new_ratio;
|
||||
+
|
||||
+ if (!sel || !selmon || !selmon->lt[selmon->sellt]->arrange)
|
||||
+ return;
|
||||
+
|
||||
+ client_node = find_client_node(selmon->root, sel);
|
||||
+ if (!client_node)
|
||||
+ return;
|
||||
+
|
||||
+ split_node = find_suitable_split(client_node, 0);
|
||||
+ if (!split_node)
|
||||
+ return;
|
||||
+
|
||||
+ new_ratio = (arg->f != 0.0f) ? (split_node->split_ratio + arg->f) : 0.5f;
|
||||
+ if (new_ratio < 0.05f)
|
||||
+ new_ratio = 0.05f;
|
||||
+ if (new_ratio > 0.95f)
|
||||
+ new_ratio = 0.95f;
|
||||
+ split_node->split_ratio = new_ratio;
|
||||
+
|
||||
+ /* Skip the arrange if done resizing by mouse,
|
||||
+ * we call arrange from motionotify */
|
||||
+ if (!resizing_from_mouse) {
|
||||
+ arrange(selmon);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void swapclients(const Arg *arg) {
|
||||
+ Client *c, *tmp, *target = NULL, *sel = focustop(selmon);
|
||||
+ LayoutNode *sel_node, *target_node;
|
||||
+ int closest_dist = INT_MAX, dist, sel_center_x, sel_center_y,
|
||||
+ cand_center_x, cand_center_y;
|
||||
+
|
||||
+ if (!sel || sel->isfullscreen ||
|
||||
+ !selmon->root || !selmon->lt[selmon->sellt]->arrange)
|
||||
+ return;
|
||||
+
|
||||
+
|
||||
+ /* Get the center coordinates of the selected client */
|
||||
+ sel_center_x = sel->geom.x + sel->geom.width / 2;
|
||||
+ sel_center_y = sel->geom.y + sel->geom.height / 2;
|
||||
+
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (!VISIBLEON(c, selmon) || c->isfloating || c->isfullscreen || c == sel)
|
||||
+ continue;
|
||||
+
|
||||
+ /* Get the center of candidate client */
|
||||
+ cand_center_x = c->geom.x + c->geom.width / 2;
|
||||
+ cand_center_y = c->geom.y + c->geom.height / 2;
|
||||
+
|
||||
+ /* Check that the candidate lies in the requested direction. */
|
||||
+ switch (arg->ui) {
|
||||
+ case 0:
|
||||
+ if (cand_center_x >= sel_center_x)
|
||||
+ continue;
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ if (cand_center_x <= sel_center_x)
|
||||
+ continue;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ if (cand_center_y >= sel_center_y)
|
||||
+ continue;
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ if (cand_center_y <= sel_center_y)
|
||||
+ continue;
|
||||
+ break;
|
||||
+ default:
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* Get distance between the centers */
|
||||
+ dist = abs(sel_center_x - cand_center_x) + abs(sel_center_y - cand_center_y);
|
||||
+ if (dist < closest_dist) {
|
||||
+ closest_dist = dist;
|
||||
+ target = c;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* If target is found, swap the two clients’ positions in the layout tree */
|
||||
+ if (target) {
|
||||
+ sel_node = find_client_node(selmon->root, sel);
|
||||
+ target_node = find_client_node(selmon->root, target);
|
||||
+ if (sel_node && target_node) {
|
||||
+ tmp = sel_node->client;
|
||||
+ sel_node->client = target_node->client;
|
||||
+ target_node->client = tmp;
|
||||
+ arrange(selmon);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+unsigned int
|
||||
+visible_count(LayoutNode *node, Monitor *m)
|
||||
+{
|
||||
+ Client *c;
|
||||
+
|
||||
+ if (!node)
|
||||
+ return 0;
|
||||
+ /* Check if this client is visible. */
|
||||
+ if (node->is_client_node) {
|
||||
+ c = node->client;
|
||||
+ if (c && VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen)
|
||||
+ return 1;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ /* Else it’s a split node. */
|
||||
+ return visible_count(node->left, m) + visible_count(node->right, m);
|
||||
+}
|
||||
+
|
||||
+Client *
|
||||
+xytoclient(double x, double y) {
|
||||
+ Client *c, *closest = NULL;
|
||||
+ double dist, mindist = INT_MAX, dx, dy;
|
||||
+
|
||||
+ wl_list_for_each_reverse(c, &clients, link) {
|
||||
+ if (VISIBLEON(c, selmon) && !c->isfloating && !c->isfullscreen &&
|
||||
+ x >= c->geom.x && x <= (c->geom.x + c->geom.width) &&
|
||||
+ y >= c->geom.y && y <= (c->geom.y + c->geom.height)){
|
||||
+ return c;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* If no client was found at cursor position fallback to closest. */
|
||||
+ wl_list_for_each_reverse(c, &clients, link) {
|
||||
+ if (VISIBLEON(c, selmon) && !c->isfloating && !c->isfullscreen) {
|
||||
+ dx = 0, dy = 0;
|
||||
+
|
||||
+ if (x < c->geom.x)
|
||||
+ dx = c->geom.x - x;
|
||||
+ else if (x > (c->geom.x + c->geom.width))
|
||||
+ dx = x - (c->geom.x + c->geom.width);
|
||||
+
|
||||
+ if (y < c->geom.y)
|
||||
+ dy = c->geom.y - y;
|
||||
+ else if (y > (c->geom.y + c->geom.height))
|
||||
+ dy = y - (c->geom.y + c->geom.height);
|
||||
+
|
||||
+ dist = sqrt(dx * dx + dy * dy);
|
||||
+ if (dist < mindist) {
|
||||
+ mindist = dist;
|
||||
+ closest = c;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return closest;
|
||||
+}
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 22d2171..92f3ad6 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -13,7 +13,10 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
||||
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
||||
+static const float resize_factor = 0.0002f; /* Resize multiplier for mouse resizing, depends on mouse sensivity. */
|
||||
+static const uint32_t resize_interval_ms = 16; /* Resize interval depends on framerate and screen refresh rate. */
|
||||
|
||||
+enum Direction { DIR_LEFT, DIR_RIGHT, DIR_UP, DIR_DOWN };
|
||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||
#define TAGCOUNT (9)
|
||||
|
||||
@@ -31,6 +34,7 @@ static const Rule rules[] = {
|
||||
/* layout(s) */
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
+ { "|w|", btrtile },
|
||||
{ "[]=", tile },
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
@@ -148,6 +152,14 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Up, swapclients, {.i = DIR_UP} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Down, swapclients, {.i = DIR_DOWN} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, swapclients, {.i = DIR_RIGHT} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Left, swapclients, {.i = DIR_LEFT} },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Right, setratio_h, {.f = +0.025f} },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Left, setratio_h, {.f = -0.025f} },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Up, setratio_v, {.f = -0.025f} },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Down, setratio_v, {.f = +0.025f} },
|
||||
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
||||
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
||||
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index a2711f6..e49a061 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* See LICENSE file for copyright and license details.
|
||||
*/
|
||||
+#include <limits.h>
|
||||
#include <getopt.h>
|
||||
#include <libinput.h>
|
||||
#include <linux/input-event-codes.h>
|
||||
@@ -103,6 +104,7 @@ typedef struct {
|
||||
const Arg arg;
|
||||
} Button;
|
||||
|
||||
+typedef struct LayoutNode LayoutNode;
|
||||
typedef struct Monitor Monitor;
|
||||
typedef struct {
|
||||
/* Must keep these three elements in this order */
|
||||
@@ -139,8 +141,9 @@ typedef struct {
|
||||
#endif
|
||||
unsigned int bw;
|
||||
uint32_t tags;
|
||||
- int isfloating, isurgent, isfullscreen;
|
||||
+ int isfloating, isurgent, isfullscreen, was_tiled;
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
+ struct wlr_box old_geom;
|
||||
} Client;
|
||||
|
||||
typedef struct {
|
||||
@@ -208,6 +211,7 @@ struct Monitor {
|
||||
int nmaster;
|
||||
char ltsymbol[16];
|
||||
int asleep;
|
||||
+ LayoutNode *root;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -250,6 +254,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||
struct wlr_box *usable_area, int exclusive);
|
||||
static void arrangelayers(Monitor *m);
|
||||
static void axisnotify(struct wl_listener *listener, void *data);
|
||||
+static void btrtile(Monitor *m);
|
||||
static void buttonpress(struct wl_listener *listener, void *data);
|
||||
static void chvt(const Arg *arg);
|
||||
static void checkidleinhibitor(struct wlr_surface *exclude);
|
||||
@@ -333,6 +338,9 @@ static void setmon(Client *c, Monitor *m, uint32_t newtags);
|
||||
static void setpsel(struct wl_listener *listener, void *data);
|
||||
static void setsel(struct wl_listener *listener, void *data);
|
||||
static void setup(void);
|
||||
+static void setratio_h(const Arg *arg);
|
||||
+static void setratio_v(const Arg *arg);
|
||||
+static void swapclients(const Arg *arg);
|
||||
static void spawn(const Arg *arg);
|
||||
static void startdrag(struct wl_listener *listener, void *data);
|
||||
static void tag(const Arg *arg);
|
||||
@@ -431,6 +439,7 @@ static xcb_atom_t netatom[NetLast];
|
||||
|
||||
/* attempt to encapsulate suck into one file */
|
||||
#include "client.h"
|
||||
+#include "btrtile.c"
|
||||
|
||||
/* function implementations */
|
||||
void
|
||||
@@ -601,7 +610,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
struct wlr_pointer_button_event *event = data;
|
||||
struct wlr_keyboard *keyboard;
|
||||
uint32_t mods;
|
||||
- Client *c;
|
||||
+ Client *c, *target = NULL;
|
||||
const Button *b;
|
||||
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
@@ -622,7 +631,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0;
|
||||
for (b = buttons; b < END(buttons); b++) {
|
||||
if (CLEANMASK(mods) == CLEANMASK(b->mod) &&
|
||||
- event->button == b->button && b->func) {
|
||||
+ event->button == b->button && b->func) {
|
||||
b->func(&b->arg);
|
||||
return;
|
||||
}
|
||||
@@ -632,15 +641,36 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||
/* TODO should reset to the pointer focus's current setcursor */
|
||||
if (!locked && cursor_mode != CurNormal && cursor_mode != CurPressed) {
|
||||
+ c = grabc;
|
||||
+ if (c && c->was_tiled && !strcmp(selmon->ltsymbol, "|w|")) {
|
||||
+ if (cursor_mode == CurMove && c->isfloating) {
|
||||
+ target = xytoclient(cursor->x, cursor->y);
|
||||
+
|
||||
+ if (target && !target->isfloating && !target->isfullscreen)
|
||||
+ insert_client(selmon, target, c);
|
||||
+ else
|
||||
+ selmon->root = create_client_node(c);
|
||||
+
|
||||
+ setfloating(c, 0);
|
||||
+ arrange(selmon);
|
||||
+
|
||||
+ } else if (cursor_mode == CurResize && !c->isfloating) {
|
||||
+ resizing_from_mouse = 0;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (cursor_mode == CurResize && resizing_from_mouse)
|
||||
+ resizing_from_mouse = 0;
|
||||
+ }
|
||||
+ /* Default behaviour */
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||
cursor_mode = CurNormal;
|
||||
/* Drop the window off on its new monitor */
|
||||
selmon = xytomon(cursor->x, cursor->y);
|
||||
setmon(grabc, selmon, 0);
|
||||
+ grabc = NULL;
|
||||
return;
|
||||
- } else {
|
||||
- cursor_mode = CurNormal;
|
||||
}
|
||||
+ cursor_mode = CurNormal;
|
||||
break;
|
||||
}
|
||||
/* If the event wasn't handled by the compositor, notify the client with
|
||||
@@ -720,6 +750,7 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||
wlr_output_layout_remove(output_layout, m->wlr_output);
|
||||
wlr_scene_output_destroy(m->scene_output);
|
||||
|
||||
+ destroy_tree(m);
|
||||
closemon(m);
|
||||
wlr_scene_node_destroy(&m->fullscreen_bg->node);
|
||||
free(m);
|
||||
@@ -1024,6 +1055,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||
|
||||
wl_list_insert(&mons, &m->link);
|
||||
printstatus();
|
||||
+ init_tree(m);
|
||||
|
||||
/* The xdg-protocol specifies:
|
||||
*
|
||||
@@ -1263,6 +1295,10 @@ destroynotify(struct wl_listener *listener, void *data)
|
||||
wl_list_remove(&c->destroy.link);
|
||||
wl_list_remove(&c->set_title.link);
|
||||
wl_list_remove(&c->fullscreen.link);
|
||||
+ /* We check if the destroyed client was part of any tiled_list, to catch
|
||||
+ * client removals even if they would not be currently managed by btrtile */
|
||||
+ if (selmon && selmon->root)
|
||||
+ remove_client(selmon, c);
|
||||
#ifdef XWAYLAND
|
||||
if (c->type != XDGShell) {
|
||||
wl_list_remove(&c->activate.link);
|
||||
@@ -1809,7 +1845,8 @@ void
|
||||
motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double dy,
|
||||
double dx_unaccel, double dy_unaccel)
|
||||
{
|
||||
- double sx = 0, sy = 0, sx_confined, sy_confined;
|
||||
+ int tiled = 0;
|
||||
+ double sx = 0, sy = 0, sx_confined, sy_confined, dx_total, dy_total;
|
||||
Client *c = NULL, *w = NULL;
|
||||
LayerSurface *l = NULL;
|
||||
struct wlr_surface *surface = NULL;
|
||||
@@ -1863,18 +1900,56 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||
/* Update drag icon's position */
|
||||
wlr_scene_node_set_position(&drag_icon->node, (int)round(cursor->x), (int)round(cursor->y));
|
||||
|
||||
- /* If we are currently grabbing the mouse, handle and return */
|
||||
+ /* Skip if internal call or already resizing */
|
||||
+ if (time == 0 && resizing_from_mouse)
|
||||
+ goto focus;
|
||||
+
|
||||
+ tiled = grabc && !grabc->isfloating && !grabc->isfullscreen;
|
||||
if (cursor_mode == CurMove) {
|
||||
/* Move the grabbed client to the new position. */
|
||||
- resize(grabc, (struct wlr_box){.x = (int)round(cursor->x) - grabcx, .y = (int)round(cursor->y) - grabcy,
|
||||
- .width = grabc->geom.width, .height = grabc->geom.height}, 1);
|
||||
- return;
|
||||
+ if (grabc && grabc->isfloating) {
|
||||
+ resize(grabc, (struct wlr_box){
|
||||
+ .x = (int)round(cursor->x) - grabcx,
|
||||
+ .y = (int)round(cursor->y) - grabcy,
|
||||
+ .width = grabc->geom.width,
|
||||
+ .height = grabc->geom.height
|
||||
+ }, 1);
|
||||
+ return;
|
||||
+ }
|
||||
} else if (cursor_mode == CurResize) {
|
||||
- resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
|
||||
- .width = (int)round(cursor->x) - grabc->geom.x, .height = (int)round(cursor->y) - grabc->geom.y}, 1);
|
||||
- return;
|
||||
+ if (tiled && resizing_from_mouse) {
|
||||
+ dx_total = cursor->x - resize_last_update_x;
|
||||
+ dy_total = cursor->y - resize_last_update_y;
|
||||
+
|
||||
+ if (time - last_resize_time >= resize_interval_ms) {
|
||||
+ Arg a = {0};
|
||||
+ if (fabs(dx_total) > fabs(dy_total)) {
|
||||
+ a.f = (float)(dx_total * resize_factor);
|
||||
+ setratio_h(&a);
|
||||
+ } else {
|
||||
+ a.f = (float)(dy_total * resize_factor);
|
||||
+ setratio_v(&a);
|
||||
+ }
|
||||
+ arrange(selmon);
|
||||
+
|
||||
+ last_resize_time = time;
|
||||
+ resize_last_update_x = cursor->x;
|
||||
+ resize_last_update_y = cursor->y;
|
||||
+ }
|
||||
+
|
||||
+ } else if (grabc && grabc->isfloating) {
|
||||
+ /* Floating resize as original */
|
||||
+ resize(grabc, (struct wlr_box){
|
||||
+ .x = grabc->geom.x,
|
||||
+ .y = grabc->geom.y,
|
||||
+ .width = (int)round(cursor->x) - grabc->geom.x,
|
||||
+ .height = (int)round(cursor->y) - grabc->geom.y
|
||||
+ }, 1);
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
+focus:
|
||||
/* If there's no client surface under the cursor, set the cursor image to a
|
||||
* default. This is what makes the cursor image appear when you move it
|
||||
* off of a client or over its border. */
|
||||
@@ -1908,22 +1983,41 @@ moveresize(const Arg *arg)
|
||||
if (!grabc || client_is_unmanaged(grabc) || grabc->isfullscreen)
|
||||
return;
|
||||
|
||||
- /* Float the window and tell motionnotify to grab it */
|
||||
- setfloating(grabc, 1);
|
||||
- switch (cursor_mode = arg->ui) {
|
||||
- case CurMove:
|
||||
- grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||
- grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||
- break;
|
||||
- case CurResize:
|
||||
- /* Doesn't work for X11 output - the next absolute motion event
|
||||
- * returns the cursor to where it started */
|
||||
- wlr_cursor_warp_closest(cursor, NULL,
|
||||
- grabc->geom.x + grabc->geom.width,
|
||||
- grabc->geom.y + grabc->geom.height);
|
||||
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||
- break;
|
||||
+ cursor_mode = arg->ui;
|
||||
+ grabc->was_tiled = (!grabc->isfloating && !grabc->isfullscreen);
|
||||
+
|
||||
+ if (grabc->was_tiled) {
|
||||
+ switch (cursor_mode) {
|
||||
+ case CurMove:
|
||||
+ setfloating(grabc, 1);
|
||||
+ grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||
+ grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||
+ break;
|
||||
+ case CurResize:
|
||||
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||
+ resize_last_update_x = cursor->x;
|
||||
+ resize_last_update_y = cursor->y;
|
||||
+ resizing_from_mouse = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* Default floating logic */
|
||||
+ /* Float the window and tell motionnotify to grab it */
|
||||
+ setfloating(grabc, 1);
|
||||
+ switch (cursor_mode) {
|
||||
+ case CurMove:
|
||||
+ grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||
+ grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||
+ break;
|
||||
+ case CurResize:
|
||||
+ wlr_cursor_warp_closest(cursor, NULL,
|
||||
+ grabc->geom.x + grabc->geom.width,
|
||||
+ grabc->geom.y + grabc->geom.height);
|
||||
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.45.3
|
||||
|
||||
@@ -0,0 +1,903 @@
|
||||
From b9789420f166c20579f29ecd171a8956c681848d Mon Sep 17 00:00:00 2001
|
||||
From: julmajustus <julmajustus@tutanota.com>
|
||||
Date: Thu, 13 Feb 2025 23:23:40 +0200
|
||||
Subject: [PATCH] btrtile with multi-tag support
|
||||
|
||||
---
|
||||
btrtile.c | 563 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
config.def.h | 12 ++
|
||||
dwl.c | 152 +++++++++++---
|
||||
3 files changed, 698 insertions(+), 29 deletions(-)
|
||||
create mode 100644 btrtile.c
|
||||
|
||||
diff --git a/btrtile.c b/btrtile.c
|
||||
new file mode 100644
|
||||
index 0000000..03f4680
|
||||
--- /dev/null
|
||||
+++ b/btrtile.c
|
||||
@@ -0,0 +1,563 @@
|
||||
+/* ************************************************************************** */
|
||||
+/* */
|
||||
+/* ::: :::::::: */
|
||||
+/* btrtile.c :+: :+: :+: */
|
||||
+/* +:+ +:+ +:+ */
|
||||
+/* By: jmakkone <jmakkone@student.hive.fi> +#+ +:+ +#+ */
|
||||
+/* +#+#+#+#+#+ +#+ */
|
||||
+/* Created: 2024/12/15 00:26:07 by jmakkone #+# #+# */
|
||||
+/* Updated: 2025/02/13 23:22:33 by jmakkone ### ########.fr */
|
||||
+/* */
|
||||
+/* ************************************************************************** */
|
||||
+
|
||||
+typedef struct LayoutNode {
|
||||
+ unsigned int is_client_node;
|
||||
+ unsigned int is_split_vertically;
|
||||
+ float split_ratio;
|
||||
+ struct LayoutNode *left;
|
||||
+ struct LayoutNode *right;
|
||||
+ struct LayoutNode *split_node;
|
||||
+ Client *client;
|
||||
+} LayoutNode;
|
||||
+
|
||||
+static void apply_layout(Monitor *m, LayoutNode *node,
|
||||
+ struct wlr_box area, unsigned int is_root);
|
||||
+static void btrtile(Monitor *m);
|
||||
+static LayoutNode *create_client_node(Client *c);
|
||||
+static LayoutNode *create_split_node(unsigned int is_split_vertically,
|
||||
+ LayoutNode *left, LayoutNode *right);
|
||||
+static void destroy_node(LayoutNode *node);
|
||||
+static void destroy_tree(Monitor *m);
|
||||
+static LayoutNode *find_client_node(LayoutNode *node, Client *c);
|
||||
+static LayoutNode *find_suitable_split(LayoutNode *start, unsigned int need_vert);
|
||||
+static void init_tree(Monitor *m);
|
||||
+static void insert_client(Monitor *m, Client *focused_client, Client *new_client);
|
||||
+static LayoutNode *remove_client_node(LayoutNode *node, Client *c);
|
||||
+static void remove_client(Monitor *m, Client *c);
|
||||
+static void setratio_h(const Arg *arg);
|
||||
+static void setratio_v(const Arg *arg);
|
||||
+static void swapclients(const Arg *arg);
|
||||
+static unsigned int visible_count(LayoutNode *node, Monitor *m);
|
||||
+static Client *xytoclient(double x, double y);
|
||||
+
|
||||
+static int resizing_from_mouse = 0;
|
||||
+static double resize_last_update_x, resize_last_update_y;
|
||||
+static uint32_t last_resize_time = 0;
|
||||
+
|
||||
+void
|
||||
+apply_layout(Monitor *m, LayoutNode *node,
|
||||
+ struct wlr_box area, unsigned int is_root)
|
||||
+{
|
||||
+ Client *c;
|
||||
+ float ratio;
|
||||
+ unsigned int left_count, right_count, mid;
|
||||
+ struct wlr_box left_area, right_area;
|
||||
+
|
||||
+ if (!node)
|
||||
+ return;
|
||||
+
|
||||
+ /* If this node is a client node, check if it is visible. */
|
||||
+ if (node->is_client_node) {
|
||||
+ c = node->client;
|
||||
+ if (!c || !VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
+ return;
|
||||
+ resize(c, area, 0);
|
||||
+ c->old_geom = area;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* For a split node, we see how many visible children are on each side: */
|
||||
+ left_count = visible_count(node->left, m);
|
||||
+ right_count = visible_count(node->right, m);
|
||||
+
|
||||
+ if (left_count == 0 && right_count == 0) {
|
||||
+ return;
|
||||
+ } else if (left_count > 0 && right_count == 0) {
|
||||
+ apply_layout(m, node->left, area, 0);
|
||||
+ return;
|
||||
+ } else if (left_count == 0 && right_count > 0) {
|
||||
+ apply_layout(m, node->right, area, 0);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* If we’re here, we have visible clients in both subtrees. */
|
||||
+ ratio = node->split_ratio;
|
||||
+ if (ratio < 0.05f)
|
||||
+ ratio = 0.05f;
|
||||
+ if (ratio > 0.95f)
|
||||
+ ratio = 0.95f;
|
||||
+
|
||||
+ memset(&left_area, 0, sizeof(left_area));
|
||||
+ memset(&right_area, 0, sizeof(right_area));
|
||||
+
|
||||
+ if (node->is_split_vertically) {
|
||||
+ mid = (unsigned int)(area.width * ratio);
|
||||
+ left_area.x = area.x;
|
||||
+ left_area.y = area.y;
|
||||
+ left_area.width = mid;
|
||||
+ left_area.height = area.height;
|
||||
+
|
||||
+ right_area.x = area.x + mid;
|
||||
+ right_area.y = area.y;
|
||||
+ right_area.width = area.width - mid;
|
||||
+ right_area.height = area.height;
|
||||
+ } else {
|
||||
+ /* horizontal split */
|
||||
+ mid = (unsigned int)(area.height * ratio);
|
||||
+ left_area.x = area.x;
|
||||
+ left_area.y = area.y;
|
||||
+ left_area.width = area.width;
|
||||
+ left_area.height = mid;
|
||||
+
|
||||
+ right_area.x = area.x;
|
||||
+ right_area.y = area.y + mid;
|
||||
+ right_area.width = area.width;
|
||||
+ right_area.height= area.height - mid;
|
||||
+ }
|
||||
+
|
||||
+ apply_layout(m, node->left, left_area, 0);
|
||||
+ apply_layout(m, node->right, right_area, 0);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+btrtile(Monitor *m)
|
||||
+{
|
||||
+ Client *c, *focused = NULL;
|
||||
+ int n = 0;
|
||||
+ LayoutNode *found;
|
||||
+ struct wlr_box full_area;
|
||||
+
|
||||
+ if (!m || !m->root)
|
||||
+ return;
|
||||
+
|
||||
+ /* Remove non tiled clients from tree. */
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (c->mon == m && !c->isfloating && !c->isfullscreen) {
|
||||
+ } else {
|
||||
+ remove_client(m, c);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* If no client is found under cursor, fallback to focustop(m) */
|
||||
+ if (!(focused = xytoclient(cursor->x, cursor->y)))
|
||||
+ focused = focustop(m);
|
||||
+
|
||||
+ /* Insert visible clients that are not part of the tree. */
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen && c->mon == m) {
|
||||
+ found = find_client_node(m->root, c);
|
||||
+ if (!found) {
|
||||
+ insert_client(m, focused, c);
|
||||
+ }
|
||||
+ n++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (n == 0)
|
||||
+ return;
|
||||
+
|
||||
+ full_area = m->w;
|
||||
+ apply_layout(m, m->root, full_area, 1);
|
||||
+}
|
||||
+
|
||||
+LayoutNode *
|
||||
+create_client_node(Client *c)
|
||||
+{
|
||||
+ LayoutNode *node = calloc(1, sizeof(LayoutNode));
|
||||
+
|
||||
+ if (!node)
|
||||
+ return NULL;
|
||||
+ node->is_client_node = 1;
|
||||
+ node->split_ratio = 0.5f;
|
||||
+ node->client = c;
|
||||
+ return node;
|
||||
+}
|
||||
+
|
||||
+LayoutNode *
|
||||
+create_split_node(unsigned int is_split_vertically,
|
||||
+ LayoutNode *left, LayoutNode *right)
|
||||
+{
|
||||
+ LayoutNode *node = calloc(1, sizeof(LayoutNode));
|
||||
+
|
||||
+ if (!node)
|
||||
+ return NULL;
|
||||
+ node->is_client_node = 0;
|
||||
+ node->split_ratio = 0.5f;
|
||||
+ node->is_split_vertically = is_split_vertically;
|
||||
+ node->left = left;
|
||||
+ node->right = right;
|
||||
+ if (left)
|
||||
+ left->split_node = node;
|
||||
+ if (right)
|
||||
+ right->split_node = node;
|
||||
+ return node;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+destroy_node(LayoutNode *node)
|
||||
+{
|
||||
+ if (!node)
|
||||
+ return;
|
||||
+ if (!node->is_client_node) {
|
||||
+ destroy_node(node->left);
|
||||
+ destroy_node(node->right);
|
||||
+ }
|
||||
+ free(node);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+destroy_tree(Monitor *m)
|
||||
+{
|
||||
+ if (!m || !m->root)
|
||||
+ return;
|
||||
+ destroy_node(m->root);
|
||||
+ m->root = NULL;
|
||||
+}
|
||||
+
|
||||
+LayoutNode *
|
||||
+find_client_node(LayoutNode *node, Client *c)
|
||||
+{
|
||||
+ LayoutNode *res;
|
||||
+
|
||||
+ if (!node || !c)
|
||||
+ return NULL;
|
||||
+ if (node->is_client_node) {
|
||||
+ return (node->client == c) ? node : NULL;
|
||||
+ }
|
||||
+ res = find_client_node(node->left, c);
|
||||
+ return res ? res : find_client_node(node->right, c);
|
||||
+}
|
||||
+
|
||||
+LayoutNode *
|
||||
+find_suitable_split(LayoutNode *start_node, unsigned int need_vertical)
|
||||
+{
|
||||
+ LayoutNode *n = start_node;
|
||||
+ /* if we started from a client node, jump to its parent: */
|
||||
+ if (n && n->is_client_node)
|
||||
+ n = n->split_node;
|
||||
+
|
||||
+ while (n) {
|
||||
+ if (!n->is_client_node && n->is_split_vertically == need_vertical &&
|
||||
+ visible_count(n->left, selmon) > 0 && visible_count(n->right, selmon) > 0)
|
||||
+ return n;
|
||||
+ n = n->split_node;
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+init_tree(Monitor *m)
|
||||
+{
|
||||
+ if (!m)
|
||||
+ return;
|
||||
+ m->root = calloc(1, sizeof(LayoutNode));
|
||||
+ if (!m->root)
|
||||
+ m->root = NULL;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+insert_client(Monitor *m, Client *focused_client, Client *new_client)
|
||||
+{
|
||||
+ Client *old_client;
|
||||
+ LayoutNode **root = &m->root, *old_root,
|
||||
+ *focused_node, *new_client_node, *old_client_node;
|
||||
+ unsigned int wider, mid_x, mid_y;
|
||||
+
|
||||
+ /* If no root , new client becomes the root. */
|
||||
+ if (!*root) {
|
||||
+ *root = create_client_node(new_client);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Find the focused_client node,
|
||||
+ * if not found split the root. */
|
||||
+ focused_node = focused_client ?
|
||||
+ find_client_node(*root, focused_client) : NULL;
|
||||
+ if (!focused_node) {
|
||||
+ old_root = *root;
|
||||
+ new_client_node = create_client_node(new_client);
|
||||
+ *root = create_split_node(1, old_root, new_client_node);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Turn focused node from a client node into a split node,
|
||||
+ * and attach old_client + new_client. */
|
||||
+ old_client = focused_node->client;
|
||||
+ old_client_node = create_client_node(old_client);
|
||||
+ new_client_node = create_client_node(new_client);
|
||||
+
|
||||
+ /* Decide split direction. */
|
||||
+ wider = (focused_client->geom.width >= focused_client->geom.height);
|
||||
+ focused_node->is_client_node = 0;
|
||||
+ focused_node->client = NULL;
|
||||
+ focused_node->is_split_vertically = (wider ? 1 : 0);
|
||||
+
|
||||
+ /* Pick new_client side depending on the cursor position. */
|
||||
+ mid_x = focused_client->geom.x + focused_client->geom.width / 2;
|
||||
+ mid_y = focused_client->geom.y + focused_client->geom.height / 2;
|
||||
+
|
||||
+ if (wider) {
|
||||
+ /* vertical split => left vs right */
|
||||
+ if (cursor->x <= mid_x) {
|
||||
+ focused_node->left = new_client_node;
|
||||
+ focused_node->right = old_client_node;
|
||||
+ } else {
|
||||
+ focused_node->left = old_client_node;
|
||||
+ focused_node->right = new_client_node;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* horizontal split => top vs bottom */
|
||||
+ if (cursor->y <= mid_y) {
|
||||
+ focused_node->left = new_client_node;
|
||||
+ focused_node->right = old_client_node;
|
||||
+ } else {
|
||||
+ focused_node->left = old_client_node;
|
||||
+ focused_node->right = new_client_node;
|
||||
+ }
|
||||
+ }
|
||||
+ old_client_node->split_node = focused_node;
|
||||
+ new_client_node->split_node = focused_node;
|
||||
+ focused_node->split_ratio = 0.5f;
|
||||
+}
|
||||
+
|
||||
+LayoutNode *
|
||||
+remove_client_node(LayoutNode *node, Client *c)
|
||||
+{
|
||||
+ LayoutNode *tmp;
|
||||
+ if (!node)
|
||||
+ return NULL;
|
||||
+ if (node->is_client_node) {
|
||||
+ /* If this client_node is the client we're removing,
|
||||
+ * return NULL to remove it */
|
||||
+ if (node->client == c) {
|
||||
+ free(node);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ return node;
|
||||
+ }
|
||||
+
|
||||
+ node->left = remove_client_node(node->left, c);
|
||||
+ node->right = remove_client_node(node->right, c);
|
||||
+
|
||||
+ /* If one of the client node is NULL after removal and the other is not,
|
||||
+ * we "lift" the other client node up to replace this split node. */
|
||||
+ if (!node->left && node->right) {
|
||||
+ tmp = node->right;
|
||||
+
|
||||
+ /* Save pointer to split node */
|
||||
+ if (tmp)
|
||||
+ tmp->split_node = node->split_node;
|
||||
+
|
||||
+ free(node);
|
||||
+ return tmp;
|
||||
+ }
|
||||
+
|
||||
+ if (!node->right && node->left) {
|
||||
+ tmp = node->left;
|
||||
+
|
||||
+ /* Save pointer to split node */
|
||||
+ if (tmp)
|
||||
+ tmp->split_node = node->split_node;
|
||||
+
|
||||
+ free(node);
|
||||
+ return tmp;
|
||||
+ }
|
||||
+
|
||||
+ /* If both children exist or both are NULL (empty tree),
|
||||
+ * return node as is. */
|
||||
+ return node;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+remove_client(Monitor *m, Client *c)
|
||||
+{
|
||||
+ if (!m->root || !c)
|
||||
+ return;
|
||||
+ m->root = remove_client_node(m->root, c);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+setratio_h(const Arg *arg)
|
||||
+{
|
||||
+ Client *sel = focustop(selmon);
|
||||
+ LayoutNode *client_node, *split_node;
|
||||
+ float new_ratio;
|
||||
+
|
||||
+ if (!sel || !selmon || !selmon->lt[selmon->sellt]->arrange)
|
||||
+ return;
|
||||
+
|
||||
+ client_node = find_client_node(selmon->root, sel);
|
||||
+ if (!client_node)
|
||||
+ return;
|
||||
+
|
||||
+ split_node = find_suitable_split(client_node, 1);
|
||||
+ if (!split_node)
|
||||
+ return;
|
||||
+
|
||||
+ new_ratio = (arg->f != 0.0f) ? (split_node->split_ratio + arg->f) : 0.5f;
|
||||
+ if (new_ratio < 0.05f)
|
||||
+ new_ratio = 0.05f;
|
||||
+ if (new_ratio > 0.95f)
|
||||
+ new_ratio = 0.95f;
|
||||
+ split_node->split_ratio = new_ratio;
|
||||
+
|
||||
+ /* Skip the arrange if done resizing by mouse,
|
||||
+ * we call arrange from motionotify */
|
||||
+ if (!resizing_from_mouse) {
|
||||
+ arrange(selmon);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+setratio_v(const Arg *arg)
|
||||
+{
|
||||
+ Client *sel = focustop(selmon);
|
||||
+ LayoutNode *client_node, *split_node;
|
||||
+ float new_ratio;
|
||||
+
|
||||
+ if (!sel || !selmon || !selmon->lt[selmon->sellt]->arrange)
|
||||
+ return;
|
||||
+
|
||||
+ client_node = find_client_node(selmon->root, sel);
|
||||
+ if (!client_node)
|
||||
+ return;
|
||||
+
|
||||
+ split_node = find_suitable_split(client_node, 0);
|
||||
+ if (!split_node)
|
||||
+ return;
|
||||
+
|
||||
+ new_ratio = (arg->f != 0.0f) ? (split_node->split_ratio + arg->f) : 0.5f;
|
||||
+ if (new_ratio < 0.05f)
|
||||
+ new_ratio = 0.05f;
|
||||
+ if (new_ratio > 0.95f)
|
||||
+ new_ratio = 0.95f;
|
||||
+ split_node->split_ratio = new_ratio;
|
||||
+
|
||||
+ /* Skip the arrange if done resizing by mouse,
|
||||
+ * we call arrange from motionotify */
|
||||
+ if (!resizing_from_mouse) {
|
||||
+ arrange(selmon);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void swapclients(const Arg *arg) {
|
||||
+ Client *c, *tmp, *target = NULL, *sel = focustop(selmon);
|
||||
+ LayoutNode *sel_node, *target_node;
|
||||
+ int closest_dist = INT_MAX, dist, sel_center_x, sel_center_y,
|
||||
+ cand_center_x, cand_center_y;
|
||||
+
|
||||
+ if (!sel || sel->isfullscreen ||
|
||||
+ !selmon->root || !selmon->lt[selmon->sellt]->arrange)
|
||||
+ return;
|
||||
+
|
||||
+
|
||||
+ /* Get the center coordinates of the selected client */
|
||||
+ sel_center_x = sel->geom.x + sel->geom.width / 2;
|
||||
+ sel_center_y = sel->geom.y + sel->geom.height / 2;
|
||||
+
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (!VISIBLEON(c, selmon) || c->isfloating || c->isfullscreen || c == sel)
|
||||
+ continue;
|
||||
+
|
||||
+ /* Get the center of candidate client */
|
||||
+ cand_center_x = c->geom.x + c->geom.width / 2;
|
||||
+ cand_center_y = c->geom.y + c->geom.height / 2;
|
||||
+
|
||||
+ /* Check that the candidate lies in the requested direction. */
|
||||
+ switch (arg->ui) {
|
||||
+ case 0:
|
||||
+ if (cand_center_x >= sel_center_x)
|
||||
+ continue;
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ if (cand_center_x <= sel_center_x)
|
||||
+ continue;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ if (cand_center_y >= sel_center_y)
|
||||
+ continue;
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ if (cand_center_y <= sel_center_y)
|
||||
+ continue;
|
||||
+ break;
|
||||
+ default:
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* Get distance between the centers */
|
||||
+ dist = abs(sel_center_x - cand_center_x) + abs(sel_center_y - cand_center_y);
|
||||
+ if (dist < closest_dist) {
|
||||
+ closest_dist = dist;
|
||||
+ target = c;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* If target is found, swap the two clients’ positions in the layout tree */
|
||||
+ if (target) {
|
||||
+ sel_node = find_client_node(selmon->root, sel);
|
||||
+ target_node = find_client_node(selmon->root, target);
|
||||
+ if (sel_node && target_node) {
|
||||
+ tmp = sel_node->client;
|
||||
+ sel_node->client = target_node->client;
|
||||
+ target_node->client = tmp;
|
||||
+ arrange(selmon);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+unsigned int
|
||||
+visible_count(LayoutNode *node, Monitor *m)
|
||||
+{
|
||||
+ Client *c;
|
||||
+
|
||||
+ if (!node)
|
||||
+ return 0;
|
||||
+ /* Check if this client is visible. */
|
||||
+ if (node->is_client_node) {
|
||||
+ c = node->client;
|
||||
+ if (c && VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen)
|
||||
+ return 1;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ /* Else it’s a split node. */
|
||||
+ return visible_count(node->left, m) + visible_count(node->right, m);
|
||||
+}
|
||||
+
|
||||
+Client *
|
||||
+xytoclient(double x, double y) {
|
||||
+ Client *c, *closest = NULL;
|
||||
+ double dist, mindist = INT_MAX, dx, dy;
|
||||
+
|
||||
+ wl_list_for_each_reverse(c, &clients, link) {
|
||||
+ if (VISIBLEON(c, selmon) && !c->isfloating && !c->isfullscreen &&
|
||||
+ x >= c->geom.x && x <= (c->geom.x + c->geom.width) &&
|
||||
+ y >= c->geom.y && y <= (c->geom.y + c->geom.height)){
|
||||
+ return c;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* If no client was found at cursor position fallback to closest. */
|
||||
+ wl_list_for_each_reverse(c, &clients, link) {
|
||||
+ if (VISIBLEON(c, selmon) && !c->isfloating && !c->isfullscreen) {
|
||||
+ dx = 0, dy = 0;
|
||||
+
|
||||
+ if (x < c->geom.x)
|
||||
+ dx = c->geom.x - x;
|
||||
+ else if (x > (c->geom.x + c->geom.width))
|
||||
+ dx = x - (c->geom.x + c->geom.width);
|
||||
+
|
||||
+ if (y < c->geom.y)
|
||||
+ dy = c->geom.y - y;
|
||||
+ else if (y > (c->geom.y + c->geom.height))
|
||||
+ dy = y - (c->geom.y + c->geom.height);
|
||||
+
|
||||
+ dist = sqrt(dx * dx + dy * dy);
|
||||
+ if (dist < mindist) {
|
||||
+ mindist = dist;
|
||||
+ closest = c;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return closest;
|
||||
+}
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 22d2171..92f3ad6 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -13,7 +13,10 @@ static const float focuscolor[] = COLOR(0x005577ff);
|
||||
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
||||
+static const float resize_factor = 0.0002f; /* Resize multiplier for mouse resizing, depends on mouse sensivity. */
|
||||
+static const uint32_t resize_interval_ms = 16; /* Resize interval depends on framerate and screen refresh rate. */
|
||||
|
||||
+enum Direction { DIR_LEFT, DIR_RIGHT, DIR_UP, DIR_DOWN };
|
||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||
#define TAGCOUNT (9)
|
||||
|
||||
@@ -31,6 +34,7 @@ static const Rule rules[] = {
|
||||
/* layout(s) */
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
+ { "|w|", btrtile },
|
||||
{ "[]=", tile },
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
@@ -148,6 +152,14 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Up, swapclients, {.i = DIR_UP} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Down, swapclients, {.i = DIR_DOWN} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, swapclients, {.i = DIR_RIGHT} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Left, swapclients, {.i = DIR_LEFT} },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Right, setratio_h, {.f = +0.025f} },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Left, setratio_h, {.f = -0.025f} },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Up, setratio_v, {.f = -0.025f} },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Down, setratio_v, {.f = +0.025f} },
|
||||
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
||||
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
||||
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index a2711f6..e49a061 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* See LICENSE file for copyright and license details.
|
||||
*/
|
||||
+#include <limits.h>
|
||||
#include <getopt.h>
|
||||
#include <libinput.h>
|
||||
#include <linux/input-event-codes.h>
|
||||
@@ -103,6 +104,7 @@ typedef struct {
|
||||
const Arg arg;
|
||||
} Button;
|
||||
|
||||
+typedef struct LayoutNode LayoutNode;
|
||||
typedef struct Monitor Monitor;
|
||||
typedef struct {
|
||||
/* Must keep these three elements in this order */
|
||||
@@ -139,8 +141,9 @@ typedef struct {
|
||||
#endif
|
||||
unsigned int bw;
|
||||
uint32_t tags;
|
||||
- int isfloating, isurgent, isfullscreen;
|
||||
+ int isfloating, isurgent, isfullscreen, was_tiled;
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
+ struct wlr_box old_geom;
|
||||
} Client;
|
||||
|
||||
typedef struct {
|
||||
@@ -208,6 +211,7 @@ struct Monitor {
|
||||
int nmaster;
|
||||
char ltsymbol[16];
|
||||
int asleep;
|
||||
+ LayoutNode *root;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -250,6 +254,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||
struct wlr_box *usable_area, int exclusive);
|
||||
static void arrangelayers(Monitor *m);
|
||||
static void axisnotify(struct wl_listener *listener, void *data);
|
||||
+static void btrtile(Monitor *m);
|
||||
static void buttonpress(struct wl_listener *listener, void *data);
|
||||
static void chvt(const Arg *arg);
|
||||
static void checkidleinhibitor(struct wlr_surface *exclude);
|
||||
@@ -333,6 +338,9 @@ static void setmon(Client *c, Monitor *m, uint32_t newtags);
|
||||
static void setpsel(struct wl_listener *listener, void *data);
|
||||
static void setsel(struct wl_listener *listener, void *data);
|
||||
static void setup(void);
|
||||
+static void setratio_h(const Arg *arg);
|
||||
+static void setratio_v(const Arg *arg);
|
||||
+static void swapclients(const Arg *arg);
|
||||
static void spawn(const Arg *arg);
|
||||
static void startdrag(struct wl_listener *listener, void *data);
|
||||
static void tag(const Arg *arg);
|
||||
@@ -431,6 +439,7 @@ static xcb_atom_t netatom[NetLast];
|
||||
|
||||
/* attempt to encapsulate suck into one file */
|
||||
#include "client.h"
|
||||
+#include "btrtile.c"
|
||||
|
||||
/* function implementations */
|
||||
void
|
||||
@@ -601,7 +610,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
struct wlr_pointer_button_event *event = data;
|
||||
struct wlr_keyboard *keyboard;
|
||||
uint32_t mods;
|
||||
- Client *c;
|
||||
+ Client *c, *target = NULL;
|
||||
const Button *b;
|
||||
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
@@ -622,7 +631,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0;
|
||||
for (b = buttons; b < END(buttons); b++) {
|
||||
if (CLEANMASK(mods) == CLEANMASK(b->mod) &&
|
||||
- event->button == b->button && b->func) {
|
||||
+ event->button == b->button && b->func) {
|
||||
b->func(&b->arg);
|
||||
return;
|
||||
}
|
||||
@@ -632,15 +641,36 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||
/* TODO should reset to the pointer focus's current setcursor */
|
||||
if (!locked && cursor_mode != CurNormal && cursor_mode != CurPressed) {
|
||||
+ c = grabc;
|
||||
+ if (c && c->was_tiled && !strcmp(selmon->ltsymbol, "|w|")) {
|
||||
+ if (cursor_mode == CurMove && c->isfloating) {
|
||||
+ target = xytoclient(cursor->x, cursor->y);
|
||||
+
|
||||
+ if (target && !target->isfloating && !target->isfullscreen)
|
||||
+ insert_client(selmon, target, c);
|
||||
+ else
|
||||
+ selmon->root = create_client_node(c);
|
||||
+
|
||||
+ setfloating(c, 0);
|
||||
+ arrange(selmon);
|
||||
+
|
||||
+ } else if (cursor_mode == CurResize && !c->isfloating) {
|
||||
+ resizing_from_mouse = 0;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (cursor_mode == CurResize && resizing_from_mouse)
|
||||
+ resizing_from_mouse = 0;
|
||||
+ }
|
||||
+ /* Default behaviour */
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||
cursor_mode = CurNormal;
|
||||
/* Drop the window off on its new monitor */
|
||||
selmon = xytomon(cursor->x, cursor->y);
|
||||
setmon(grabc, selmon, 0);
|
||||
+ grabc = NULL;
|
||||
return;
|
||||
- } else {
|
||||
- cursor_mode = CurNormal;
|
||||
}
|
||||
+ cursor_mode = CurNormal;
|
||||
break;
|
||||
}
|
||||
/* If the event wasn't handled by the compositor, notify the client with
|
||||
@@ -720,6 +750,7 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||
wlr_output_layout_remove(output_layout, m->wlr_output);
|
||||
wlr_scene_output_destroy(m->scene_output);
|
||||
|
||||
+ destroy_tree(m);
|
||||
closemon(m);
|
||||
wlr_scene_node_destroy(&m->fullscreen_bg->node);
|
||||
free(m);
|
||||
@@ -1024,6 +1055,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||
|
||||
wl_list_insert(&mons, &m->link);
|
||||
printstatus();
|
||||
+ init_tree(m);
|
||||
|
||||
/* The xdg-protocol specifies:
|
||||
*
|
||||
@@ -1263,6 +1295,10 @@ destroynotify(struct wl_listener *listener, void *data)
|
||||
wl_list_remove(&c->destroy.link);
|
||||
wl_list_remove(&c->set_title.link);
|
||||
wl_list_remove(&c->fullscreen.link);
|
||||
+ /* We check if the destroyed client was part of any tiled_list, to catch
|
||||
+ * client removals even if they would not be currently managed by btrtile */
|
||||
+ if (selmon && selmon->root)
|
||||
+ remove_client(selmon, c);
|
||||
#ifdef XWAYLAND
|
||||
if (c->type != XDGShell) {
|
||||
wl_list_remove(&c->activate.link);
|
||||
@@ -1809,7 +1845,8 @@ void
|
||||
motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double dy,
|
||||
double dx_unaccel, double dy_unaccel)
|
||||
{
|
||||
- double sx = 0, sy = 0, sx_confined, sy_confined;
|
||||
+ int tiled = 0;
|
||||
+ double sx = 0, sy = 0, sx_confined, sy_confined, dx_total, dy_total;
|
||||
Client *c = NULL, *w = NULL;
|
||||
LayerSurface *l = NULL;
|
||||
struct wlr_surface *surface = NULL;
|
||||
@@ -1863,18 +1900,56 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||
/* Update drag icon's position */
|
||||
wlr_scene_node_set_position(&drag_icon->node, (int)round(cursor->x), (int)round(cursor->y));
|
||||
|
||||
- /* If we are currently grabbing the mouse, handle and return */
|
||||
+ /* Skip if internal call or already resizing */
|
||||
+ if (time == 0 && resizing_from_mouse)
|
||||
+ goto focus;
|
||||
+
|
||||
+ tiled = grabc && !grabc->isfloating && !grabc->isfullscreen;
|
||||
if (cursor_mode == CurMove) {
|
||||
/* Move the grabbed client to the new position. */
|
||||
- resize(grabc, (struct wlr_box){.x = (int)round(cursor->x) - grabcx, .y = (int)round(cursor->y) - grabcy,
|
||||
- .width = grabc->geom.width, .height = grabc->geom.height}, 1);
|
||||
- return;
|
||||
+ if (grabc && grabc->isfloating) {
|
||||
+ resize(grabc, (struct wlr_box){
|
||||
+ .x = (int)round(cursor->x) - grabcx,
|
||||
+ .y = (int)round(cursor->y) - grabcy,
|
||||
+ .width = grabc->geom.width,
|
||||
+ .height = grabc->geom.height
|
||||
+ }, 1);
|
||||
+ return;
|
||||
+ }
|
||||
} else if (cursor_mode == CurResize) {
|
||||
- resize(grabc, (struct wlr_box){.x = grabc->geom.x, .y = grabc->geom.y,
|
||||
- .width = (int)round(cursor->x) - grabc->geom.x, .height = (int)round(cursor->y) - grabc->geom.y}, 1);
|
||||
- return;
|
||||
+ if (tiled && resizing_from_mouse) {
|
||||
+ dx_total = cursor->x - resize_last_update_x;
|
||||
+ dy_total = cursor->y - resize_last_update_y;
|
||||
+
|
||||
+ if (time - last_resize_time >= resize_interval_ms) {
|
||||
+ Arg a = {0};
|
||||
+ if (fabs(dx_total) > fabs(dy_total)) {
|
||||
+ a.f = (float)(dx_total * resize_factor);
|
||||
+ setratio_h(&a);
|
||||
+ } else {
|
||||
+ a.f = (float)(dy_total * resize_factor);
|
||||
+ setratio_v(&a);
|
||||
+ }
|
||||
+ arrange(selmon);
|
||||
+
|
||||
+ last_resize_time = time;
|
||||
+ resize_last_update_x = cursor->x;
|
||||
+ resize_last_update_y = cursor->y;
|
||||
+ }
|
||||
+
|
||||
+ } else if (grabc && grabc->isfloating) {
|
||||
+ /* Floating resize as original */
|
||||
+ resize(grabc, (struct wlr_box){
|
||||
+ .x = grabc->geom.x,
|
||||
+ .y = grabc->geom.y,
|
||||
+ .width = (int)round(cursor->x) - grabc->geom.x,
|
||||
+ .height = (int)round(cursor->y) - grabc->geom.y
|
||||
+ }, 1);
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
+focus:
|
||||
/* If there's no client surface under the cursor, set the cursor image to a
|
||||
* default. This is what makes the cursor image appear when you move it
|
||||
* off of a client or over its border. */
|
||||
@@ -1908,22 +1983,41 @@ moveresize(const Arg *arg)
|
||||
if (!grabc || client_is_unmanaged(grabc) || grabc->isfullscreen)
|
||||
return;
|
||||
|
||||
- /* Float the window and tell motionnotify to grab it */
|
||||
- setfloating(grabc, 1);
|
||||
- switch (cursor_mode = arg->ui) {
|
||||
- case CurMove:
|
||||
- grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||
- grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||
- break;
|
||||
- case CurResize:
|
||||
- /* Doesn't work for X11 output - the next absolute motion event
|
||||
- * returns the cursor to where it started */
|
||||
- wlr_cursor_warp_closest(cursor, NULL,
|
||||
- grabc->geom.x + grabc->geom.width,
|
||||
- grabc->geom.y + grabc->geom.height);
|
||||
- wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||
- break;
|
||||
+ cursor_mode = arg->ui;
|
||||
+ grabc->was_tiled = (!grabc->isfloating && !grabc->isfullscreen);
|
||||
+
|
||||
+ if (grabc->was_tiled) {
|
||||
+ switch (cursor_mode) {
|
||||
+ case CurMove:
|
||||
+ setfloating(grabc, 1);
|
||||
+ grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||
+ grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||
+ break;
|
||||
+ case CurResize:
|
||||
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||
+ resize_last_update_x = cursor->x;
|
||||
+ resize_last_update_y = cursor->y;
|
||||
+ resizing_from_mouse = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* Default floating logic */
|
||||
+ /* Float the window and tell motionnotify to grab it */
|
||||
+ setfloating(grabc, 1);
|
||||
+ switch (cursor_mode) {
|
||||
+ case CurMove:
|
||||
+ grabcx = (int)round(cursor->x) - grabc->geom.x;
|
||||
+ grabcy = (int)round(cursor->y) - grabc->geom.y;
|
||||
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "fleur");
|
||||
+ break;
|
||||
+ case CurResize:
|
||||
+ wlr_cursor_warp_closest(cursor, NULL,
|
||||
+ grabc->geom.x + grabc->geom.width,
|
||||
+ grabc->geom.y + grabc->geom.height);
|
||||
+ wlr_cursor_set_xcursor(cursor, cursor_mgr, "se-resize");
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.45.3
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
### Description
|
||||
Adds "state" (`enum wlr_button_state`) to configure a button action on either press or release.
|
||||
This basically enables release to be used for button actions.
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/nullsystem/dwl/src/branch/main_buttonbystate)
|
||||
- [2024-04-06](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/buttonbystate/buttonbystate.patch)
|
||||
|
||||
### Authors
|
||||
- [nullsystem](https://codeberg.org/nullsystem)
|
||||
@@ -0,0 +1,13 @@
|
||||
### Description
|
||||
Add a keybinding that toggles centering the terminally horizontally when
|
||||
it's the only window, while still tiling multiple windows.
|
||||
|
||||
This limits the width of long text making it easier to read, and avoids
|
||||
covering the wallpaper more than necessary.
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/guidocella/dwl/src/branch/center-terminal)
|
||||
- [2024-02-06](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/center-terminal/center-terminal.patch)
|
||||
|
||||
### Authors
|
||||
- [Guido Cella](https://codeberg.org/guidocella)
|
||||
+19
-18
@@ -1,4 +1,4 @@
|
||||
From 5646d7e7d933a2e7a667767c3fde89c91697c4ea Mon Sep 17 00:00:00 2001
|
||||
From 340cc5ef90dfcc495bdad045f3f76ae07405cffd Mon Sep 17 00:00:00 2001
|
||||
From: Guido Cella <guido@guidocella.xyz>
|
||||
Date: Tue, 6 Feb 2024 09:20:48 +0100
|
||||
Subject: [PATCH] add a keybinding to center the terminal
|
||||
@@ -10,14 +10,14 @@ This limits the width of long text making it easier to read, and avoids
|
||||
covering the wallpaper more than necessary.
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwl.c | 19 +++++++++++++++++++
|
||||
2 files changed, 20 insertions(+)
|
||||
dwl.c | 20 ++++++++++++++++++++
|
||||
2 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a85ca27..2055df9 100644
|
||||
index 22d2171..8229fcc 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -139,6 +139,7 @@ static const Key keys[] = {
|
||||
@@ -142,6 +142,7 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
@@ -26,10 +26,10 @@ index a85ca27..2055df9 100644
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
||||
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 002349a..4582413 100644
|
||||
index 12f441e..3b15748 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -7,6 +7,7 @@
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -37,7 +37,7 @@ index 002349a..4582413 100644
|
||||
#include <sys/wait.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
@@ -135,6 +136,7 @@ typedef struct {
|
||||
@@ -138,6 +139,7 @@ typedef struct {
|
||||
unsigned int bw;
|
||||
uint32_t tags;
|
||||
int isfloating, isurgent, isfullscreen;
|
||||
@@ -45,7 +45,7 @@ index 002349a..4582413 100644
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
} Client;
|
||||
|
||||
@@ -319,6 +321,7 @@ static void startdrag(struct wl_listener *listener, void *data);
|
||||
@@ -334,6 +336,7 @@ static void startdrag(struct wl_listener *listener, void *data);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
@@ -53,25 +53,26 @@ index 002349a..4582413 100644
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
@@ -392,6 +395,8 @@ static struct wlr_box sgeom;
|
||||
static struct wl_list mons;
|
||||
static Monitor *selmon;
|
||||
@@ -436,6 +439,8 @@ static struct wl_listener request_start_drag = {.notify = requeststartdrag};
|
||||
static struct wl_listener start_drag = {.notify = startdrag};
|
||||
static struct wl_listener new_session_lock = {.notify = locksession};
|
||||
|
||||
+static bool center;
|
||||
+
|
||||
#ifdef XWAYLAND
|
||||
static void activatex11(struct wl_listener *listener, void *data);
|
||||
static void associatex11(struct wl_listener *listener, void *data);
|
||||
@@ -457,6 +462,8 @@ applyrules(Client *c)
|
||||
}
|
||||
@@ -499,6 +504,9 @@ applyrules(Client *c)
|
||||
}
|
||||
}
|
||||
|
||||
+ if (!strcasecmp(appid, termcmd[0]))
|
||||
+ c->centered = true;
|
||||
+
|
||||
c->isfloating |= client_is_float_type(c);
|
||||
setmon(c, mon, newtags);
|
||||
}
|
||||
|
||||
@@ -2519,6 +2526,11 @@ tile(Monitor *m)
|
||||
@@ -2730,6 +2738,11 @@ tile(Monitor *m)
|
||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
continue;
|
||||
if (i < m->nmaster) {
|
||||
@@ -83,7 +84,7 @@ index 002349a..4582413 100644
|
||||
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
|
||||
.height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
|
||||
my += c->geom.height;
|
||||
@@ -2531,6 +2543,13 @@ tile(Monitor *m)
|
||||
@@ -2742,6 +2755,13 @@ tile(Monitor *m)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,5 +99,5 @@ index 002349a..4582413 100644
|
||||
togglefloating(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.43.0
|
||||
2.49.0
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
### Description
|
||||
This is a port of centeredmaster patch for dwm: <https://dwm.suckless.org/patches/centeredmaster>
|
||||
|
||||
centeredmaster centers the nmaster area on screen, using mfact * monitor
|
||||
width & height, with the stacked windows distributed to the left and
|
||||
right. It can be selected with `Alt+c`.
|
||||
|
||||
With one and two clients in master respectively this results in:
|
||||
|
||||
```
|
||||
+------------------------------+ +------------------------------+
|
||||
|+--------++--------++--------+| |+--------++--------++--------+|
|
||||
|| || || || || || || ||
|
||||
|| || || || || || M1 || ||
|
||||
|| || || || || || || ||
|
||||
|| S2 || M || S1 || || |+--------+| ||
|
||||
|| || || || || |+--------+| ||
|
||||
|| || || || || || || ||
|
||||
|| || || || || || M2 || ||
|
||||
|| || || || || || || ||
|
||||
|+--------++--------++--------+| |+--------++--------++--------+|
|
||||
+------------------------------+ +------------------------------+
|
||||
```
|
||||
|
||||
|
||||
### Download
|
||||
- [0.7](/dwl/dwl-patches/raw/branch/main/patches/centeredmaster/centeredmaster.patch)
|
||||
- [2024-04-11](https://codeberg.org/dwl/dwl-patches/raw/commit/b104a580a80ebaf9f7e8917fe574e3e97ddd019a/centeredmaster/centeredmaster.patch)
|
||||
- [0.5](https://codeberg.org/dwl/dwl-patches/raw/commit/0f4e40fee49d1b8b430778e241b29496ae3b3b70/centeredmaster/centeredmaster.patch)
|
||||
|
||||
### Authors
|
||||
- [Nikita Ivanov](https://codeberg.org/nikitaivanov) ([GitHub](https://github.com/NikitaIvanovV))
|
||||
- [wochap](https://codeberg.org/wochap)
|
||||
@@ -1,19 +1,39 @@
|
||||
From a9d47325283a55fd299de5bbbab5ab195840c7ca Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Thu, 11 Apr 2024 16:42:25 -0500
|
||||
Subject: [PATCH] implement centeredmaster layout
|
||||
From b1ca46930756b59c1ebba0b8c7871b85ff84f62f Mon Sep 17 00:00:00 2001
|
||||
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
||||
Date: Sat, 8 Feb 2025 16:10:25 +0100
|
||||
Subject: [PATCH] Add centeredmaster layout
|
||||
|
||||
inspiration: https://github.com/djpohly/dwl/wiki/centeredmaster
|
||||
This is a port of centeredmaster patch for dwm:
|
||||
https://dwm.suckless.org/patches/centeredmaster
|
||||
|
||||
centeredmaster centers the nmaster area on screen, using mfact * monitor
|
||||
width & height, with the stacked windows distributed to the left and
|
||||
right. It can be selected with [Alt]+[c].
|
||||
|
||||
With one and two clients in master respectively this results in:
|
||||
|
||||
+------------------------------+ +------------------------------+
|
||||
|+--------++--------++--------+| |+--------++--------++--------+|
|
||||
|| || || || || || || ||
|
||||
|| || || || || || M1 || ||
|
||||
|| || || || || || || ||
|
||||
|| S2 || M || S1 || || |+--------+| ||
|
||||
|| || || || || |+--------+| ||
|
||||
|| || || || || || || ||
|
||||
|| || || || || || M2 || ||
|
||||
|| || || || || || || ||
|
||||
|+--------++--------++--------+| |+--------++--------++--------+|
|
||||
+------------------------------+ +------------------------------+
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
dwl.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 66 insertions(+)
|
||||
dwl.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 65 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 8847e58..cfc6e62 100644
|
||||
index 22d2171..9a3b0c5 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -33,6 +33,7 @@ static const Layout layouts[] = {
|
||||
@@ -34,6 +34,7 @@ static const Layout layouts[] = {
|
||||
{ "[]=", tile },
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
@@ -21,7 +41,7 @@ index 8847e58..cfc6e62 100644
|
||||
};
|
||||
|
||||
/* monitors */
|
||||
@@ -134,6 +135,7 @@ static const Key keys[] = {
|
||||
@@ -139,6 +140,7 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||
@@ -30,10 +50,10 @@ index 8847e58..cfc6e62 100644
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index bf763df..0e84ccf 100644
|
||||
index def2562..c2456dd 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -248,6 +248,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||
@@ -251,6 +251,7 @@ static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||
static void arrangelayers(Monitor *m);
|
||||
static void axisnotify(struct wl_listener *listener, void *data);
|
||||
static void buttonpress(struct wl_listener *listener, void *data);
|
||||
@@ -41,15 +61,14 @@ index bf763df..0e84ccf 100644
|
||||
static void chvt(const Arg *arg);
|
||||
static void checkidleinhibitor(struct wlr_surface *exclude);
|
||||
static void cleanup(void);
|
||||
@@ -628,6 +629,69 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
@@ -649,6 +650,68 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
event->time_msec, event->button, event->state);
|
||||
}
|
||||
|
||||
+void
|
||||
+centeredmaster(Monitor *m)
|
||||
+{
|
||||
+ unsigned int h, mw, mx, my, oty, ety, tw;
|
||||
+ int i, n;
|
||||
+ int i, n, h, mw, mx, my, oty, ety, tw;
|
||||
+ Client *c;
|
||||
+
|
||||
+ n = 0;
|
||||
@@ -67,7 +86,7 @@ index bf763df..0e84ccf 100644
|
||||
+
|
||||
+ if (n > m->nmaster) {
|
||||
+ /* go mfact box in the center if more than nmaster clients */
|
||||
+ mw = ROUND(m->nmaster ? m->w.width * m->mfact : 0);
|
||||
+ mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0;
|
||||
+ tw = m->w.width - mw;
|
||||
+
|
||||
+ if (n - m->nmaster > 1) {
|
||||
@@ -112,5 +131,5 @@ index bf763df..0e84ccf 100644
|
||||
chvt(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.43.2
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
### Description
|
||||
Port of the cfact patch for the centeredmaster layout.
|
||||
|
||||
Inspired by the original patch for dwm (https://dwm.suckless.org/patches/cfacts/)
|
||||
|
||||
This patch requires both [cfact](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/cfact) and [centeredmaster](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/centeredmaster) patches.
|
||||
|
||||
### Download
|
||||
|
||||
- [2024-06-26](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/cfact-centeredmaster/cfact-centeredmaster.patch)
|
||||
|
||||
### Authors
|
||||
- [acadmendes](https://codeberg.org/acadmendes)
|
||||
@@ -0,0 +1,83 @@
|
||||
From e3ad25b5149df936155cb51927f16648a9838bc0 Mon Sep 17 00:00:00 2001
|
||||
From: estevao <estevao.mendes@acad.ufsm.br>
|
||||
Date: Thu, 25 Jul 2024 13:20:50 -0300
|
||||
Subject: [PATCH] cfact patch for centeredmaster layout
|
||||
|
||||
---
|
||||
dwl.c | 42 ++++++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 38 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 91c1511..37732c0 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -654,6 +656,7 @@ void
|
||||
centeredmaster(Monitor *m)
|
||||
{
|
||||
unsigned int h, mw, mx, my, oty, ety, tw;
|
||||
+ float mweight = 0, ltweight = 0, rtweight = 0;
|
||||
int i, n;
|
||||
Client *c;
|
||||
|
||||
@@ -672,7 +675,7 @@ centeredmaster(Monitor *m)
|
||||
|
||||
if (n > m->nmaster) {
|
||||
/* go mfact box in the center if more than nmaster clients */
|
||||
- mw = ROUND(m->nmaster ? m->w.width * m->mfact : 0);
|
||||
+ mw = roundf(m->nmaster ? m->w.width * m->mfact : 0);
|
||||
tw = m->w.width - mw;
|
||||
|
||||
if (n - m->nmaster > 1) {
|
||||
@@ -682,6 +685,20 @@ centeredmaster(Monitor *m)
|
||||
}
|
||||
}
|
||||
|
||||
+ i = 0;
|
||||
+ wl_list_for_each(c, &clients, link){
|
||||
+ if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
+ continue;
|
||||
+ if (i < m->nmaster)
|
||||
+ mweight += c->cweight;
|
||||
+ else if ( (i - m->nmaster)%2 ){
|
||||
+ ltweight += c->cweight;
|
||||
+ }else{
|
||||
+ rtweight += c->cweight;
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
+
|
||||
i = 0;
|
||||
oty = 0;
|
||||
ety = 0;
|
||||
@@ -691,22 +708,24 @@ centeredmaster(Monitor *m)
|
||||
if (i < m->nmaster) {
|
||||
/* nmaster clients are stacked vertically, in the center
|
||||
* of the screen */
|
||||
- h = (m->w.height - my) / (MIN(n, m->nmaster) - i);
|
||||
+ h = (m->w.height - my)*(c->cweight/mweight);
|
||||
resize(c, (struct wlr_box){.x = m->w.x + mx, .y = m->w.y + my, .width = mw,
|
||||
.height = h}, 0);
|
||||
my += c->geom.height;
|
||||
+ mweight -= c->cweight;
|
||||
} else {
|
||||
/* stack clients are stacked vertically */
|
||||
if ((i - m->nmaster) % 2) {
|
||||
- h = (m->w.height - ety) / ( (1 + n - i) / 2);
|
||||
+ h = (m->w.height - ety)*(c->cweight/ltweight);
|
||||
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + ety, .width = tw,
|
||||
.height = h}, 0);
|
||||
ety += c->geom.height;
|
||||
+ ltweight -= c->cweight;
|
||||
} else {
|
||||
- h = (m->w.height - oty) / ((1 + n - i) / 2);
|
||||
+ h = (m->w.height - oty)*(c->cweight/rtweight);
|
||||
resize(c, (struct wlr_box){.x = m->w.x + mx + mw, .y = m->w.y + oty, .width = tw,
|
||||
.height = h}, 0);
|
||||
oty += c->geom.height;
|
||||
+ rtweight -= c->cweight;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
--
|
||||
2.45.2
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
### Description
|
||||
This patch implements [cfact][cfact] for [snail][snail] layout.
|
||||
This patch must be applied on top of cfact and snail patches.
|
||||
|
||||
[cfact]: /dwl/dwl-patches/src/branch/main/patches/cfact
|
||||
[snail]: /dwl/dwl-patches/src/branch/main/patches/snail
|
||||
|
||||
|
||||
### Download
|
||||
- [v0.7](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/cfact-snail/cfact-snail.patch)
|
||||
|
||||
### Authors
|
||||
- [Nikita Ivanov](https://codeberg.org/nikitaivanov) ([GitHub](https://github.com/NikitaIvanovV))
|
||||
@@ -0,0 +1,68 @@
|
||||
From 9f8109182a7d173d2a2cb30c089a7e7b9ffe0a5e Mon Sep 17 00:00:00 2001
|
||||
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
||||
Date: Tue, 25 Mar 2025 02:24:32 +0100
|
||||
Subject: [PATCH] cfact patch for snail layout
|
||||
|
||||
---
|
||||
dwl.c | 24 ++++++++++++------------
|
||||
1 file changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 4f8c493..37aa935 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -2699,10 +2699,10 @@ snail(Monitor *m)
|
||||
* Split the previous horizontally and put the current window on the right
|
||||
*/
|
||||
} else if (dir == WLR_DIRECTION_RIGHT) {
|
||||
- c->geom = (struct wlr_box){.x = prev->geom.x + prev->geom.width / 2, .y = prev->geom.y,
|
||||
- .width = prev->geom.width / 2, .height = prev->geom.height};
|
||||
+ c->geom = (struct wlr_box){.x = prev->geom.x + (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.width), .y = prev->geom.y,
|
||||
+ .width = (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.width), .height = prev->geom.height};
|
||||
prev->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y,
|
||||
- .width = prev->geom.width / 2, .height = prev->geom.height};
|
||||
+ .width = (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.width), .height = prev->geom.height};
|
||||
/*
|
||||
* If it's a stack window or the first narrow window in the master
|
||||
* area, put the next one below it
|
||||
@@ -2713,28 +2713,28 @@ snail(Monitor *m)
|
||||
* Split the previous vertically and put the current window below it
|
||||
*/
|
||||
} else if (dir == WLR_DIRECTION_DOWN) {
|
||||
- c->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y + prev->geom.height / 2,
|
||||
- .width = prev->geom.width, .height = prev->geom.height / 2};
|
||||
+ c->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y + (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.height),
|
||||
+ .width = prev->geom.width, .height = (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.height)};
|
||||
prev->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y,
|
||||
- .width = prev->geom.width, .height = prev->geom.height / 2};
|
||||
+ .width = prev->geom.width, .height = (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.height)};
|
||||
dir = WLR_DIRECTION_LEFT;
|
||||
/*
|
||||
* Split the previous horizontally and put the current window on the left
|
||||
*/
|
||||
} else if (dir == WLR_DIRECTION_LEFT) {
|
||||
c->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y,
|
||||
- .width = prev->geom.width / 2, .height = prev->geom.height};
|
||||
- prev->geom = (struct wlr_box){.x = prev->geom.x + prev->geom.width / 2, .y = prev->geom.y,
|
||||
- .width = prev->geom.width / 2, .height = prev->geom.height};
|
||||
+ .width = (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.width), .height = prev->geom.height};
|
||||
+ prev->geom = (struct wlr_box){.x = prev->geom.x + (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.width), .y = prev->geom.y,
|
||||
+ .width = (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.width), .height = prev->geom.height};
|
||||
dir = WLR_DIRECTION_UP;
|
||||
/*
|
||||
* Split the previous vertically and put the current window above it
|
||||
*/
|
||||
} else {
|
||||
c->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y,
|
||||
- .width = prev->geom.width, .height = prev->geom.height / 2};
|
||||
- prev->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y + prev->geom.height / 2,
|
||||
- .width = prev->geom.width, .height = prev->geom.height / 2};
|
||||
+ .width = prev->geom.width, .height = (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.height)};
|
||||
+ prev->geom = (struct wlr_box){.x = prev->geom.x, .y = prev->geom.y + (int)(c->cweight / (c->cweight + prev->cweight) * prev->geom.height),
|
||||
+ .width = prev->geom.width, .height = (int)(prev->cweight / (prev->cweight + c->cweight) * prev->geom.height)};
|
||||
dir = WLR_DIRECTION_RIGHT;
|
||||
}
|
||||
i++;
|
||||
--
|
||||
2.49.0
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user