diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | default_config.toml | 1 | ||||
| -rw-r--r-- | main.go | 24 |
3 files changed, 26 insertions, 1 deletions
@@ -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" @@ -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": |