Skip to content

Commit

Permalink
fix: do a length check on NotifyIcon text
Browse files Browse the repository at this point in the history
  • Loading branch information
caoyue committed Dec 18, 2023
1 parent d4f1309 commit da97300
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/WindowResizer/TrayContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ private NotifyIcon BuildTrayIcon()

private static string BuildTrayToolTips()
{
return $"{App.Name}\nv{Application.ProductVersion}\nProfile: {ConfigFactory.Current.ProfileName}";
// NotifyIcon text check
const int TipsMaxLength = 60;
var tips = $"{App.Name}\nv{Application.ProductVersion}\nProfile: {ConfigFactory.Current.ProfileName}";
return tips.Length > TipsMaxLength ? tips.Substring(0, TipsMaxLength) + "..." : tips;
}

private static void ToastRegister()
Expand Down

0 comments on commit da97300

Please sign in to comment.