Beispiel #1
0
func (wrks *Workspaces) NewWorkspace(name string) *Workspace {
	wrk := &Workspace{
		X:       wrks.X,
		all:     wrks,
		Name:    name,
		State:   Floating,
		Clients: make([]Client, 0, 40),

		curFloater:   0,
		curAutoTiler: 0,
	}

	// Layouts must be listed in the order in which their corresponding
	// constants are defined in the layout package.
	wrk.floaters = []layout.Floater{
		layout.NewFloating(),
	}
	wrk.autoTilers = []layout.AutoTiler{
		layout.NewVertical(),
		layout.NewHorizontal(),
	}

	if state, index := wrk.findLayout(wrks.defaultLayout); state != -1 {
		switch state {
		case Floating:
			wrk.curFloater = index
			wrk.State = Floating
		case AutoTiling:
			wrk.curAutoTiler = index
			wrk.State = AutoTiling
		default:
			panic(fmt.Sprintf("Unknown layout state '%d'.", state))
		}
	}

	return wrk
}
Beispiel #2
0
func (wrks *Workspaces) NewSticky() *Sticky {
	return &Sticky{wrks.X, layout.NewFloating()}
}