/
config.go
41 lines (35 loc) · 858 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
func allocColor(r, g, b uint16) uint32 {
c, err := conn.AllocColor(screen.DefaultColormap, r, g, b)
if err != nil {
l.Fatalf("Cannot allocate a color (%x,%x,%x): %s", r, g, b, err)
}
return c.Pixel
}
type List []interface{}
func (l List) Contains(e interface{}) bool {
for _, v := range l {
if v == e {
return true
}
}
return false
}
type Config struct {
NormalBorderColor uint32
FocusedBorderColor uint32
BorderWidth uint16
Ignore List
Float List
}
var cfg *Config
func loadConfig() {
l.Print("loadConfig")
cfg = &Config{
NormalBorderColor: allocColor(0xaaaa, 0xaaaa, 0xaaaa),
FocusedBorderColor: allocColor(0xf444, 0x0000, 0x000f),
BorderWidth: 2,
Ignore: List{"Unity-2d-panel", "Unity-2d-launcher"},
Float: List{"Mplayer", "Gimp"},
}
}