feat(config): add a flock { } configuration section - #28
Closed
abeljim8am wants to merge 1 commit into
Closed
Conversation
This was referenced Jul 28, 2026
One place to tell Flock where your projects are and which remote providers to
offer, instead of restating folder args on every plugin that needs them:
flock {
root_dirs "~/src" "~/work"
individual_dirs "~/dotfiles"
devcontainers true
ssh true
}
The values are merged in *underneath* the flock-selector and flock-sidebar
aliases, so the selector, the Super s keybinding and the sidebar in every session
derive from one source, while anything stated on a plugin or in a layout still
wins and can opt out.
Config names read better than the plugin args they translate to —
`devcontainers true` rather than `devcontainers_enabled "true"`, and a real list
rather than a `;`-joined string. Both spellings are accepted for lists and flags
so a value copied out of a layout works, and an unrecognized key is a parse error
rather than a silent skip, since a typo would otherwise leave the selector
mysteriously empty with nothing to point at.
Two design points worth the reviewer's attention:
The projection is computed on demand by
Config::plugin_aliases_with_flock_defaults() and deliberately *not* folded into
Config.plugins. The stored aliases are what gets serialized back to disk — the
configuration plugin writes the whole config, and the first-run wizard triggers
it — so baking the values in would be a one-way door: the next write copies them
into each alias body, where they outrank `flock { }` itself, and editing the
block silently stops having any effect. A test pins both halves of that.
FlockConfig therefore also needs to_kdl, or the section is dropped by that same
write-back. Tested by round-tripping through Config::to_string.
The plan called for injecting at plugin-load time in zellij-server so a layout
naming zellij:flock-selector directly would also pick the section up. Projecting
onto the aliases accepts that gap — narrow now that the bundled layouts and the
README all use the alias form, and documented in the README and CHANGELOG — for
one seam in zellij-utils that is fully unit-testable.
Verified against the built binary as well as in unit tests: with only a
`flock { }` block in config.kdl, dump-layout shows root_dirs, individual_dirs and
devcontainers_enabled resolved onto the sidebar inside the bundled layout, which
never mentions them.
abeljim8am
force-pushed
the
feat/flock-config-section
branch
from
August 4, 2026 15:34
5feb830 to
edfcde1
Compare
Collaborator
|
Superseded by mega PR #35 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Phase 0 made the two Flock plugins configurable in one place by registering them as plugin aliases — but that place is a
plugins { }alias body, which is plumbing, not a settings surface. It also means folder args are written twice (once per alias) and expressed in the plugins' wire format:root_dirs "~/src;~/work"rather than a list,devcontainers_enabled "true"rather than a bool.Phase 1 gives Flock a real configuration section:
Values are merged underneath the
flock-selectorandflock-sidebaraliases, so the selector, theSuper skeybinding and the sidebar in every session all derive from one source — while anything stated on a plugin or in a layout still wins, so a single layout can opt out.Ergonomics
root_dirs "~/src" "~/work") and the;-joined form, so a value copied out of a layout still works.ssh true) and the quoted string (ssh "true") for the same reason.root_dirs_typowould otherwise leave the selector mysteriously empty with nothing to point at.Two design points worth your attention
1. The projection is computed on demand, not stored.
Config::plugin_aliases_with_flock_defaults()builds it where the server consumes the aliases;Config.pluginsstays pristine.This is the important one. The stored aliases are what gets serialized back to disk — the configuration plugin writes the whole config, and the first-run wizard triggers it (I hit exactly this in #27, where the wizard wrote a
config.kdlinto a test fixture). Folding the projection intoConfig.pluginswould be a one-way door: the next write copies the values into each alias body, where they outrankflock { }itself, so editing the block would silently stop having any effect. Tests pin both halves — the stored alias stays clean, and ato_stringround-trip must not leakroot_dirsinto thepluginsblock.2.
FlockConfigneedsto_kdl, not justfrom_kdl— or that same write-back silently drops the section. Covered by a round-trip test.Deviation from the plan
The plan called for injecting at plugin-load time in
zellij-server, so a layout namingzellij:flock-selectordirectly would also pick the section up. I projected onto the aliases instead: one seam inzellij-utilsthat is fully unit-testable, versus threading config into the plugin thread and keeping several matching call sites consistent — where a missed seam fails silently, which is the failure mode that already bit this area twice.The accepted cost is that a layout referencing
zellij:flock-*directly gets noflock { }values and keeps whatever args it states. That is narrow now that the bundled layouts and the README all use the alias form, and it is documented in the README, the CHANGELOG, and the method's doc comment.Deferred to Phase 2
The key to disable selector-on-startup. That behavior does not exist yet, and shipping a config key that does nothing is worse than adding it when it works.
Verification
cargo xtask test— 2353 passing, 0 failures.cargo xtask format --checkclean.;-joined lists, bool and string flags, unknown-key error, arg-name translation, both plugins receiving identical config, alias-body-wins precedence, empty-section no-op, projection-not-stored, write-back round-trip plus the no-leak assertion, merge precedence in both directions, and that the shipped default ships the section commented out with both aliases present.flockfield in the config debug output.flock { }block inconfig.kdl,action dump-layoutshowsroot_dirs "~/src;~/work",individual_dirs "~/dotfiles"anddevcontainers_enabled "true"resolved onto the sidebar inside the bundled layout, which never mentions them. Ran with a pre-seededconfig.kdlso the first-run wizard could not interfere — the lesson from feat(setup): make a fresh install land in Flock, not plain Zellij #27.setup --check([CONFIG FILE]: Well defined.) rather than shipped untested.🤖 Generated with Claude Code