1515using static Flow . Launcher . Core . Resource . Theme . ParameterTypes ;
1616using System . Runtime . InteropServices ;
1717using System . Windows . Interop ;
18+ using System . Diagnostics ;
1819
1920namespace Flow . Launcher . Core . Resource
2021{
@@ -119,8 +120,9 @@ public void RefreshFrame()
119120
120121 // Remove OS minimizing/maximizing animation
121122 Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_TRANSITIONS_FORCEDISABLED , 3 ) ;
123+
122124 //Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_BORDER_COLOR, 0x00FF0000);
123- Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_SYSTEMBACKDROP_TYPE , 3 ) ;
125+ // Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
124126 SetBlurForWindow ( ) ;
125127 }
126128
@@ -131,53 +133,61 @@ public void RefreshFrame()
131133 /// </summary>
132134 public void SetBlurForWindow ( )
133135 {
136+
134137 //SetWindowAccent();
135138 var dict = GetThemeResourceDictionary ( Settings . Theme ) ;
136139 var windowBorderStyle = dict [ "WindowBorderStyle" ] as Style ;
140+ Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_SYSTEMBACKDROP_TYPE , 3 ) ;
137141 if ( BlurEnabled )
138142 {
143+ //mainWindow.WindowStyle = WindowStyle.SingleBorderWindow;
144+ BlurColor ( BlurMode ( ) ) ;
139145 windowBorderStyle . Setters . Remove ( windowBorderStyle . Setters . OfType < Setter > ( ) . FirstOrDefault ( x => x . Property . Name == "Background" ) ) ;
140146 windowBorderStyle . Setters . Add ( new Setter ( Border . BackgroundProperty , new SolidColorBrush ( Colors . Transparent ) ) ) ;
141- //mainWindow.WindowStyle = WindowStyle.SingleBorderWindow;
142147 Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_SYSTEMBACKDROP_TYPE , 3 ) ;
143- BlurColor ( BlurMode ( ) ) ;
144148 }
145149 else
146150 {
147- mainWindow . WindowStyle = WindowStyle . None ;
148- if ( windowBorderStyle . Setters . OfType < Setter > ( ) . FirstOrDefault ( x => x . Property . Name == "Background" ) != null )
149- {
150- windowBorderStyle . Setters . Add ( windowBorderStyle . Setters . OfType < Setter > ( ) . FirstOrDefault ( x => x . Property . Name == "Background" ) ) ;
151- }
151+ // mainWindow.WindowStyle = WindowStyle.None;
152+ // if (windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background") != null)
153+ // {
154+ // windowBorderStyle.Setters.Add(windowBorderStyle.Setters.OfType<Setter>().FirstOrDefault(x => x.Property.Name == "Background"));
155+ // }
152156 Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_SYSTEMBACKDROP_TYPE , 1 ) ;
153157 }
154158 UpdateResourceDictionary ( dict ) ;
155159 }
156160
157161 public void BlurColor ( string Color )
158162 {
163+
159164 if ( Color == "Light" )
160165 {
166+ //mainWindow.Background = new SolidColorBrush(defaultBGcolor.Value);
161167 Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_USE_IMMERSIVE_DARK_MODE , 0 ) ;
162168 }
163169 else if ( Color == "Dark" )
164170 {
171+ //mainWindow.Background = new SolidColorBrush(darkBGcolor.Value);
165172 Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_USE_IMMERSIVE_DARK_MODE , 1 ) ;
166173 }
167174 else /* Case of "Auto" Blur Type Theme */
168175 {
169176 //if (_isDarkTheme())
170177 //{
178+ // mainWindow.Background = new SolidColorBrush(darkBGcolor.Value);
171179 // Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 1);
172180 //}
173181 //else
174182 //{
183+ // mainWindow.Background = new SolidColorBrush(defaultBGcolor.Value);
175184 // Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, 0);
176185 //}
177- Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_USE_IMMERSIVE_DARK_MODE , 1 ) ;
178- }
186+ //mainWindow.Background = new SolidColorBrush(Colors.Red );
187+ Methods . SetWindowAttribute ( new WindowInteropHelper ( mainWindow ) . Handle , DWMWINDOWATTRIBUTE . DWMWA_USE_IMMERSIVE_DARK_MODE , 1 ) ; }
179188
180189 }
190+
181191 public bool IsBlurTheme ( )
182192 {
183193 if ( Environment . OSVersion . Version >= new Version ( 6 , 2 ) )
@@ -207,6 +217,24 @@ public string BlurMode()
207217 return null ;
208218 }
209219
220+ //public SolidColorBrush BGColor(string colorBgKey)
221+ //{
222+ // var defaultBG = Application.Current.TryFindResource("DefaultBG");
223+ // var darkBG = Application.Current.TryFindResource("DarkBG");
224+
225+ // if (colorBgKey == "")
226+ // {
227+ // var resource = Application.Current.TryFindResource("BlurMode");
228+
229+ // if (resource is string)
230+ // return (SolidColorBrush)resource;
231+
232+ // return new SolidColorBrush(Colors.DarkGray);
233+ // }
234+
235+ // return null;
236+ //}
237+
210238 #endregion
211239
212240 private void MakeSureThemeDirectoriesExist ( )
@@ -252,8 +280,8 @@ public bool ChangeTheme(string theme)
252280 if ( Settings . UseDropShadowEffect && ! BlurEnabled )
253281 AddDropShadowEffectToCurrentTheme ( ) ;
254282
255- Win32Helper . SetBlurForWindow ( Application . Current . MainWindow , BlurEnabled ) ;
256- //Win32Helper.SetMicaForWindow(Application.Current.MainWindow, BlurEnabled );
283+ // Win32Helper.SetBlurForWindow(Application.Current.MainWindow, BlurEnabled);
284+ SetBlurForWindow ( ) ;
257285 }
258286 catch ( DirectoryNotFoundException )
259287 {
0 commit comments