Simulating a 3 Way Tile View #1226
Replies: 4 comments
-
@bustedbyte did you ever figure this out?? I've been looking for something similar. With yabai the closest I can come is to set the layout to float and create hotkeys to send windows to the left, middle and right thirds... It works fine but isn't automatic... |
Beta Was this translation helpful? Give feedback.
-
This works for me. It assumes the first two windows had a vertical split, you can always check for that and toggle their split as well.
|
Beta Was this translation helpful? Give feedback.
-
@restfuladi. thank you for this. It works very well.
|
Beta Was this translation helpful? Give feedback.
-
I've been working on a Go wrapper so I decided to add this feature. Here's a really basic prototype of v1, I'm new to this and there may be lousy code. package main
import (
"encoding/json"
"io"
"net"
"os"
"os/user"
"strconv"
"strings"
)
type window struct {
ID int `json:"id"`
IsVisible bool `json:"is-visible"`
SplitType string `json:"split-type"`
}
type space struct {
LastWindow int `json:"last-window"`
}
func main() {
newId := os.Args[1]
newIdInt, _ := strconv.Atoi(newId)
u, _ := user.Current()
addr := "/tmp/yabai_" + u.Username + ".socket"
var w []window
c, _ := net.Dial("unix", addr)
c.Write([]byte("query\x00--windows\x00--space\x00\x00"))
r, _ := io.ReadAll(c)
json.Unmarshal(r, &w)
var n int
for _, v := range w {
if v.IsVisible {
n++
}
}
if n <= 3 {
for _, v := range w {
if v.ID == newIdInt && v.SplitType == "horizontal" {
s := strings.Join([]string{"window", newId, "--toggle", "split", "\x00"}, "\x00")
c, _ = net.Dial("unix", addr)
c.Write([]byte(s))
s := strings.Join([]string{"space", newId, "--balance", "\x00"}, "\x00")
c, _ = net.Dial("unix", addr)
_, _ = c.Write([]byte(s))
return
} else {
s := strings.Join([]string{"space", newId, "--balance", "\x00"}, "\x00")
c, _ = net.Dial("unix", addr)
_, _ = c.Write([]byte(s))
return
}
}
}
if n > 3 {
var sp space
c, _ = net.Dial("unix", addr)
c.Write([]byte("query\x00--spaces\x00--space\x00\x00"))
r, _ = io.ReadAll(c)
json.Unmarshal(r, &sp)
lw := strconv.Itoa(sp.LastWindow)
c, _ = net.Dial("unix", addr)
s := strings.Join([]string{"window", lw, "--insert", "south", "\x00"}, "\x00")
c.Write([]byte(s))
c, _ = net.Dial("unix", addr)
s = strings.Join([]string{"window", newId, "--warp", lw, "\x00"}, "\x00")
c.Write([]byte(s))
}
} |
Beta Was this translation helpful? Give feedback.
-
Hi about once a year I come back to tile managers to see if it's possible to run apps in fullscreen while tiling. I have an apple M1 and it can only support one external monitor, so I have a massive 49" ultrawide which is great. But I'd love to have something like the native macos split, except not just in two sections but perhaps 3 or 4 so I could have less context switching. Right now there is so much wasted space and so many screen flips.
When running out of full screen modes various IDE's and browsers add a bunch of extra visual overhead thats hard to hide. Hoping against hope 🤞 Thanks!
Beta Was this translation helpful? Give feedback.
All reactions