diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -340,7 +340,18 @@ func handleKeyPress(conn *xgb.Conn, e xproto.KeyPressEvent) { } } +func updateBorders(conn *xgb.Conn) { + for _, c := range clients { + color := borderColor + if c.Win == focused { + color = borderFocus + } + xproto.ChangeWindowAttributes(conn, c.Win, xproto.CwBorderPixel, []uint32{color}) + } +} + func setInputFocus(conn *xgb.Conn, win xproto.Window) { + updateBorders(conn) if win == 0 { return } @@ -421,6 +432,7 @@ func switchTags(conn *xgb.Conn, tags BitMask) { } func dim(v int) uint32 { + v -= borderWidth * 2 if v < 1 { return 1 } @@ -807,6 +819,7 @@ func updateWindows(conn *xgb.Conn) { // log.Println(client.Tags & GlobalTags) if (client.Tags & GlobalTags) >= 1 { xproto.MapWindow(conn, client.Win) + xproto.ConfigureWindow(conn, client.Win, xproto.ConfigWindowBorderWidth, []uint32{uint32(borderWidth)}) ActiveClients = append(ActiveClients, client) // log.Println("Mapping window", client.Win) } @@ -824,4 +837,5 @@ func updateWindows(conn *xgb.Conn) { } refocus(conn) + updateBorders(conn) } |