feat: support named switchable layouts

This commit is contained in:
Steve Cliff
2026-08-20 09:06:37 +01:00
parent 6ddecad74d
commit 45ee82692d
7 changed files with 172 additions and 30 deletions
+51 -7
View File
@@ -79,15 +79,17 @@ Here is a complete two-column configuration:
version: 1
gap: 8
shift_drag: true
active_layout: columns
overlay:
enabled: true
color: "#00AEEF"
opacity: 90
border_width: 3
border_width: 10
layouts:
- monitor: "*"
- name: columns
monitor: "*"
zones:
- name: left
x: 0
@@ -100,6 +102,15 @@ layouts:
width: 50
height: 100
- name: fullscreen
monitor: "*"
zones:
- name: full
x: 0
y: 0
width: 100
height: 100
excluded_apps:
- mstsc.exe
@@ -126,6 +137,7 @@ use.
| `version` | Configuration format. This must currently be `1`. |
| `gap` | Inward spacing, in pixels, applied to every edge of every zone. Valid range: `0``500`. |
| `shift_drag` | Enables or disables mouse snapping when Shift is held at the end of a drag. |
| `active_layout` | Name of the layout currently used for snapping and the overlay. |
| `overlay` | Controls the transparent zone guide shown during Shift-dragging. |
| `layouts` | One or more monitor layouts containing zones. |
| `excluded_apps` | Applications FancyWin must not move. May be empty. |
@@ -144,7 +156,7 @@ overlay:
enabled: true
color: "#00AEEF"
opacity: 90
border_width: 3
border_width: 10
```
- `enabled` turns the guide on or off.
@@ -182,7 +194,32 @@ For example, the bottom-right quarter is:
Zones may overlap. If the pointer is inside more than one zone, the first
matching zone listed in the file is selected.
### Monitor-specific layouts
### Named layouts and monitor-specific variants
Every entry under `layouts` has a `name`. Set `active_layout` to that name to
choose which layout FancyWin uses:
```yaml
active_layout: focus
layouts:
- name: focus
monitor: "*"
zones:
- { name: left, x: 0, y: 0, width: 25, height: 100 }
- { name: middle, x: 25, y: 0, width: 50, height: 100 }
- { name: right, x: 75, y: 0, width: 25, height: 100 }
- name: equal-thirds
monitor: "*"
zones:
- { name: left, x: 0, y: 0, width: 33.333, height: 100 }
- { name: middle, x: 33.333, y: 0, width: 33.334, height: 100 }
- { name: right, x: 66.667, y: 0, width: 33.333, height: 100 }
```
Changing `active_layout` to `equal-thirds` is applied automatically within
about two seconds; FancyWin does not need to be restarted.
Use `monitor: "*"` as the fallback layout for every display that does not have
a specific entry. At startup, FancyWin prints detected device names such as
@@ -192,18 +229,25 @@ A specific monitor layout can override the fallback:
```yaml
layouts:
- monitor: "*"
- name: focus
monitor: "*"
zones:
- { name: left, x: 0, y: 0, width: 50, height: 100 }
- { name: right, x: 50, y: 0, width: 50, height: 100 }
- monitor: '\\.\DISPLAY2'
- name: focus
monitor: '\\.\DISPLAY2'
zones:
- { name: main, x: 0, y: 0, width: 70, height: 100 }
- { name: side, x: 70, y: 0, width: 30, height: 100 }
```
Only one layout may be declared for each monitor name.
The monitor-specific entry must use the same layout name as its fallback. Only
one entry may be declared for each combination of layout name and monitor name.
Names and monitor matching are not case-sensitive.
Older configurations containing no `active_layout` and no layout names are
loaded as one backwards-compatible layout named `default`.
### Hotkeys