func (c *Client) setupChannels(funcs ...func()) {
	for _, f := range funcs {
		go func(f func()) {
			defer c.CapturePanic()
			f()
		}(f)
	}
}
setupChannels runs the channel watcher loops in go routines with a panic catcher.
package client
import (
	"fmt"
	"os"
	"reflect"
	"strings"
	"github.com/Notifiarr/notifiarr/pkg/bindata"
	"github.com/Notifiarr/notifiarr/pkg/mnd"
	"github.com/Notifiarr/notifiarr/pkg/notifiarr"
	"github.com/Notifiarr/notifiarr/pkg/ui"
	"github.com/getlantern/systray"
	"golift.io/version"
)
func (c *Client) startTray() {
	systray.Run(func() {
		defer os.Exit(0)
		defer c.CapturePanic()
		b, _ := bindata.Asset(ui.SystrayIcon)
		systray.SetTemplateIcon(b, b)
		systray.SetTooltip(c.Flags.Name() + " v" + version.Version)
		c.makeChannels()  
		c.makeMoreChannels()
		c.setupChannels(c.watchKillerChannels, c.watchNotifiarrMenu, c.watchLogsChannels,
			c.watchConfigChannels, c.watchGuiChannels, c.watchTimerChannels, c.watchTopChannels)
		c.setupMenus()
		if err := c.Exit(); err != nil {
			c.Errorf("Server: %v", err)
			os.Exit(1)  
		}
	}, func() {
		if err := c.exit(); err != nil {
			c.Errorf("Server: %v", err)
			os.Exit(1)  
		}
		os.Exit(0)
	})
}
func (c *Client) setupMenus() {
	if !ui.HasGUI() {
		return
	}
	if c.Config.LogConfig.DebugLog == "" {
		c.menu["debug_logs"].Hide()
		c.menu["debug_logs2"].Hide()
	} else {
		c.menu["debug_logs"].Show()
		c.menu["debug_logs2"].Show()
	}
	if !c.Config.Debug {
		c.menu["debug"].Hide()
		c.menu["debug_logs"].Hide()
		c.menu["debug_logs2"].Hide()
	} else {
		c.menu["debug"].Show()
		c.menu["debug_logs"].Show()
		c.menu["debug_logs2"].Show()
	}
	if c.Config.Services.LogFile == "" {
		c.menu["logs_svcs"].Hide()
	} else {
		c.menu["logs_svcs"].Show()
	}
	if !c.Config.Services.Disabled {
		c.menu["svcs"].Check()
	} else {
		c.menu["svcs"].Uncheck()
	}
	if ci, err := c.website.GetClientInfo(notifiarr.EventStart); err == nil {
		if ci.IsSub() {
			c.menu["sub"].SetTitle("Subscriber \u2764\ufe0f")
			c.menu["sub"].Check()
			c.menu["sub"].Disable()
			c.menu["sub"].SetTooltip("THANK YOU for supporting the project!")
		} else if ci.IsPatron() {
			c.menu["sub"].SetTitle("Patron \U0001f9e1")
			c.menu["sub"].SetTooltip("THANK YOU for supporting the project!")
			c.menu["sub"].Check()
		}
	}
}