1- #include " tray_icon.h"
1+ #include " tray_icon.h"
22#include " file_watcher.h"
33#include " wakatime_client.h"
4+ #include " windows_dark_mode.h"
45
56#include < wincodec.h>
67#include < comdef.h>
@@ -101,6 +102,8 @@ bool TrayIcon::CreateHiddenWindow()
101102 return false ;
102103 }
103104
105+ WindowsDarkMode::ApplyToWindow (hwnd);
106+
104107 std::cout << " [TrayIcon] Hidden window created" << std::endl;
105108 return true ;
106109}
@@ -317,17 +320,12 @@ HMENU TrayIcon::CreateContextMenu()
317320 const HMENU menu = CreatePopupMenu ();
318321
319322 HMENU statusSubMenu = CreateStatusSubMenu ();
320- AppendMenuW (menu, MF_STRING | MF_POPUP , (UINT_PTR ) statusSubMenu, L" 📊 Status" );
323+ AppendMenuW (menu, MF_STRING | MF_POPUP , (UINT_PTR ) statusSubMenu, L" Status" );
321324 AppendMenuW (menu, MF_SEPARATOR , 0 , nullptr );
322325
323326 AppendMenuW (menu, MF_STRING , IDM_TOGGLE_MONITORING , L" Pause Monitoring" );
324- AppendMenuW (menu, MF_SEPARATOR , 0 , nullptr );
325-
326- AppendMenuW (menu, MF_STRING , IDM_OPEN_DASHBOARD , L" Open WakaTime Dashboard" );
327- AppendMenuW (menu, MF_STRING , IDM_SETTINGS , L" 🔑 Setup API Key" );
328- AppendMenuW (menu, MF_SEPARATOR , 0 , nullptr );
329-
330- AppendMenuW (menu, MF_STRING , IDM_GITHUB , L" ℹ️ Unity WakaTime v1.0.2" );
327+ AppendMenuW (menu, MF_STRING , IDM_OPEN_DASHBOARD , L" Open Dashboard" );
328+ AppendMenuW (menu, MF_STRING , IDM_SETTINGS , L" Setup API Key" );
331329 AppendMenuW (menu, MF_SEPARATOR , 0 , nullptr );
332330
333331 AppendMenuW (menu, MF_STRING , IDM_EXIT , L" Exit" );
@@ -340,96 +338,37 @@ HMENU TrayIcon::CreateStatusSubMenu()
340338{
341339 const HMENU subMenu = CreatePopupMenu ();
342340
343- // === API Key 상태 ===
344- if (Globals::GetWakaTimeClient ())
345- {
346- std::string maskedKey = Globals::GetWakaTimeClient ()->GetMaskedApiKey ();
347- const std::wstring apiKeyInfo = L" 🔑 API Key: " + std::wstring (maskedKey.begin (), maskedKey.end ());
348- AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , apiKeyInfo.c_str ());
349- }
350- else
351- {
352- AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , L" 🔑 API Key: Not configured" );
353- }
354-
355- AppendMenuW (subMenu, MF_SEPARATOR , 0 , nullptr );
356-
357- // === 모니터링 상태 ===
358- const std::wstring monitoringStatus = isMonitoring ? L" ✅ Monitoring: Active" : L" ⏸️ Monitoring: Paused" ;
341+ // Monitoring state
342+ const std::wstring monitoringStatus = isMonitoring ? L" Monitoring: Active" : L" Monitoring: Paused" ;
359343 AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , monitoringStatus.c_str ());
360344
361- // === 현재 프로젝트 ===
345+ // Current project
362346 if (!currentProject.empty ())
363347 {
364- const std::wstring projectInfo = L" 🎮 Current: " + std::wstring (currentProject.begin (), currentProject.end ());
348+ const std::wstring projectInfo = L" Current Project : " + std::wstring (currentProject.begin (), currentProject.end ());
365349 AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , projectInfo.c_str ());
366350 } else
367351 {
368- AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , L" 🎮 No Unity project detected" );
352+ AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , L" No Unity project detected" );
369353 }
370354
371- // === Heartbeat 통계 ===
372- const std::wstring heartbeatInfo = L" 💓 Total Heartbeats: " + std::to_wstring (totalHeartbeats);
373- AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , heartbeatInfo.c_str ());
374- AppendMenuW (subMenu, MF_SEPARATOR , 0 , nullptr );
375-
376- // === WakaTime 통계 ===
377- if (Globals::GetWakaTimeClient ())
355+ // Heartbeat summary
356+ int sent = 0 ;
357+ int failed = 0 ;
358+ if (const auto *client = Globals::GetWakaTimeClient ())
378359 {
379- int sent, failed;
380- Globals::GetWakaTimeClient ()->GetStats (sent, failed);
381-
382- const std::wstring sentInfo = L" 📤 Sent: " + std::to_wstring (sent);
383- const std::wstring failedInfo = L" ❌ Failed: " + std::to_wstring (failed);
384-
385- AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , sentInfo.c_str ());
386- if (failed > 0 )
387- {
388- AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , failedInfo.c_str ());
389- }
390-
391- // 성공률 계산
392- if (sent + failed > 0 )
393- {
394- const int successRate = (sent * 100 ) / (sent + failed);
395- const std::wstring rateInfo = L" 📊 Success Rate: " + std::to_wstring (successRate) + L" %" ;
396- AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , rateInfo.c_str ());
397- }
360+ client->GetStats (sent, failed);
398361 }
399- else
400- {
401- AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , L" ⚠️ WakaTime client not initialized" );
402- }
403-
404- AppendMenuW (subMenu, MF_SEPARATOR , 0 , nullptr );
405362
406- // === 파일 감시 상태 ===
407- if (Globals::GetFileWatcher ())
408- {
409- const size_t watchedCount = Globals::GetFileWatcher ()->GetWatchedProjectCount ();
410- const std::wstring watchInfo = L" 👁️ Watching: " + std::to_wstring (watchedCount) + L" projects" ;
411- AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , watchInfo.c_str ());
412-
413- // 감시 중인 프로젝트 목록 (최대 3개)
414- const auto & watchedProjects = Globals::GetFileWatcher ()->GetWatchedProjects ();
415- for (size_t i = 0 ; i < std::min ((size_t ) 3 , watchedProjects.size ()); i++)
416- {
417- const auto & projectName = watchedProjects[i].projectName ;
418- std::wstring projectItem = L" 📁 " + std::wstring (projectName.begin (), projectName.end ());
419- AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , projectItem.c_str ());
420- }
421-
422- if (watchedProjects.size () > 3 )
423- {
424- const std::wstring moreInfo = L" ... and " + std::to_wstring (watchedProjects.size () - 3 ) + L" more" ;
425- AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , moreInfo.c_str ());
426- }
427- }
363+ std::wstring heartbeatInfo = L" Heartbeats: " + std::to_wstring (totalHeartbeats) +
364+ L" (Sent: " + std::to_wstring (sent) +
365+ L" , Failed: " + std::to_wstring (failed) + L" )" ;
366+ AppendMenuW (subMenu, MF_STRING | MF_GRAYED , 0 , heartbeatInfo.c_str ());
428367
429368 AppendMenuW (subMenu, MF_SEPARATOR , 0 , nullptr );
430369
431- // === 액션 항목들 ===
432- AppendMenuW (subMenu, MF_STRING , IDM_SHOW_STATUS , L" 🔄 Refresh Status" );
370+ // Actions
371+ AppendMenuW (subMenu, MF_STRING , IDM_SHOW_STATUS , L" Refresh Status" );
433372
434373 return subMenu;
435374}
@@ -449,7 +388,7 @@ void TrayIcon::UpdateContextMenu()
449388 // 새로운 서브메뉴 생성 및 삽입
450389 HMENU newStatusSubMenu = CreateStatusSubMenu ();
451390 InsertMenuW (hMenu, 0 , MF_BYPOSITION | MF_STRING | MF_POPUP ,
452- (UINT_PTR )newStatusSubMenu, L" 📊 Status" );
391+ (UINT_PTR )newStatusSubMenu, L" Status" );
453392}
454393
455394void TrayIcon::OpenGitHubRepository () {
@@ -598,7 +537,7 @@ std::string TrayIcon::ShowApiKeyInputDialog()
598537
599538 const std::wstring wMessage (message.begin (), message.end ());
600539
601- if (const int result = MessageBoxW (hwnd, wMessage.c_str (), L" 🔑 WakaTime API Key Setup" ,
540+ if (const int result = MessageBoxW (hwnd, wMessage.c_str (), L" WakaTime API Key Setup" ,
602541 MB_OKCANCEL | MB_ICONINFORMATION | MB_TOPMOST ); result == IDOK )
603542 {
604543 if (const std::string clipboardText = GetClipboardText (); !clipboardText.empty ())
@@ -607,13 +546,13 @@ std::string TrayIcon::ShowApiKeyInputDialog()
607546 }
608547 else
609548 {
610- std::wstring retryMessage = L" ❌ No valid API key found in clipboard! \n\n " ;
549+ std::wstring retryMessage = L" No valid API key found in clipboard. \n\n " ;
611550 retryMessage += L" Please:\n " ;
612551 retryMessage += L" 1. Go to the opened WakaTime page\n " ;
613552 retryMessage += L" 2. Copy your API key\n " ;
614553 retryMessage += L" 3. Try again from the tray menu\n\n " ;
615554
616- MessageBoxW (hwnd, retryMessage.c_str (), L" ⚠️ API Key Not Found" ,
555+ MessageBoxW (hwnd, retryMessage.c_str (), L" API Key Not Found" ,
617556 MB_OK | MB_ICONWARNING | MB_TOPMOST );
618557 }
619558 }
0 commit comments