func createConfigDir(settings *DockSettings) { log.Info("creating configuration directory", globals.DirDockData()) themeName := "Default-Single" if os.Getenv("DESKTOP_SESSION") == "cairo-dock" { // We're using the CD session for the first time themeName = "Default-Panel" settings.sessionWasUsed = true updateHiddenFile("cd session", true) } files.CopyDir(globals.DirShareData(cdglobal.ConfigDirDockThemes, themeName), globals.CurrentThemePath()) }
// ShowItems opens the GUI and displays the given item icon config. // func (gc *Bridge) ShowItems(icon gldi.Icon, container *gldi.Container, moduleInstance *gldi.ModuleInstance, showPage int) { confpath := "" if icon != nil { confpath = icon.ConfigPath() } else if container != nil { // A main dock that is not the first one. Use the dedicated conf file. confpath = globals.CurrentThemePath(container.ToCairoDock().GetDockName() + ".conf") } if confpath == "" { gc.Log.Info("ShowGui unmatched", "icon", icon != nil, "- container", container != nil, "- moduleInstance", moduleInstance != nil, "- page", showPage) } else { gc.Create() if gc.Widget != nil { gc.Widget.SelectIcons(confpath) } } // cairo_dock_items_widget_select_item (ITEMS_WIDGET (pCategory->pCdWidget), pIcon, pContainer, pModuleInstance, iShowPage); }
// ListIcons builds the list of all icons. // func (Data) ListIcons() *datatype.ListIcon { list := datatype.NewListIcon() // Add icons in docks. taskbarSet := false for _, dock := range gldi.GetAllAvailableDocks(nil, nil) { // for _, dock := range gldi.ListDocksRoot() { var found []datatype.Iconer for _, icon := range dock.Icons() { if dock.GetRefCount() == 0 { // Maindocks. // Group taskbar icons and separators. if icon.ConfigPath() == "" || icon.IsSeparatorAuto() { // if icon.IsTaskbar() || icon.IsSeparatorAuto() { if !taskbarSet { taskbarSet = true ic := datatype.NewIconSimple( globals.ConfigFile(), datatype.FieldTaskBar, datatype.TitleTaskBar, globals.DirShareData("icons/icon-taskbar.png")) ic.Taskbar = true found = append(found, ic) } } else { found = append(found, &IconConf{icon}) } } else { // Subdock. parentName := icon.GetParentDockName() list.Subdocks[parentName] = append(list.Subdocks[parentName], &IconConf{icon}) } } if len(found) > 0 { var file, group string if dock.IsMainDock() { // Only maindocks after the first one have a config file. // So the first maindock use a custom group. group = datatype.KeyMainDock } else { // Other maindocks have a dedicated config file. // So the group is empty to load all of them (auto find). file = globals.CurrentThemePath(dock.GetDockName() + ".conf") } container := datatype.NewIconSimple( file, group, dock.GetReadableName(), "") // TODO: maybe get an icon for the maindock. list.Add(container, found) } } // Add modules in desklets. var desklets []datatype.Iconer for _, desklet := range docklist.Desklet() { icon := desklet.GetIcon() if icon != nil { desklets = append(desklets, &IconConf{icon}) } } if len(desklets) > 0 { container := datatype.NewIconSimple( globals.ConfigFile(), datatype.GroupDesklets, datatype.TitleDesklets, "") // TODO: maybe get an icon for the desklets group. list.Add(container, desklets) } // Add other modules (not in a dock or a desklet) : plug-in or detached applet. // We need to create custom icons for them. var services []datatype.Iconer for _, mod := range docklist.Module() { cat := mod.VisitCard().GetCategory() if cat != gldi.CategoryBehavior && cat != gldi.CategoryTheme && !mod.IsAutoLoaded() { for _, mi := range mod.InstancesList() { if mi.Icon() == nil || (mi.Dock() != nil && mi.Icon().GetContainer() == nil) { icon := datatype.NewIconSimple( mi.GetConfFilePath(), "", // no group, we need all of them for an applet. mod.VisitCard().GetTitle(), mod.VisitCard().GetIconFilePath()) services = append(services, icon) } } } } if len(services) > 0 { container := datatype.NewIconSimple( "", // no config file available. datatype.GroupServices, // so we set a custom group. tran.Slate(datatype.TitleServices), "") // TODO: maybe get an icon for the services group. list.Add(container, services) } return list }