Example #1
0
func newPrompts() AllPrompts {
	cycleConfig := prompt.CycleConfig{
		Grab:       true,
		CancelKey:  Config.CancelKey,
		ConfirmKey: Config.ConfirmKey,
	}
	selectConfig := prompt.SelectConfig{
		CancelKey:    Config.CancelKey,
		BackspaceKey: Config.BackspaceKey,
		ConfirmKey:   Config.ConfirmKey,
		TabKey:       Config.TabKey,
	}
	inputConfig := prompt.InputConfig{
		CancelKey:    Config.CancelKey,
		BackspaceKey: Config.BackspaceKey,
		ConfirmKey:   Config.ConfirmKey,
	}
	msgConfig := prompt.MessageConfig{
		CancelKey:  Config.CancelKey,
		ConfirmKey: Config.ConfirmKey,
	}
	ps := AllPrompts{
		Cycle:   prompt.NewCycle(X, Theme.Prompt.CycleTheme(), cycleConfig),
		Slct:    prompt.NewSelect(X, Theme.Prompt.SelectTheme(), selectConfig),
		Input:   prompt.NewInput(X, Theme.Prompt.InputTheme(), inputConfig),
		Message: prompt.NewMessage(X, Theme.Prompt.MessageTheme(), msgConfig),
	}
	ps.slctVisible = ps.Slct.AddGroup(ps.Slct.NewStaticGroup("Visible"))
	ps.slctHidden = ps.Slct.AddGroup(ps.Slct.NewStaticGroup("Hidden"))
	return ps
}
Example #2
0
func main() {
	X, err := xgbutil.NewConn()
	fatal(err)

	keybind.Initialize(X)

	cycle := prompt.NewCycle(X,
		prompt.DefaultCycleTheme, prompt.DefaultCycleConfig)

	clients, err := ewmh.ClientListStackingGet(X)
	fatal(err)
	items := make([]*prompt.CycleItem, 0)
	for i := len(clients) - 1; i >= 0; i-- {
		item := cycle.AddChoice(newWindow(X, cycle.Id(), clients[i]))
		items = append(items, item)
	}

	keyHandlers(X, cycle, items)

	println("Loaded...")
	xevent.Main(X)
}