// New creates a welcome widget with informations about the program. // func New(source cftype.Source, log cdtype.Logger) cftype.Grouper { const group = "Welcome" title := tran.Slate("Welcome to cairo-dock-rework") header := tran.Slate(`This is a reworked version of cairo-dock, with all the user interface rewritten in Go. It's still under development, but should now be very close to the original version.`) warningSave := `Warning, save configuration is disabled by default. As it shares its files with the original dock, it requires more tests to ensure nothing will be broken. It's better to save your current theme, and check nothing wrong will be changed in your files. Then, you can enable the save option under the "GUI Settings" config tab, at your own risks.` keys := []*cftype.Key{ newkey.TextLabel(group, "title", common.Bold(common.Big(title))), newkey.TextLabel(group, "header", header), newkey.Separator(group, "sep_title"), newkey.TextLabel(group, "warningSave", warningSave), newkey.Separator(group, "sep_warning"), newkey.Link(group, "URLwebsite", "Project website", "github", URLwebsite), newkey.Link(group, "URLdocumentation", "Documentation", "godoc", URLdocumentation), newkey.Link(group, "URLdockInfo", "Cairo-Dock forum related thread", "glx-dock forum", URLdockInfo), } for _, link := range links { str := common.Big(common.Bold(common.URI(link.URL, link.Title))) keys = append(keys, // newkey.Frame(group, "F_"+title, str, link.Icon), newkey.Separator(group, "sep_"+link.Title), newkey.TextLabel(group, "T_"+link.Title, str), newkey.TextLabel(group, "L_"+link.Title, link.Text), ) } build := cfbuild.NewVirtual(source, log, "", "", "") return build.BuildSingle(group, cfbuild.TweakAddGroup(group, keys...)) }
func desktopFileText(apps []string, dir, selected string) string { text := "" for _, v := range apps { // Remove suffix for name and highlight the active one (with link if possible). name := strings.TrimSuffix(v, ".desktop") isCurrent := name == selected if fileExists(filepath.Join(dir, v)) { name = common.URI("file://"+filepath.Join(dir, v), name) } if isCurrent { name = common.Bold(name) } text = strhelp.Separator(text, ", ", name) } return text }