From 1095f6f1e7fd8d89cfad85215fe61b7f86602d76 Mon Sep 17 00:00:00 2001 From: CJ Barrett Date: Mon, 6 Feb 2023 11:08:07 -0500 Subject: [PATCH] Let launcher choose debug icon when running in non-prod (#1014) --- ee/desktop/menu/menu.go | 3 +-- ee/desktop/menu/menu_parse_test.go | 2 +- ee/desktop/menu/menu_systray.go | 9 ++++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ee/desktop/menu/menu.go b/ee/desktop/menu/menu.go index 976c1d2a2..44b9f4c6e 100644 --- a/ee/desktop/menu/menu.go +++ b/ee/desktop/menu/menu.go @@ -14,8 +14,7 @@ import ( type menuIcon string const ( - KolideDesktopIcon = "kolide-desktop" - KolideDebugDesktopIcon = "kolide-debug-desktop" + KolideDesktopIcon = "kolide-desktop" ) // MenuData encapsulates a menu bar icon and accessible menu items diff --git a/ee/desktop/menu/menu_parse_test.go b/ee/desktop/menu/menu_parse_test.go index 8aea07a4c..2766cdd2b 100644 --- a/ee/desktop/menu/menu_parse_test.go +++ b/ee/desktop/menu/menu_parse_test.go @@ -63,7 +63,7 @@ func Test_ParseMenuData(t *testing.T) { { name: "happy path", data: &MenuData{ - Icon: KolideDebugDesktopIcon, + Icon: KolideDesktopIcon, Tooltip: "Kolide", }, }, diff --git a/ee/desktop/menu/menu_systray.go b/ee/desktop/menu/menu_systray.go index 833bdb4d9..fd55f26a0 100644 --- a/ee/desktop/menu/menu_systray.go +++ b/ee/desktop/menu/menu_systray.go @@ -46,9 +46,12 @@ func (m *menu) Build() { func (m *menu) SetIcon(icon menuIcon) { switch icon { case KolideDesktopIcon: - systray.SetTemplateIcon(assets.KolideDesktopIcon, assets.KolideDesktopIcon) - case KolideDebugDesktopIcon: - systray.SetTemplateIcon(assets.KolideDebugDesktopIcon, assets.KolideDebugDesktopIcon) + // Allow launcher to conditionally choose the launcher icon based on whether we're running in production or not + if m.isProd() { + systray.SetTemplateIcon(assets.KolideDesktopIcon, assets.KolideDesktopIcon) + } else { + systray.SetTemplateIcon(assets.KolideDebugDesktopIcon, assets.KolideDebugDesktopIcon) + } default: level.Debug(m.logger).Log( "msg", "invalid icon",