diff options
| author | crecher <crecher@crecher.net> | 2026-09-02 15:19:37 +0200 |
|---|---|---|
| committer | crecher <crecher@crecher.net> | 2026-09-02 15:19:37 +0200 |
| commit | f5062dc7183c69cfdc1d036f16d3e3ccdd83d1d7 (patch) | |
| tree | c58dbf715568317bf42158c0408737b282653f80 | |
| parent | fc376af69e9eb034f76fad5a7b91304410ed004e (diff) | |
| download | wm-f5062dc7183c69cfdc1d036f16d3e3ccdd83d1d7.tar.gz wm-f5062dc7183c69cfdc1d036f16d3e3ccdd83d1d7.zip | |
started new tag system
| -rw-r--r-- | main.go | 46 |
1 files changed, 38 insertions, 8 deletions
@@ -23,14 +23,18 @@ type Key struct { Fn func(*xgb.Conn) } +// TODO rewrite tagging system type Client struct { - Win xproto.Window - X int16 - Y int16 - Width uint16 - Height uint16 - Floating bool - Tags BitMask + Win xproto.Window + X int16 + Y int16 + Width uint16 + Height uint16 + Floating bool + Tags BitMask + Next *Client + Previous *Client + MasterTags BitMask } var ( @@ -194,7 +198,7 @@ func setupKeys(conn *xgb.Conn) { Mod: mod, Sym: keysym.XK_Return, Fn: func(conn *xgb.Conn) { - spawn("st", "-Z", "32") + spawn("st") }, }, { @@ -469,6 +473,7 @@ func switchTags(conn *xgb.Conn, tags BitMask) { GlobalTags = tags // unmap everything + for _, client := range clients { xproto.UnmapWindow(conn, client.Win) } @@ -476,6 +481,24 @@ func switchTags(conn *xgb.Conn, tags BitMask) { updateWindows(conn) } +func switchTagsNew(conn *xgb.Conn, tags BitMask) { + GlobalTags = tags + // master := nil + // unmap everything + // + for _, client := range clients { + xproto.UnmapWindow(conn, client.Win) + if client.Tags >= tags && client.MasterTags != tags { + client.MasterTags = tags + master := client + } + } + + updateNew(conn, master) + + // find and map master window -> map next until next == nil +} + func tileVertical(conn *xgb.Conn) { screen := xproto.Setup(conn).DefaultScreen(conn) screenWidth := int(screen.WidthInPixels) @@ -702,6 +725,13 @@ func getWindowTitle(conn *xgb.Conn, win xproto.Window) string { return string(prop.Value) } +func updateNew(conn *xgb.Conn, client Client) { + xproto.MapWindow(conn, client.Win) + if client.Next != nil { + updateNew(conn, *client.Next) + } +} + func updateWindows(conn *xgb.Conn) { ActiveClients = ActiveClients[:0] for _, client := range clients { |