-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathconfig.go
112 lines (98 loc) · 3.02 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package main
import (
"github.com/ziutek/mdtwm/xgb_patched"
"os"
"path/filepath"
)
type Config struct {
Instance string
Class string
NormalBorderColor uint32
FocusedBorderColor uint32
BorderWidth int16
StatusLogger StatusLogger
DefaultCursor xgb.Id
MoveCursor xgb.Id
MultiClickTime xgb.Timestamp
MovedClickRadius int16
ResizeBorderWidth int16
ModMask uint16
Keys map[xgb.Keysym]Cmd
Ignore TextList
Float TextList
}
func configure() {
// Default configuration
cfg = &Config{
Instance: filepath.Base(os.Args[0]),
Class: "MDtwm",
NormalBorderColor: rgbColor(0x8888, 0x8888, 0x8888),
//FocusedBorderColor: rgbColor(0x4444, 0x0000, 0xffff),
FocusedBorderColor: rgbColor(0xffff, 0x9999, 0x0000),
BorderWidth: 1,
StatusLogger: &Dzen2Logger{
Writer: os.Stdout,
FgColor: "#ddddcc",
BgColor: "#555588",
BatPath: "/sys/class/power_supply/BAT0",
TimeFormat: "Mon, Jan _2 15:04:05",
InfoPos: -332, // Negatife value means pixels from right border
},
DefaultCursor: stdCursor(68),
MoveCursor: stdCursor(52),
MultiClickTime: 300, // maximum interval for multiclick [ms]
MovedClickRadius: 5, // minimal radius for moved click [pixel]
ResizeBorderWidth: 6, // width of imaginary resize border [pixel]
ModMask: xgb.ModMask4,
Keys: map[xgb.Keysym]Cmd{
Key1: {chDesk, 0},
Key2: {chDesk, 1},
Key3: {chDesk, 2},
KeyLeft: {prevDesk, nil},
KeyRight: {nextDesk, nil},
KeyReturn: {spawn, "x-terminal-emulator"},
KeyEscape: {exit, 0},
KeyA: {spawn, "x-text-editor"},
KeyC: {closeCurrentWindow, nil},
KeyE: {spawn, "x-email-client"},
KeyW: {spawn, "x-www-browser"},
KeyF11: {spawn, "systemctl -i suspend"},
KeyF12: {spawn, "systemctl -i hibernate"},
},
Ignore: TextList{},
Float: TextList{"MPlayer", "QEMU", "mpv"},
}
// Read configuration from file
//cfg.Load(filepath.Join(os.Getenv("HOME"), ".mdtwm"))
// Layout
root = NewRootPanel()
// Setup all desks
desk0 := NewPanel(Horizontal, 486, 1)
desk1 := NewPanel(Horizontal, 486, 1)
desk2 := NewPanel(Horizontal, 0, 1)
root.Append(desk0)
root.Append(desk1)
root.Append(desk2)
// Setup two main vertical panels on first desk
left := NewPanel(Vertical, 0, 1)
right := NewPanel(Vertical, 0, 0.3)
desk0.Append(left)
desk0.Append(right)
// Divide right panel into two horizontal panels
right.Append(NewPanel(Horizontal, 484, 1))
right.Append(NewPanel(Horizontal, 0, 1))
// Setup two panels on second desk
desk1.Append(NewPanel(Vertical, 0, 1.03))
desk1.Append(NewPanel(Vertical, 0, 0.3))
// Setup one horizontal panel on thrid desk
desk2.Append(NewPanel(Horizontal, 0, 1))
// Set current desk and current box
setCurrentDesk(0)
// In this box all existing windows will be placed
currentBox = currentDesk.Children().Front()
// Some operation on configuration
cfg.MovedClickRadius *= cfg.MovedClickRadius // We need square of radius
if cfg.StatusLogger != nil {
cfg.StatusLogger.Start()
}
}