feat(hyprland): generate Lua monitor config instead of hyprlang
Write hl.monitor({...}) calls to ~/.config/hypr/monitors.lua (loaded via
require("monitors") in hyprland.lua) instead of monitor= lines in
monitors.conf. Prepare now strips hl.monitor lines with disabled = true,
and generateConf omits mode/position so Hyprland uses its defaults.
Update README and example config to match.
This commit is contained in:
@@ -42,7 +42,7 @@ Plugs into your dock — external monitors turn on, built-in turns off. Unplug
|
||||
1. **Startup** — daemon queries connected monitors, determines portable/docked, applies layout
|
||||
2. **Hotplug events** — listens to compositor socket for monitor connect/disconnect events
|
||||
3. **Debounce** — waits 1200ms after the last event (docks fire multiple events)
|
||||
4. **Apply** — Hyprland: writes `monitors.conf` + `hyprctl reload`; Sway: `swaymsg 'output ...'` batch commands
|
||||
4. **Apply** — Hyprland: writes `monitors.lua` + `hyprctl reload`; Sway: `swaymsg 'output ...'` batch commands
|
||||
5. **Hooks** — runs shell commands after layout change (waybar, wallpapers, etc.)
|
||||
6. **Fallback polling** — every 5s checks monitor state (catches missed events)
|
||||
|
||||
@@ -91,13 +91,15 @@ Configure `backend` in `config.yaml`:
|
||||
|
||||
### Hyprland setup
|
||||
|
||||
Add one line to `~/.config/hypr/hyprland.conf` (or `hyprland.lua`):
|
||||
Add one line to `~/.config/hypr/hyprland.lua`:
|
||||
|
||||
```
|
||||
source = ~/.config/hypr/monitors.conf
|
||||
```lua
|
||||
require("monitors")
|
||||
```
|
||||
|
||||
Remove any static `monitor=...` lines — monitor-lets-go manages monitors now.
|
||||
The daemon writes `~/.config/hypr/monitors.lua` (Lua, `hl.monitor` calls) and
|
||||
reloads Hyprland automatically.
|
||||
|
||||
Then reload:
|
||||
|
||||
@@ -215,12 +217,12 @@ Use the `backend_config` section for compositor-specific options:
|
||||
|
||||
```yaml
|
||||
backend_config:
|
||||
output_path: ~/.config/hypr/custom-monitors.conf # override generated config path
|
||||
output_path: ~/.config/hypr/custom-monitors.lua # override generated config path
|
||||
```
|
||||
|
||||
| Backend | Key | Type | Default | Description |
|
||||
|---------|-----|------|---------|-------------|
|
||||
| Hyprland | `output_path` | string | `~/.config/hypr/monitors.conf` | Path to the generated monitor config file. Supports `~` expansion. |
|
||||
| Hyprland | `output_path` | string | `~/.config/hypr/monitors.lua` | Path to the generated monitor config file. Supports `~` expansion. |
|
||||
| Sway | _(none)_ | — | — | Layout is applied via `swaymsg` commands directly — no config files needed. |
|
||||
|
||||
The deprecated top-level `output_path` key still works — `backend_config` takes priority if both are set.
|
||||
@@ -339,9 +341,9 @@ The daemon couldn't find any supported compositor.
|
||||
|
||||
**Sway:** `SWAYSOCK` is not set and no sway IPC socket found in `$XDG_RUNTIME_DIR`. Make sure Sway is running and the socket is accessible. Verify with: `ls $XDG_RUNTIME_DIR/sway-ipc.*.sock`.
|
||||
|
||||
### "source file not found" (Hyprland only)
|
||||
### "module not found: monitors" (Hyprland only)
|
||||
|
||||
The `source = ~/.config/hypr/monitors.conf` line must be added to hyprland.conf. The daemon creates this file on first run.
|
||||
The `require("monitors")` line must be added to `~/.config/hypr/hyprland.lua`. The daemon creates `~/.config/hypr/monitors.lua` on first run.
|
||||
|
||||
### Hooks not running
|
||||
|
||||
|
||||
Reference in New Issue
Block a user