Skip to content

♻️ refactor: split switch_layout into next_layout and previous_layout…#728

Open
EslamMohamed365 wants to merge 10 commits intomangowm:mainfrom
EslamMohamed365:main
Open

♻️ refactor: split switch_layout into next_layout and previous_layout…#728
EslamMohamed365 wants to merge 10 commits intomangowm:mainfrom
EslamMohamed365:main

Conversation

@EslamMohamed365
Copy link
Copy Markdown

… 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

… 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
Copilot AI review requested due to automatic review settings March 2, 2026 13:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() and previous_layout() backed by a shared internal direction helper.
  • Keep switch_layout() as an alias to next_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.

Comment on lines +976 to 978
// Internal helper: direction > 0 means next, direction < 0 means previous
static int32_t _switch_layout_dir(int direction) {
int32_t jk, ji;
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_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.

Copilot uses AI. Check for mistakes.
@DreamMaoMao DreamMaoMao force-pushed the main branch 2 times, most recently from 673ec40 to db30977 Compare March 9, 2026 05:28
@DreamMaoMao DreamMaoMao force-pushed the main branch 2 times, most recently from 17ff2ad to 064bcad Compare March 23, 2026 02:56
@DreamMaoMao DreamMaoMao force-pushed the main branch 2 times, most recently from 0d3ed31 to 5267649 Compare March 30, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants