refactor: move backend options into backend_config section

- Add BackendConfig map[string]any to Config struct
- Deprecate top-level output_path (backward compatible via EffectiveBackendConfig())
- NewHyprland now accepts opts map[string]any instead of raw outputPath
- Factory signature unified to func(*slog.Logger, map[string]any) for all backends
- Update README with backend_config docs and fix Sway skeleton signature
- Update example.yaml to show backend_config instead of output_path
This commit is contained in:
Maksim Totmin
2026-06-22 20:49:02 +07:00
parent 15691c0918
commit cc1137608c
5 changed files with 74 additions and 13 deletions
+21 -1
View File
@@ -166,6 +166,25 @@ Two match modes in the `external` list:
Run `hyprctl monitors all` to see your monitor names and descriptions.
### Backend-specific configuration
Use the `backend_config` section for compositor-specific options:
```yaml
backend_config:
output_path: ~/.config/hypr/custom-monitors.conf # override generated config path
```
**Hyprland keys:**
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| `output_path` | string | `~/.config/hypr/monitors.conf` | Path to the generated monitor config file. Supports `~` expansion. |
The deprecated top-level `output_path` key still works — `backend_config` takes priority if both are set.
When adding new compositor backends, their options go into the same `backend_config` section without changing the core config structure.
### Hook commands
Hooks are shell commands executed via `sh -c`. Each command gets a **30-second timeout**. Commands run in parallel — one slow hook won't block others.
@@ -273,8 +292,9 @@ package backend
type swayBackend struct { logger *slog.Logger }
func NewSway(logger *slog.Logger) (Backend, error) {
func NewSway(logger *slog.Logger, opts map[string]any) (Backend, error) {
// Check if SWAYSOCK is set and swaymsg is available
// opts carries backend_config from the config file
return &swayBackend{logger: logger}, nil
}