Skip to content
This repository has been archived by the owner on Jun 20, 2021. It is now read-only.

Commit

Permalink
Always launch Thunderbird minimised if this application is the one la…
Browse files Browse the repository at this point in the history
…unching.
  • Loading branch information
TheGuardianWolf committed Feb 16, 2020
1 parent 4e92644 commit 7f47ca5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.4.0")]
[assembly: AssemblyFileVersion("1.3.4.0")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
13 changes: 12 additions & 1 deletion lib/TrayBird.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public partial class TrayBird : ApplicationContext
private bool thunderbirdShown = true;
private WindowVisualState lastVisualState = WindowVisualState.Minimized;
private AutomationElement thunderbirdAutomationElement;
private bool trayLaunched = false; // Was Thunderbird last launched with TrayBird?

private User32.ShowWindowType restoreState
{
get
Expand Down Expand Up @@ -200,6 +202,7 @@ public void StartThunderbird()
)
{
log.Information("Starting Thunderbird...");
trayLaunched = true;
process.Start();
}
}
Expand Down Expand Up @@ -282,7 +285,15 @@ private bool HookThunderbird()

// If not already hidden and is currently minimised, hide immediately
var isIconic = User32.IsIconic(thunderbirdMainWindowHandle);
if (thunderbirdShown && isIconic)

if (trayLaunched)
{
log.Information("Thunderbird launched with tray application, hiding now. {@thunderbirdShown}.", thunderbirdShown);
lastVisualState = (WindowVisualState)thunderbirdAutomationElement.GetCurrentPropertyValue(WindowPattern.WindowVisualStateProperty);
HideThunderbird();

}
if ((thunderbirdShown && isIconic) || trayLaunched)
{
log.Information("Thunderbird is already minimised, hiding now. {@thunderbirdShown}, {@isIconic}.", thunderbirdShown, isIconic);
HideThunderbird();
Expand Down
2 changes: 1 addition & 1 deletion netcore/ThunderbirdTray.NETCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>icon.ico</ApplicationIcon>
<Platforms>AnyCPU;x64;x86</Platforms>
<Version>1.3.4</Version>
<Version>1.4.0</Version>
<RootNamespace>ThunderbirdTray</RootNamespace>
<AssemblyName>ThunderbirdTray</AssemblyName>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions netframework/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.4.0")]
[assembly: AssemblyFileVersion("1.3.4.0")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]

0 comments on commit 7f47ca5

Please sign in to comment.