aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorcrecher <crecher@crecher.net>2026-10-21 22:54:08 +0000
committercrecher <crecher@crecher.net>2026-10-21 22:54:08 +0000
commit0aa9fdd81cb4ae58d39f09396f29827092b6e49c (patch)
treebfe6ec6a8b55b156ab8d6f2acf1d29abdd930ffb /main.go
parentbfc964c201df4ceb1e3756026a843d24d8a8019c (diff)
downloadwm-0aa9fdd81cb4ae58d39f09396f29827092b6e49c.tar.gz
wm-0aa9fdd81cb4ae58d39f09396f29827092b6e49c.zip
feat: window borders
thank you xorg for making this easy still fucking hate you tho Signed-off-by: crecher <crecher@crecher.net>
Diffstat (limited to 'main.go')
-rw-r--r--main.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/main.go b/main.go
index 272b100..698bafa 100644
--- a/main.go
+++ b/main.go
@@ -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)
}