feat(config): configurable monitor config filename - #46
Merged
Conversation
Closes #40. The monitor config filename was hardcoded per compositor (monitors.kdl / monitors.conf / monitors.lua). Add a single `monitor_config_name` setting — a base name without extension, relative to the compositor config directory — that drives all three backends; each appends its own extension. - utils: `sanitize_monitor_config_name` (reject absolute paths and `..` traversal, normalize separators, strip a mistakenly typed known extension, fall back to the default) and `get_monitor_config_name` - config_paths / hypr_config: resolve filenames from the setting, keeping config_paths the single source of truth used for backup/revert - niri/sway/hyprland: cross-writes go through the shared paths; the Niri `include` line in config.kdl stays in sync with the configured name, and a stale Monique-managed include is swapped out on rename without touching user includes or user-added output blocks - window: "Monitor config filename" row in Preferences → Config Output - Subdirectories are supported (e.g. `cfg/display`); the default `monitors` reproduces the historical filenames, so existing setups are untouched - tests: sanitize rules, path propagation to all backends, back-compat, and Niri include first-run / rename / user-managed cases - README: document the new setting
Adw.EntryRow has no subtitle, so the config-name change handler would raise AttributeError the moment the user typed in the field. Move the live filename preview to the row tooltip (EntryRow supports set_tooltip_text) and state in the Config Output group description that the filename is a base name relative to the compositor's config directory.
ToRvaLDz
force-pushed
the
feat/configurable-monitor-config-filename
branch
from
August 2, 2026 08:26
7d1e5c8 to
b454b59
Compare
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.
Closes #40.
Summary
The generated monitor config filename was hardcoded per compositor (
monitors.kdl/monitors.conf/monitors.lua). This adds a singlemonitor_config_namesetting: a base name without extension, relative to the compositor's config directory, that drives all three backends. Each backend appends its own extension.Example with
monitor_config_name = "cfg/display":~/.config/niri/cfg/display.kdl~/.config/sway/cfg/display.conf~/.config/hypr/cfg/display.confand/orcfg/display.luaThe default is
monitors, reproducing the historical filenames, so existing setups are untouched after upgrading.Design
Per the discussion on #40, this is one setting covering Niri, Hyprland and Sway rather than a Niri-only option, with the value taken as a path relative to the compositor config directory.
utils.sanitize_monitor_config_name): rejects absolute paths and..traversal, normalizes separators, drops a mistakenly typed known extension (display.kdlwon't becomedisplay.kdl.conf), and falls back to the default on invalid input. Subdirectories are supported and created on write.config_paths/hypr_config, which the GUI already uses for backup/revert, so the written files and the backed-up files can't diverge.includeline inconfig.kdluses the configured name. On a rename, the stale Monique-managedincludeis swapped out (matched via the// Monique monitor configurationmarker) so Niri never applies two conflicting layouts — while userincludelines and user-addedoutputblocks are preserved. Output-block stripping still only happens on a true first run.UI
New "Monitor config filename (no extension)" row in Preferences → Config Output; its subtitle previews the effective filenames.
Tests
tests/test_config_name.py(22 tests): sanitize rules, propagation to all three backends, back-compat with the historical names, and the Niri include cases (first run, rename swap, user-managed include, user output blocks preserved). Full suite: 133 passed.Notes
source/requirelines by hand (documented in the README), same as the existing config-format switch./etc/greetd/monique-monitors.conf) is intentionally out of scope.