コード例 #1
0
ファイル: workspace.go プロジェクト: jsteele31/wingo
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(),
		layout.NewMaximized(),
	}

	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
}
コード例 #2
0
ファイル: workspace.go プロジェクト: dlintw/wingo
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(),
	}

	return wrk
}