Skip to content

feat(config): merge included arrays - #175

Draft
niklaskorz wants to merge 1 commit into
noctalia-dev:mainfrom
niklaskorz:config-merge-arrays
Draft

feat(config): merge included arrays#175
niklaskorz wants to merge 1 commit into
noctalia-dev:mainfrom
niklaskorz:config-merge-arrays

Conversation

@niklaskorz

@niklaskorz niklaskorz commented Sep 7, 2026

Copy link
Copy Markdown

Summary

When merging values of all included configs, array values are now concatenated.
This is particularly useful for window rules.

Motivation

Re-defining arrays over separate included config files only leaves the array values of the last applied config.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Build / packaging
  • Documentation

Related Issue

Testing

Manual Coverage

  • Tested in a nested Umbriel session
  • Tested in a native Umbriel session
  • Tested with multiple monitors
  • Tested with a scaled output
  • Tested with native Wayland applications
  • Tested with X11 applications through xwayland-satellite
  • Tested with the scrolling layout
  • Tested with the dwindle layout

Screenshots / Videos

Checklist

  • This PR is ready for review, or it is marked as Draft.
  • This change fits SCOPE.md, or its scope was agreed in an issue or on Discord first.
  • I read and followed the relevant guidance in CONTRIBUTING.md.
  • I ran just format, or this PR has no C++ changes.
  • I ran the relevant build, test, lint, or verification commands, or explained why they were not run.
  • I functionally verified compositor behavior where automated checks are insufficient.
  • I self-reviewed the changes.
  • I checked for new warnings or errors.
  • I updated docs/ and examples/config.toml, or this PR does not change user-facing configuration or behavior.
  • I used canonical names for config keys, IPC actions, paths, and identifiers.

Additional Notes

for (auto&& elem : *overlayArray) {
elem.visit([&](auto&& val) {
using T = std::decay_t<decltype(val)>;
baseArray->push_back(T(std::move(val)));

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I assumed the same applies to array values as to other values, as noted by the comment further below ("Move via visit to preserve toml++ source regions (copies reset them).")

continue;
}
}
} else if (auto* overlayArray = value.as_array()) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This currently turns all arrays into append-only arrays. You can't reset them to an empty list, or override them entirely. This is a question of user experience that I can't answer, so this is a draft until I have feedback on this.
We could narrow this down to only merge arrays of tables, through value.is_array_of_tables().
That would still serve the use case of window and layer rules spread over multiple configs, but makes it easy to override primitive arrays.

I will add tests once it's clear what behavior is desired / acceptable.

@ItsLemmy

ItsLemmy commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Agreed with your second comment: let's narrow it to arrays of tables only. Appending every array breaks the fixed-size ones (position, calibration_matrix) by making them too long, and would make general.autostart run the included commands twice.
Keeping it to non-empty arrays also means window_rule = [] still works as a reset.

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