diff --git a/ShareX/Forms/ScreenRecordForm.cs b/ShareX/Forms/ScreenRecordForm.cs index 4a5986255..d95f9ed43 100644 --- a/ShareX/Forms/ScreenRecordForm.cs +++ b/ShareX/Forms/ScreenRecordForm.cs @@ -52,6 +52,7 @@ public partial class ScreenRecordForm : Form private Rectangle borderRectangle0Based; private bool activateWindow; private float duration; + private static int lastIconStatus = -1; public ScreenRecordForm(Rectangle regionRectangle, TaskSettings taskSettings, bool activateWindow = true, float duration = 0) { @@ -306,6 +307,38 @@ public void ChangeState(ScreenRecordState state) public void ChangeStateProgress(int progress) { niTray.Text = $"ShareX - {Resources.ScreenRecordForm_StartRecording_Encoding___} {progress}%"; + + if (niTray.Visible && lastIconStatus != progress) + { + Icon icon; + + if (progress >= 0) + { + try + { + icon = TaskHelpers.GetProgressIcon(progress); + } + catch (Exception e) + { + DebugHelper.WriteException(e); + progress = -1; + if (lastIconStatus == progress) return; + icon = Resources.camcorder_pencil.ToIcon(); + } + } + else + { + icon = Resources.camcorder_pencil.ToIcon(); + } + + using (Icon oldIcon = niTray.Icon) + { + niTray.Icon = icon; + oldIcon.DisposeHandle(); + } + + lastIconStatus = progress; + } } } } \ No newline at end of file