♻️ refactor: split switch_layout into next_layout and previous_layout…#728
♻️ refactor: split switch_layout into next_layout and previous_layout…#728EslamMohamed365 wants to merge 10 commits intomangowm:mainfrom
Conversation
… functions - Add next_layout() to cycle forward through layouts - Add previous_layout() to cycle backward through layouts - Keep switch_layout() as backward-compatible alias to next_layout() - Update config.conf with example keybinds for both new functions
There was a problem hiding this comment.
Pull request overview
Refactors layout switching so users can cycle layouts both forward and backward via separate dispatch functions, while preserving switch_layout() as a compatibility alias.
Changes:
- Introduce
next_layout()andprevious_layout()backed by a shared internal direction helper. - Keep
switch_layout()as an alias tonext_layout()for backward compatibility. - Extend config parsing and sample config keybinds to support the new functions.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/dispatch/bind_define.h |
Splits layout cycling logic into a direction-based helper and adds next_layout/previous_layout plus alias switch_layout. |
src/dispatch/bind_declare.h |
Declares the new layout-cycling functions for use by the dispatcher/config parser. |
src/config/parse_config.h |
Adds parsing for next_layout and previous_layout function names. |
assets/config.conf |
Updates example keybinds to show forward/backward layout cycling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Internal helper: direction > 0 means next, direction < 0 means previous | ||
| static int32_t _switch_layout_dir(int direction) { | ||
| int32_t jk, ji; |
There was a problem hiding this comment.
_switch_layout_dir starts with a leading underscore at file scope, which is reserved for the C implementation and can technically invoke undefined behavior / name collisions. Rename this helper to a non-reserved identifier (e.g., switch_layout_dir / switch_layout_dir_internal). Also, the comment says direction < 0 means previous, but the code treats direction == 0 as previous via the else branch—consider handling direction == 0 explicitly (no-op or treat as next) to keep the contract clear.
673ec40 to
db30977
Compare
17ff2ad to
064bcad
Compare
0d3ed31 to
5267649
Compare
… functions