Exemplo n.º 1
0
Arquivo: update.go Projeto: sqp/godock
// Init load user configuration if needed and initialise applet.
//
func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) {
	// Defaults.
	def.PollerInterval = app.conf.VersionPollingTimer.Value()
	def.Commands[cmdShowDiff] = cdtype.NewCommand(app.conf.DiffMonitored, app.conf.DiffCommand)

	// Version polling state.
	if app.conf.VersionPollingEnabled {
		app.Poller().Start()
	} else {
		app.Poller().Stop()
	}

	// Branches for versions checking.
	app.version.Clear()
	app.version.AddSources(
		versions.NewRepo(app.Log(), "cairo-dock-core", path.Join(app.conf.SourceDir, app.conf.DirCore)),
		versions.NewRepo(app.Log(), "cairo-dock-plug-ins", path.Join(app.conf.SourceDir, app.conf.DirApplets)),
	)
	for _, src := range app.conf.SourceExtra {
		app.version.AddSources(versions.NewRepo(app.Log(), path.Base(src), src))
	}

	// Build targets. Allow actions on sources and displays emblem on top left for togglable target.
	app.setBuildTarget()

	// Build globals.
	build.CmdSudo = app.conf.CommandSudo
	build.IconMissing = app.FileLocation("img", app.conf.IconMissing)
}
Exemplo n.º 2
0
Arquivo: TVPlay.go Projeto: sqp/godock
// Init load user configuration if needed and initialise applet.
//
func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) {
	// Defaults.
	def.Commands[0] = cdtype.NewCommand(true, "", app.Name()) // Declare monitoring for our GUI.

	// Create the control window if needed.
	if app.conf.WindowVisibility == 0 {
		if app.win != nil {
			app.Window().Close()
		}
	} else {
		app.createGui(true, app.conf.WindowVisibility == 2)
	}
}
Exemplo n.º 3
0
Arquivo: audio.go Projeto: sqp/godock
// Init load user configuration if needed and initialise applet.
//
func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) {
	// Try to get a mixer command.
	if app.conf.MixerCommand == "" {
		app.conf.MixerCommand = findMixer()
	}

	// Defaults
	def.Commands[cmdMixer] = cdtype.NewCommand(app.conf.LeftAction == 1, app.conf.MixerCommand, app.conf.MixerClass)

	// Shortkeys.
	app.conf.MixerShortkey.Call = app.openMixer
	app.conf.ShortkeyAllMute.CallE = app.pulse.ToggleMute
	app.conf.ShortkeyAllIncrease.Call = app.globalVolumeIncrease
	app.conf.ShortkeyAllDecrease.Call = app.globalVolumeDecrease

	// Config pulse.
	app.pulse.StreamIcons = app.conf.StreamIcons
	app.RemoveSubIcons()

	// Volume renderer.
	app.DataRenderer().Remove() // Remove renderer when settings changed to be sure.
	switch app.conf.DisplayValues {
	case 0:
		app.DataRenderer().Progress(1)

	case 1:
		app.DataRenderer().Gauge(1, app.conf.GaugeName)
	}

	// Text renderer.
	switch app.conf.DisplayText {
	case 0:
		app.pulse.showText = func(string) error { return nil }
	case 1:
		app.pulse.showText = app.SetQuickInfo
	case 2:
		app.pulse.showText = app.SetLabel
	}

	// Find sound card and display current volume, and maybe show subicons.
	e := app.pulse.Init()
	app.Log().Err(e, "pulseaudio init")
}