package bsp

import (
	"sync"
)

type WM struct {
	Desktops []*Desktop
	Monitors []*Monitor

	mu sync.RWMutex
}

type Desktop struct {
	Name    string
	Monitor *Monitor
}

type Monitor struct {
	Name string
}

func (w *WM) Mutate(fn func() error) {
	w.mu.Lock()
	defer w.mu.Unlock()
	if fn != nil {
		fn()
	}
}

func (w *WM) View(fn func() error) {
	w.mu.RLock()
	defer w.mu.RUnlock()
	if fn != nil {
		fn()
	}
}

func (w *WM) AddDesktop(name string) {

}

func NewWM() *WM {
	w := &WM{}
	return w
}