Skip to content

Commit

Permalink
improve condition around where the icon disapears from the systray
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJoeFin committed Jun 14, 2024
1 parent 4a1fd97 commit a784e72
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Text-Grab/Controls/NotifyIconWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
IsHitTestVisible="False"
Left="-50"
Opacity="0"
ShowInTaskbar="False"
ShowInTaskbar="True"
ToolTip="Text Grab"
Top="-50"
WindowStyle="ToolWindow"
mc:Ignorable="d">
<Grid>
<WpfUiIcon:NotifyIcon
x:Name="NotifyIcon"
Icon="/Images/TealSelect40.png"
IsVisibleChanged="NotifyIcon_IsVisibleChanged"
LeftClick="NotifyIcon_LeftClick"
ToolTip="Text Grab">
<WpfUiIcon:NotifyIcon.Menu>
Expand Down
7 changes: 7 additions & 0 deletions Text-Grab/Controls/NotifyIconWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ private void NotifyIcon_LeftClick(NotifyIcon sender, RoutedEventArgs e)
private void Window_Activated(object sender, System.EventArgs e)
{
Hide();
NotifyIcon.Visibility = Visibility.Visible;
}

private void EditWindowMenuItem_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -65,4 +66,10 @@ private void SettingsMenuItem_Click(object sender, RoutedEventArgs e)
{
SettingsWindow sw = new(); sw.Show();
}

private void NotifyIcon_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (!NotifyIcon.IsVisible)
NotifyIcon.Visibility = Visibility.Visible;
}
}
1 change: 1 addition & 0 deletions Text-Grab/Pages/GeneralSettings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ private void RunInBackgroundChkBx_Checked(object sender, RoutedEventArgs e)

DefaultSettings.RunInTheBackground = runInBackgroundSwitch.IsChecked is true;
ImplementAppOptions.ImplementBackgroundOption(DefaultSettings.RunInTheBackground);
DefaultSettings.Save();
}

private void SystemThemeRdBtn_Checked(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit a784e72

Please sign in to comment.