From 5bc90e2b8b6d22e755797182c5d3b2f22cb62f63 Mon Sep 17 00:00:00 2001 From: crecher Date: Mon, 26 Oct 2026 00:33:34 +0000 Subject: feat: zoom Signed-off-by: crecher --- README.md | 2 +- default_config.toml | 1 + main.go | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2173415..26c21d6 100644 --- a/README.md +++ b/README.md @@ -24,5 +24,5 @@ left out will use the defaults, invalid values are logged and skipped. binds are in `[binds]` as `"+" = ""`, where `mod` is your configured mod key and an empty action unbinds. -actions: `spawn `, `quit`, `restart`, `kill`, `layout `, +actions: `spawn `, `quit`, `restart`, `kill`, `zoom`, `layout `, `masters <+n|-n>`, `ratio <+0.05|-0.05>`, `view `, `toggle `, `tag `. diff --git a/default_config.toml b/default_config.toml index 1557d0b..1123607 100644 --- a/default_config.toml +++ b/default_config.toml @@ -25,6 +25,7 @@ border_focus = "#285577" "mod+shift+q" = "quit" "mod+shift+r" = "restart" "mod+q" = "kill" +"mod+shift+Return" = "zoom" "mod+l" = "layout tileHorizontal" "mod+shift+l" = "layout tileVertical" "mod+m" = "layout tileWithMaster" diff --git a/main.go b/main.go index 9d6af05..74caab4 100644 --- a/main.go +++ b/main.go @@ -446,6 +446,28 @@ func moveToTag(conn *xgb.Conn, tags BitMask) { drawBar(conn) } +func zoom(conn *xgb.Conn) { + var tiled []*Client + for _, c := range ActiveClients { + if !c.Floating { + tiled = append(tiled, c) + } + } + c, ok := clients[focused] + if !ok || c.Floating || len(tiled) < 2 { + return + } + if c == tiled[0] { + c = tiled[1] + } + removeClient(c.Win) + clientList = append([]*Client{c}, clientList...) + focused = c.Win + setInputFocus(conn, focused) + updateWindows(conn) + drawBar(conn) +} + func toggleView(conn *xgb.Conn, tags BitMask) { view := GlobalTags ^ tags if view == 0 { @@ -1113,6 +1135,8 @@ func parseAction(s string) (func(*xgb.Conn), error) { return func(*xgb.Conn) { quit() }, nil case "restart": return func(*xgb.Conn) { restart() }, nil + case "zoom": + return zoom, nil case "kill": return func(conn *xgb.Conn) { killActiveWindow(conn, focused) }, nil case "layout": -- cgit v1.2.3