예제 #1
0
파일: state.go 프로젝트: yannicklm/wingo
func Initialize(x *xgbutil.XUtil,
	cmdEnv *gribble.Environment, hacks CommandHacks, configDir string) {

	var err error

	X = x
	Startup = true
	ConfigDir = configDir

	gribbleEnv = cmdEnv
	cmdHacks = hacks

	Root = xwindow.New(X, X.RootWin())
	if _, err = Root.Geometry(); err != nil {
		logger.Error.Fatalf("Could not get ROOT window geometry: %s", err)
	}

	if Config, err = loadConfig(); err != nil {
		logger.Error.Fatalf("Could not load configuration: %s", err)
	}
	if Theme, err = loadTheme(); err != nil {
		logger.Error.Fatalf("Could not load theme: %s", err)
	}

	Clients = make(ClientList, 0, 50)
	Prompts = newPrompts()

	Heads = heads.NewHeads(X, Config.DefaultLayout)

	// If _NET_DESKTOP_NAMES is set, let's use workspaces from that instead.
	if names, _ := ewmh.DesktopNamesGet(X); len(names) > 0 {
		for _, wrkName := range names {
			if err := AddWorkspace(wrkName); err != nil {
				logger.Warning.Printf("Could not add workspace %s: %s",
					wrkName, err)
			}
		}
	} else {
		for _, wrkName := range Config.Workspaces {
			if err := AddWorkspace(wrkName); err != nil {
				logger.Error.Fatalf("Could not initialize workspaces: %s", err)
			}
		}
	}
	Heads.Initialize(Clients)

	keybindings()
	rootMouseSetup()

	StickyWrk = Heads.Workspaces.NewSticky()

	err = shape.Init(X.Conn())
	if err != nil {
		ShapeExt = false
		logger.Warning.Printf("The X SHAPE extension could not be loaded. " +
			"Google Chrome might look ugly.")
	} else {
		ShapeExt = true
	}

	Restart = false

	ewmhClientList()
	ewmhNumberOfDesktops()
	ewmhCurrentDesktop()
	ewmhVisibleDesktops()
	ewmhDesktopNames()
	ewmhDesktopGeometry()
}
예제 #2
0
파일: state.go 프로젝트: dlintw/wingo
func (wingo *wingoState) initializeHeads() {
	wingo.heads = heads.NewHeads(X, wingo.clients, "Numero Uno")
}