summaryrefslogtreecommitdiff
path: root/bar/bar.go
diff options
context:
space:
mode:
Diffstat (limited to 'bar/bar.go')
-rw-r--r--bar/bar.go36
1 files changed, 34 insertions, 2 deletions
diff --git a/bar/bar.go b/bar/bar.go
index 185a42e..c10732d 100644
--- a/bar/bar.go
+++ b/bar/bar.go
@@ -8,6 +8,7 @@ import (
"hhvn.uk/hbspbar/config"
"hhvn.uk/hbspbar/common"
+ "hhvn.uk/hbspbar/status"
"hhvn.uk/hbspbar/bspc"
"hhvn.uk/hbspbar/drw"
)
@@ -71,7 +72,7 @@ func (b *bar) draw() {
if b.Mon.Focused {
bg = config.Sel
} else {
- bg = config.Bg2
+ bg = config.UnselMon
}
b.drawRect(cx, 0, monw, h, bg, true)
@@ -106,7 +107,34 @@ func (b *bar) draw() {
ax, _ := b.drawText(cx, config.Fg, d.Name)
cx += ax + 2
}
- cx += 5
+
+ status.Mutex.Lock()
+ cx = int(b.Mon.Rectangle.Width) - 6
+ for i := len(status.Status) - 1; i >= 0; i -= 1 {
+ s, ok := status.Status[i]
+ if ok {
+ cx -= s.W
+ cx -= config.StatusPad
+ }
+ }
+ cx += config.StatusPad
+ cx -= 6
+
+ b.drawRect(cx, 0, int(b.Mon.Rectangle.Width) - cx, int(config.H),
+ config.Status, true)
+
+ cx = int(b.Mon.Rectangle.Width) - 6
+ for i := len(status.Status) - 1; i >= 0; i -= 1 {
+ s, ok := status.Status[i]
+ if ok {
+ cx -= s.W
+
+ drw.AddImg(b.i, cx, s.W, s.I)
+
+ cx -= config.StatusPad
+ }
+ }
+ status.Mutex.Unlock()
b.w.Paint(b.i)
@@ -178,6 +206,10 @@ func init() {
Handle.Err <- fmt.Errorf("Couldn't create window: %s\n", err)
return
}
+ case <- status.Updated:
+ for _, b := range bars {
+ go b.draw()
+ }
case state = <- Handle.NewState:
for _, b := range bars {
b.Mon = state.GetMon(b.Mon.ID)