fix(hyprland): resolve desc: monitor names before generating config

Extract shared resolveMonitorNames to backend package so both
Hyprland and Sway backends resolve desc: prefixed names to actual
connector names before applying monitor layout.

Previously the Hyprland backend wrote desc:... literally into
monitors.conf, which Hyprland ignores, causing monitors to be
positioned incorrectly or not configured at all.
This commit is contained in:
Maksim Totmin
2026-06-23 09:06:08 +07:00
parent fb40347c68
commit ac2bb77113
3 changed files with 75 additions and 64 deletions
+6
View File
@@ -93,6 +93,12 @@ func (h *hyprlandBackend) GetMonitors(ctx context.Context) ([]MonitorInfo, error
// ApplyLayout writes the monitor configuration file and calls hyprctl reload.
// The config is written atomically (temp file + rename) to prevent corruption.
func (h *hyprlandBackend) ApplyLayout(ctx context.Context, monitors []MonitorConfig) error {
var err error
monitors, err = resolveMonitorNames(ctx, monitors, h.GetMonitors, h.logger)
if err != nil {
return fmt.Errorf("resolve monitor names: %w", err)
}
content := h.generateConf(monitors)
destPath, err := h.resolveOutputPath()