Add cycle back feature for presets of column/window width/height.#1670
Add cycle back feature for presets of column/window width/height.#1670YaLTeR merged 2 commits intoniri-wm:mainfrom two-horned:main
Conversation
|
Last merge-commit simply synced my fork to avoid future conflicts. |
src/layout/floating.rs
Outdated
| // We use const generic IS_WIDTH, because we cannot specifically pass the option as parameter | ||
| // without cloning it. This is because we'd need to pass immutable and mutable references, | ||
| // which is not possible. | ||
| fn toggle_window<const FORWARDS: bool, const IS_WIDTH: bool>(&mut self, id: Option<&W::Id>) { |
There was a problem hiding this comment.
This does not need to be deduplicated with the function below, at least not in this PR. Not to mention you forgot to update a bunch of the code... So please revert this change, which also gets rid of the IS_WIDTH generic along with the problem in your comment.
There was a problem hiding this comment.
This piece of code was essential to understand cycling forwards/backwards of presets.
Code generation and logic is identical to the previous version, just more readable.
If you want to remove the const generic and use a flag instead I am happy to change that, but it's kinda weird to reintroduce duplicate code again.
There was a problem hiding this comment.
Do you mind reintroducing the duplicate functions? It'll result in a smaller PR diff overall too. It's not a big deal, and we can do refactoring separately down the line.
Sorry, but there's a lot of open PRs, and I'm also fairly busy outside niri (and have been traveling). Anyway, I think we can get this in before the release this Saturday. |
|
Alright, I fixed it and finished it up. (Sidenote, the de-duplicated code did in fact still contain mistakes like using width in both width and height cases, even after the latest push.) Also while testing, managed to find a small bug in preset height handling for floating windows (in a separate commit). |
|
Thanks |
|
Hey, just recently saw your messages. |
Hello,
this is kind of a DUPLICATE since there's already draft #1367 that attacks issue / discussion #1000, but
it hasn't seen any updates since more than a month! So I hereby request to use this solution.
I simply made the existing functions that switch to the next preset
const generics.The
FORWARDSconstant can be set to either true or false, and depending on the valuewe cycle for- or backwards through the presets.
Code compiles and passes tests. Wiki has been (slightly) updated.
Best Regards
S.K.