Browse Source

Release panel

master
Remi Reuvekamp 3 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 @@
#go-graphical-widgets

Basically panels written in Go that passes data to dzen, which draws the actual graphical widget.

Directory 'panel' contains a panel which displays the state of different workspaces.
It currently has a dependency on the window manager BSPWM.

Directory 'panel-right' is a work-in-progress mini-panel for showing system information. Actually just time, date, battery and audio level.
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 @@
// Package monitors contains types and methods for parsing monitor layout and
// workspace information from Xrandr and the BSPWM.

// Copyright 2017 Remi Reuvekamp

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package monitors

import (
@@ -72,6 +88,10 @@ func ParseFromXrandr() ([]Monitor, error) {
}

posSize := strings.Split(posSizeStr, "+")
if len(posSize) < 2 {
fmt.Println("Debug: monitor not activated?", split[0])
continue
}

x, err1 := strconv.Atoi(posSize[1])
y, err2 := strconv.Atoi(posSize[2])


+ 7
- 3
panel/main.go View File

@@ -1,4 +1,4 @@
// Copyright 2016 Remi Reuvekamp
// Copyright 2016, 2017 Remi Reuvekamp

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -26,6 +26,8 @@ import (
"git.remi.im/remi/go-graphical-widgets/monitors"
)

// config are the options configurable by command line flags.
// See their usage options (at the start of main).
type config struct {
height *int

@@ -74,14 +76,14 @@ func main() {

align: flag.Int("align", 0, "0, 1, 2 for left, center, right respectively. Can only be used with force-width and force-item-width"),
wsStatusColours: map[monitors.WorkspaceStatus]*string{
monitors.WSOccupiedActive: flag.String("colour-active-occupied-active", "#eeeeee", ""),
monitors.WSOccupiedActive: flag.String("colour-active-occupied-active", "#66cd00", ""),
monitors.WSOccupied: flag.String("colour-active-occupied", "#8b4500", ""),
monitors.WSFreeActive: flag.String("colour-active-free-active", "#aaaaaa", ""),
monitors.WSFree: flag.String("colour-active-free", "#000000", ""),
monitors.WSUrgent: flag.String("colour-active-urgent", "#ffaf00", ""),
},
wsInactiveStatusColours: map[monitors.WorkspaceStatus]*string{
monitors.WSOccupiedActive: flag.String("colour-inactive-occupied-active", "#aaaaaa", ""),
monitors.WSOccupiedActive: flag.String("colour-inactive-occupied-active", "#339900", ""),
monitors.WSOccupied: flag.String("colour-inactive-occupied", "", ""),
monitors.WSFreeActive: flag.String("colour-inactive-free-active", "", ""),
monitors.WSFree: flag.String("colour-inactive-free", "", ""),
@@ -229,6 +231,8 @@ func dzenUpdate(cfg config, mons []monitor) {
}
}

// encapsulateMonitors puts every monitor.Monitor (mons) into the correct monitor (from
// this package, encMons). encMons may be empty, in which is it created.
func encapsulateMonitors(mons []monitors.Monitor, encMons []monitor) []monitor {
encMonsNew := len(encMons) == 0



Loading…
Cancel
Save