// Init load user configuration if needed and initialise applet. // func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) { // Uptoshare settings. app.up.SetHistoryFile(app.FileDataDir(cdglobal.DirUserAppData, uptoshare.HistoryFile)) app.up.SetHistorySize(app.conf.UploadHistory) app.up.LimitRate = app.conf.UploadRateLimit app.up.PostAnonymous = app.conf.PostAnonymous app.up.FileForAll = app.conf.FileForAll app.up.SiteFile(app.conf.SiteFile) app.up.SiteImage(app.conf.SiteImage) app.up.SiteText(app.conf.SiteText) app.up.SiteVideo(app.conf.SiteVideo) // Video download settings. app.video.SetConfig(&app.conf.Config) app.video.SetEnabledWeb(videodl.WebState(app.conf.EnabledWeb)) // Settings for poller and IOActivity (force renderer reset in case of reload). app.service.Settings(uint64(app.conf.UpdateDelay.Value()), app.conf.DisplayText, app.conf.DisplayValues, app.conf.GraphType, app.conf.GaugeName, app.conf.Devices...) // Defaults. def.PollerInterval = app.conf.UpdateDelay.Value() def.Commands = cdtype.Commands{ cmdLeft: cdtype.NewCommandStd(app.conf.LeftAction, app.conf.LeftCommand, app.conf.LeftClass), cmdMiddle: cdtype.NewCommandStd(app.conf.MiddleAction, app.conf.MiddleCommand), } }
// Init load user configuration if needed and initialise applet. // func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) { // Reset data to be sure our display will be refreshed. app.data.Clear() app.data.LoadLogin(app.FileDataDir(loginLocation)) app.err = nil // Define the mail client action. if app.conf.MailClientName == "" { // Set default to webpage if not provided. app.conf.MailClientAction = MailClientLocation app.conf.MailClientName = app.conf.DefaultMonitorName } // Defaults. def.Label = "Mail unchecked" def.PollerInterval = app.conf.UpdateDelay.Value() // Add 1 to action as we don't provide the none option. cmd := cdtype.NewCommandStd(app.conf.MailClientAction+1, app.conf.MailClientName, app.conf.MailClientClass) def.Commands = cdtype.Commands{cmdMailClient: cmd} // Create the renderer. switch app.conf.Renderer { case QuickInfo: app.render = NewRenderedQuick(app) case EmblemSmall, EmblemLarge: var e error app.render, e = NewRenderedSVG(app, app.conf.Renderer) app.Log().Err(e, "renderer svg") default: // NoDisplay case, but using default to be sure we have a valid renderer. app.render = NewRenderedNone() } }
// 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) }
// Init load user configuration if needed and initialise applet. // func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) { // Settings for poller and renderer. app.service.Settings(app.conf.DisplayText, app.conf.DisplayValues, app.conf.GraphType, app.conf.GaugeName) app.service.SetSize(1) app.service.interval = app.conf.UpdateDelay.Value() // Defaults. def.PollerInterval = app.conf.UpdateDelay.Value() def.Commands[cmdLeft] = cdtype.NewCommandStd(app.conf.LeftAction, app.conf.LeftCommand, app.conf.LeftClass) def.Commands[cmdMiddle] = cdtype.NewCommandStd(app.conf.MiddleAction, app.conf.MiddleCommand) }
// Init load user configuration if needed and initialise applet. // func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) { // Settings for poller and IOActivity (force renderer reset in case of reload). app.service.Settings(uint64(app.conf.UpdateDelay.Value()), cdtype.InfoPosition(app.conf.DisplayText), app.conf.DisplayValues, app.conf.GraphType, app.conf.GaugeName, app.conf.Disks...) // Defaults. def.PollerInterval = app.conf.UpdateDelay.Value() def.Commands = cdtype.Commands{ cmdLeft: cdtype.NewCommandStd(app.conf.LeftAction, app.conf.LeftCommand, app.conf.LeftClass), cmdMiddle: cdtype.NewCommandStd(app.conf.MiddleAction, app.conf.MiddleCommand), } }
// Init is called after load config. We'll set the poller interval. // func (app *PollerApplet) Init(def *cdtype.Defaults, confLoaded bool) { // In Init, we'll use the Defaults as it's already provided. def.PollerInterval = app.conf.UpdateInterval.Value() // But you can also set a poller interval directly anytime. app.Poller().SetInterval(app.conf.UpdateInterval.Value()) // Set your other defaults here... // Set your other variable settings here... }
// Init load user configuration if needed and initialise applet. // func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) { // Settings for service. app.service.Settings(app.conf.DisplayText, app.conf.DisplayValues, app.conf.GraphType, app.conf.GaugeName) app.service.SetSize(countTrue(app.conf.ShowRAM, app.conf.ShowSwap)) // Defaults. def.PollerInterval = app.conf.UpdateDelay.Value() def.Commands = cdtype.Commands{ cmdLeft: cdtype.NewCommandStd(app.conf.LeftAction, app.conf.LeftCommand, app.conf.LeftClass), cmdMiddle: cdtype.NewCommandStd(app.conf.MiddleAction, app.conf.MiddleCommand), } }
// Init loads user configuration if needed and initialise applet. // func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) { // Settings for DiskFree. app.service.Settings(app.conf.DisplayText, 0, 0, app.conf.GaugeName) app.service.SetParts(app.conf.Partitions, app.conf.AutoDetect) // Defaults. def.PollerInterval = app.conf.UpdateDelay.Value() def.Commands = cdtype.Commands{ cmdLeft: cdtype.NewCommandStd(app.conf.LeftAction, app.conf.LeftCommand, app.conf.LeftClass), cmdMiddle: cdtype.NewCommandStd(app.conf.MiddleAction, app.conf.MiddleCommand), } }
// Init load user configuration if needed and initialise applet. // func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) { // Defaults. def.PollerInterval = app.conf.UpdateDelay.Value() // Share the conf with the weather service. app.weather.SetConfig(&app.conf.Config) app.weather.Clear() // if app.conf.WeatherTheme == "" { app.conf.WeatherTheme = defaultTheme // } // Set theme full path. app.conf.WeatherTheme = app.ThemePath(app.conf.WeatherTheme) if app.conf.LocationCode == "" { app.DetectLocation() } }