diff --git a/Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs b/Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs index 7dfb85a8303..004e4d6d20f 100644 --- a/Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs +++ b/Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs @@ -2,11 +2,12 @@ using Flow.Launcher.Infrastructure.Hotkey; using Flow.Launcher.Infrastructure.UserSettings; using System; -using System.Windows; -using System.Windows.Media; using System.Windows.Navigation; using CommunityToolkit.Mvvm.Input; using Flow.Launcher.ViewModel; +using System.IO; +using System.Windows.Media.Imaging; +using System.Windows.Media; namespace Flow.Launcher.Resources.Pages { @@ -29,5 +30,27 @@ private static void SetTogglingHotkey(HotkeyModel hotkey) { HotKeyMapper.SetHotkey(hotkey, HotKeyMapper.OnToggleHotkey); } + + public Brush PreviewBackground + { + get + { + var wallpaper = WallpaperPathRetrieval.GetWallpaperPath(); + if (wallpaper is not null && File.Exists(wallpaper)) + { + var memStream = new MemoryStream(File.ReadAllBytes(wallpaper)); + var bitmap = new BitmapImage(); + bitmap.BeginInit(); + bitmap.StreamSource = memStream; + bitmap.DecodePixelWidth = 800; + bitmap.DecodePixelHeight = 600; + bitmap.EndInit(); + return new ImageBrush(bitmap) { Stretch = Stretch.UniformToFill }; + } + + var wallpaperColor = WallpaperPathRetrieval.GetWallpaperColor(); + return new SolidColorBrush(wallpaperColor); + } + } } }