From f5062dc7183c69cfdc1d036f16d3e3ccdd83d1d7 Mon Sep 17 00:00:00 2001 From: crecher Date: Wed, 2 Sep 2026 15:19:37 +0200 Subject: started new tag system --- main.go | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index f7a85d2..c4f6905 100644 --- a/main.go +++ b/main.go @@ -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 { -- cgit v1.2.3