Skip to content

Commit 7e622b7

Browse files
committed
Add BackdropType in setting
1 parent 1345470 commit 7e622b7

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public string Theme
7676
}
7777
public bool UseDropShadowEffect { get; set; } = true;
7878

79+
public BackdropTypes BackdropType{ get; set; } = BackdropTypes.None;
80+
7981
/* Appearance Settings. It should be separated from the setting later.*/
8082
public double WindowHeightSize { get; set; } = 42;
8183
public double ItemHeightSize { get; set; } = 58;
@@ -426,4 +428,12 @@ public enum AnimationSpeeds
426428
Fast,
427429
Custom
428430
}
431+
432+
public enum BackdropTypes
433+
{
434+
None,
435+
Acrylic,
436+
Mica,
437+
MicaAlt
438+
}
429439
}

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
using ModernWpf;
1616
using ThemeManager = Flow.Launcher.Core.Resource.ThemeManager;
1717
using ThemeManagerForColorSchemeSwitch = ModernWpf.ThemeManager;
18+
using static Flow.Launcher.Core.Resource.Theme;
19+
using System.Windows.Interop;
1820

1921
namespace Flow.Launcher.SettingPages.ViewModels;
2022

@@ -177,6 +179,54 @@ public bool UseAnimation
177179
public class AnimationSpeedData : DropdownDataGeneric<AnimationSpeeds> { }
178180
public List<AnimationSpeedData> AnimationSpeeds { get; } = DropdownDataGeneric<AnimationSpeeds>.GetValues<AnimationSpeedData>("AnimationSpeed");
179181

182+
public class BackdropTypeData : DropdownDataGeneric<BackdropTypes>
183+
{
184+
public void ApplyBackdrop()
185+
{
186+
IntPtr hWnd = new WindowInteropHelper(Application.Current.MainWindow).Handle;
187+
if (hWnd == IntPtr.Zero)
188+
return;
189+
190+
int backdropValue = Value switch
191+
{
192+
BackdropTypes.Acrylic => 3, // ✅ Acrylic (DWM_SYSTEMBACKDROP_TYPE = 3)
193+
BackdropTypes.Mica => 2, // ✅ Mica (DWM_SYSTEMBACKDROP_TYPE = 2)
194+
BackdropTypes.MicaAlt => 4, // ✅ MicaAlt (DWM_SYSTEMBACKDROP_TYPE = 4)
195+
_ => 0 // ✅ None (DWM_SYSTEMBACKDROP_TYPE = 0)
196+
};
197+
198+
Methods.SetWindowAttribute(hWnd, ParameterTypes.DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, backdropValue);
199+
}
200+
}
201+
202+
// ✅ BackdropTypeData 리스트 (Dropdown과 연동)
203+
public List<BackdropTypeData> BackdropTypesList { get; } =
204+
DropdownDataGeneric<BackdropTypes>.GetValues<BackdropTypeData>("BackdropTypes");
205+
206+
// ✅ BackdropType 속성 (값 저장 + 자동 적용)
207+
public BackdropTypes BackdropType
208+
{
209+
get => Enum.IsDefined(typeof(BackdropTypes), Settings.BackdropType)
210+
? (BackdropTypes)Settings.BackdropType
211+
: BackdropTypes.None;
212+
213+
set
214+
{
215+
if (!Enum.IsDefined(typeof(BackdropTypes), value))
216+
{
217+
value = BackdropTypes.None;
218+
}
219+
220+
Settings.BackdropType = value;
221+
222+
// ✅ BackdropTypeData 리스트에서 해당하는 값 찾기
223+
var backdropData = BackdropTypesList.FirstOrDefault(b => b.Value == value);
224+
backdropData?.ApplyBackdrop();
225+
}
226+
}
227+
228+
229+
180230
public bool UseSound
181231
{
182232
get => Settings.UseSound;

Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,25 @@
370370
</DockPanel>
371371
</Border>
372372
</Grid>
373+
374+
<!-- Drop shadow effect -->
375+
<cc:Card
376+
Title="Backdrop Type"
377+
Margin="0 8 0 0"
378+
Icon="&#xeb91;"
379+
Sub="{DynamicResource shadowEffectRestart}">
380+
381+
<ComboBox
382+
MinWidth="160"
383+
VerticalAlignment="Center"
384+
DisplayMemberPath="Display"
385+
FontSize="14"
386+
ItemsSource="{Binding BackdropTypesList}"
387+
SelectedValue="{Binding BackdropType, Mode=TwoWay}"
388+
SelectedValuePath="Value" />
389+
</cc:Card>
390+
391+
373392
<!-- Drop shadow effect -->
374393
<cc:Card
375394
Title="{DynamicResource queryWindowShadowEffect}"

0 commit comments

Comments
 (0)