File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed
Flow.Launcher/Resources/Pages Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change 2
2
using Flow . Launcher . Infrastructure . Hotkey ;
3
3
using Flow . Launcher . Infrastructure . UserSettings ;
4
4
using System ;
5
- using System . Windows ;
6
- using System . Windows . Media ;
7
5
using System . Windows . Navigation ;
8
6
using CommunityToolkit . Mvvm . Input ;
9
7
using Flow . Launcher . ViewModel ;
8
+ using System . IO ;
9
+ using System . Windows . Media . Imaging ;
10
+ using System . Windows . Media ;
10
11
11
12
namespace Flow . Launcher . Resources . Pages
12
13
{
@@ -29,5 +30,27 @@ private static void SetTogglingHotkey(HotkeyModel hotkey)
29
30
{
30
31
HotKeyMapper . SetHotkey ( hotkey , HotKeyMapper . OnToggleHotkey ) ;
31
32
}
33
+
34
+ public Brush PreviewBackground
35
+ {
36
+ get
37
+ {
38
+ var wallpaper = WallpaperPathRetrieval . GetWallpaperPath ( ) ;
39
+ if ( wallpaper is not null && File . Exists ( wallpaper ) )
40
+ {
41
+ var memStream = new MemoryStream ( File . ReadAllBytes ( wallpaper ) ) ;
42
+ var bitmap = new BitmapImage ( ) ;
43
+ bitmap . BeginInit ( ) ;
44
+ bitmap . StreamSource = memStream ;
45
+ bitmap . DecodePixelWidth = 800 ;
46
+ bitmap . DecodePixelHeight = 600 ;
47
+ bitmap . EndInit ( ) ;
48
+ return new ImageBrush ( bitmap ) { Stretch = Stretch . UniformToFill } ;
49
+ }
50
+
51
+ var wallpaperColor = WallpaperPathRetrieval . GetWallpaperColor ( ) ;
52
+ return new SolidColorBrush ( wallpaperColor ) ;
53
+ }
54
+ }
32
55
}
33
56
}
You can’t perform that action at this time.
0 commit comments