Browse Source

Release panel

Remi Reuvekamp 2 years ago
parent
commit
2cd17c7539
3 changed files with 36 additions and 3 deletions
  1. 9
    0
      README
  2. 20
    0
      monitors/monitors.go
  3. 7
    3
      panel/main.go

+ 9
- 0
README View File

@@ -0,0 +1,9 @@
1
+#go-graphical-widgets
2
+
3
+Basically panels written in Go that passes data to dzen, which draws the actual graphical widget.
4
+
5
+Directory 'panel' contains a panel which displays the state of different workspaces.
6
+It currently has a dependency on the window manager BSPWM.
7
+
8
+Directory 'panel-right' is a work-in-progress mini-panel for showing system information. Actually just time, date, battery and audio level.
9
+It's not finished and will most likely be rewritten as I'm not happy with the approach I took developing it.

+ 20
- 0
monitors/monitors.go View File

@@ -1,5 +1,21 @@
1 1
 // Package monitors contains types and methods for parsing monitor layout and
2 2
 // workspace information from Xrandr and the BSPWM.
3
+
4
+// Copyright 2017 Remi Reuvekamp
5
+
6
+// This program is free software: you can redistribute it and/or modify
7
+// it under the terms of the GNU General Public License as published by
8
+// the Free Software Foundation, either version 3 of the License, or
9
+// (at your option) any later version.
10
+//
11
+// This program is distributed in the hope that it will be useful,
12
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+// GNU General Public License for more details.
15
+//
16
+// You should have received a copy of the GNU General Public License
17
+// along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
+
3 19
 package monitors
4 20
 
5 21
 import (
@@ -72,6 +88,10 @@ func ParseFromXrandr() ([]Monitor, error) {
72 88
 		}
73 89
 
74 90
 		posSize := strings.Split(posSizeStr, "+")
91
+		if len(posSize) < 2 {
92
+			fmt.Println("Debug: monitor not activated?", split[0])
93
+			continue
94
+		}
75 95
 
76 96
 		x, err1 := strconv.Atoi(posSize[1])
77 97
 		y, err2 := strconv.Atoi(posSize[2])

+ 7
- 3
panel/main.go View File

@@ -1,4 +1,4 @@
1
-// Copyright 2016 Remi Reuvekamp
1
+// Copyright 2016, 2017 Remi Reuvekamp
2 2
 
3 3
 // This program is free software: you can redistribute it and/or modify
4 4
 // it under the terms of the GNU General Public License as published by
@@ -26,6 +26,8 @@ import (
26 26
 	"git.remi.im/remi/go-graphical-widgets/monitors"
27 27
 )
28 28
 
29
+// config are the options configurable by command line flags.
30
+// See their usage options (at the start of main).
29 31
 type config struct {
30 32
 	height *int
31 33
 
@@ -74,14 +76,14 @@ func main() {
74 76
 
75 77
 		align: flag.Int("align", 0, "0, 1, 2 for left, center, right respectively. Can only be used with force-width and force-item-width"),
76 78
 		wsStatusColours: map[monitors.WorkspaceStatus]*string{
77
-			monitors.WSOccupiedActive: flag.String("colour-active-occupied-active", "#eeeeee", ""),
79
+			monitors.WSOccupiedActive: flag.String("colour-active-occupied-active", "#66cd00", ""),
78 80
 			monitors.WSOccupied:       flag.String("colour-active-occupied", "#8b4500", ""),
79 81
 			monitors.WSFreeActive:     flag.String("colour-active-free-active", "#aaaaaa", ""),
80 82
 			monitors.WSFree:           flag.String("colour-active-free", "#000000", ""),
81 83
 			monitors.WSUrgent:         flag.String("colour-active-urgent", "#ffaf00", ""),
82 84
 		},
83 85
 		wsInactiveStatusColours: map[monitors.WorkspaceStatus]*string{
84
-			monitors.WSOccupiedActive: flag.String("colour-inactive-occupied-active", "#aaaaaa", ""),
86
+			monitors.WSOccupiedActive: flag.String("colour-inactive-occupied-active", "#339900", ""),
85 87
 			monitors.WSOccupied:       flag.String("colour-inactive-occupied", "", ""),
86 88
 			monitors.WSFreeActive:     flag.String("colour-inactive-free-active", "", ""),
87 89
 			monitors.WSFree:           flag.String("colour-inactive-free", "", ""),
@@ -229,6 +231,8 @@ func dzenUpdate(cfg config, mons []monitor) {
229 231
 	}
230 232
 }
231 233
 
234
+// encapsulateMonitors puts every monitor.Monitor (mons) into the correct monitor (from
235
+// this package, encMons). encMons may be empty, in which is it created.
232 236
 func encapsulateMonitors(mons []monitors.Monitor, encMons []monitor) []monitor {
233 237
 	encMonsNew := len(encMons) == 0
234 238
 

Loading…
Cancel
Save