File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,14 @@ namespace Flow.Launcher.Plugin
39
39
/// <param name="sender"></param>
40
40
/// <param name="args"></param>
41
41
public delegate void VisibilityChangedEventHandler ( object sender , VisibilityChangedEventArgs args ) ;
42
-
42
+
43
+ /// <summary>
44
+ /// A delegate for when the actual application theme is changed
45
+ /// </summary>
46
+ /// <param name="sender"></param>
47
+ /// <param name="args"></param>
48
+ public delegate void ActualApplicationThemeChangedEventHandler ( object sender , ActualApplicationThemeChangedEventArgs args ) ;
49
+
43
50
/// <summary>
44
51
/// The event args for <see cref="VisibilityChangedEventHandler"/>
45
52
/// </summary>
@@ -77,4 +84,15 @@ public class FlowLauncherQueryEventArgs
77
84
/// </summary>
78
85
public Query Query { get ; set ; }
79
86
}
87
+
88
+ /// <summary>
89
+ /// The event args for <see cref="ActualApplicationThemeChangedEventHandler"/>
90
+ /// </summary>
91
+ public class ActualApplicationThemeChangedEventArgs : EventArgs
92
+ {
93
+ /// <summary>
94
+ /// <see langword="true"/> if the application has changed actual theme
95
+ /// </summary>
96
+ public bool IsDark { get ; init ; }
97
+ }
80
98
}
Original file line number Diff line number Diff line change 22
22
using Flow . Launcher . Plugin . SharedCommands ;
23
23
using Flow . Launcher . Storage ;
24
24
using Microsoft . VisualStudio . Threading ;
25
+ using ModernWpf ;
25
26
26
27
namespace Flow . Launcher . ViewModel
27
28
{
@@ -195,6 +196,18 @@ public MainViewModel()
195
196
196
197
RegisterViewUpdate ( ) ;
197
198
_ = RegisterClockAndDateUpdateAsync ( ) ;
199
+
200
+ ThemeManager . Current . ActualApplicationThemeChanged += ThemeManager_ActualApplicationThemeChanged ;
201
+ }
202
+
203
+ private void ThemeManager_ActualApplicationThemeChanged ( ThemeManager sender , object args )
204
+ {
205
+ ActualApplicationThemeChanged ? . Invoke (
206
+ Application . Current ,
207
+ new ActualApplicationThemeChangedEventArgs ( )
208
+ {
209
+ IsDark = sender . ActualApplicationTheme == ApplicationTheme . Dark
210
+ } ) ;
198
211
}
199
212
200
213
private void RegisterViewUpdate ( )
@@ -821,6 +834,7 @@ private ResultsViewModel SelectedResults
821
834
public bool MainWindowVisibilityStatus { get ; set ; } = true ;
822
835
823
836
public event VisibilityChangedEventHandler VisibilityChanged ;
837
+ public event ActualApplicationThemeChangedEventHandler ActualApplicationThemeChanged ;
824
838
825
839
public Visibility ClockPanelVisibility { get ; set ; }
826
840
public Visibility SearchIconVisibility { get ; set ; }
@@ -1975,6 +1989,7 @@ protected virtual void Dispose(bool disposing)
1975
1989
{
1976
1990
_resultsViewUpdateTask . Dispose ( ) ;
1977
1991
}
1992
+ ThemeManager . Current . ActualApplicationThemeChanged -= ThemeManager_ActualApplicationThemeChanged ;
1978
1993
_disposed = true ;
1979
1994
}
1980
1995
}
You can’t perform that action at this time.
0 commit comments