Add support for --automatic.

This commit is contained in:
2024-12-31 02:41:22 +00:00
parent 3c9324b63a
commit fac18a5eaa
5 changed files with 105 additions and 54 deletions

View File

@@ -23,7 +23,7 @@ monitor "left" make="Goldstar Company Ltd" model="LG HDR 4K" serial="0x0000B9C0"
monitor "right" make="Goldstar Company Ltd" model="LG HDR 4K" serial="0x0000B9BF"
// When I have "left" and "right" hooked up, I want this layout.
layout "two4k" {
layout "two4k" automatic=#true {
output "left" mode="3840x2160" scale="1.5" x=0 y=0 transform="270"
output "right" mode="3840x2160" scale="1.5" x=1440 y=1120 transform="normal"
}
@@ -48,16 +48,12 @@ set $select_layout swayout | tofi | xargs swayout
bindsym $mod+Shift+m exec $select_layout
```
## TODO
Things I might do someday:
### Automatic
Add a `automatic` option to layouts and an `--automatic` flag to `swayout`, and have it automatically enable the
first layout with `automatic=true` for which all outputs are available.
If `swayout` is called with the `--automatic` switch, the first layout with `automatic=#true` for which all outputs
are available is enabled. If no automatic layouts are available, `swayout` exits with code 2.
This could be run by `bindswitch lid:toggle exec swayout --automatic`.
## TODO
How to call when an output is connected or disconnected?
Wayland events via [wayland_client](https://docs.rs/wayland-client/latest/wayland_client/index.html)?