aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrecher <crecher@crecher.net>2026-10-26 00:33:34 +0000
committercrecher <crecher@crecher.net>2026-10-26 00:33:34 +0000
commit5bc90e2b8b6d22e755797182c5d3b2f22cb62f63 (patch)
tree8860a5e48a35be0bd78fb665f43dc9f88f2fa343
parent1db9b13964082042a9578d372723777273c50daa (diff)
downloadwm-5bc90e2b8b6d22e755797182c5d3b2f22cb62f63.tar.gz
wm-5bc90e2b8b6d22e755797182c5d3b2f22cb62f63.zip
feat: zoom
Signed-off-by: crecher <crecher@crecher.net>
-rw-r--r--README.md2
-rw-r--r--default_config.toml1
-rw-r--r--main.go24
3 files changed, 26 insertions, 1 deletions
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
`"<mods>+<key>" = "<action>"`, where `mod` is your configured mod key and an empty action unbinds.
-actions: `spawn <shell command>`, `quit`, `restart`, `kill`, `layout <name>`,
+actions: `spawn <shell command>`, `quit`, `restart`, `kill`, `zoom`, `layout <name>`,
`masters <+n|-n>`, `ratio <+0.05|-0.05>`, `view <n|all>`, `toggle <n|all>`, `tag <n|all>`.
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":