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 22using Flow . Launcher . Infrastructure . Hotkey ;
33using Flow . Launcher . Infrastructure . UserSettings ;
44using System ;
5- using System . Windows ;
6- using System . Windows . Media ;
75using System . Windows . Navigation ;
86using CommunityToolkit . Mvvm . Input ;
97using Flow . Launcher . ViewModel ;
8+ using System . IO ;
9+ using System . Windows . Media . Imaging ;
10+ using System . Windows . Media ;
1011
1112namespace Flow . Launcher . Resources . Pages
1213{
@@ -29,5 +30,27 @@ private static void SetTogglingHotkey(HotkeyModel hotkey)
2930 {
3031 HotKeyMapper . SetHotkey ( hotkey , HotKeyMapper . OnToggleHotkey ) ;
3132 }
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+ }
3255 }
3356}
You can’t perform that action at this time.
0 commit comments