Skip to content

Commit 0c62c9c

Browse files
Jack251970TBM13
authored andcommitted
Merge pull request Flow-Launcher#3819 from Flow-Launcher/home_page_update
Fix Home Page Update Issue
1 parent 7adb219 commit 0c62c9c

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,37 @@ public void Save()
3535
}
3636

3737
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
38-
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
38+
39+
private string _openResultModifiers = KeyConstant.Alt;
40+
public string OpenResultModifiers
41+
{
42+
get => _openResultModifiers;
43+
set
44+
{
45+
if (_openResultModifiers != value)
46+
{
47+
_openResultModifiers = value;
48+
OnPropertyChanged();
49+
}
50+
}
51+
}
52+
3953
public string ColorScheme { get; set; } = "System";
40-
public bool ShowOpenResultHotkey { get; set; } = true;
54+
55+
private bool _showOpenResultHotkey = true;
56+
public bool ShowOpenResultHotkey
57+
{
58+
get => _showOpenResultHotkey;
59+
set
60+
{
61+
if (_showOpenResultHotkey != value)
62+
{
63+
_showOpenResultHotkey = value;
64+
OnPropertyChanged();
65+
}
66+
}
67+
}
68+
4169
public double WindowSize { get; set; } = 580;
4270
public string PreviewHotkey { get; set; } = $"F1";
4371
public string AutoCompleteHotkey { get; set; } = $"{KeyConstant.Ctrl} + Tab";

Flow.Launcher/ResultListBox.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<converter:BadgePositionConverter x:Key="BadgePositionConverter" />
3737
<converter:IconRadiusConverter x:Key="IconRadiusConverter" />
3838
<converter:DiameterToCenterPointConverter x:Key="DiameterToCenterPointConverter" />
39+
<converter:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
3940
</ListBox.Resources>
4041
<ListBox.ItemTemplate>
4142
<DataTemplate>
@@ -66,7 +67,7 @@
6667
Grid.Column="2"
6768
Margin="0 0 10 0"
6869
VerticalAlignment="Center"
69-
Visibility="{Binding ShowOpenResultHotkey}">
70+
Visibility="{Binding Settings.ShowOpenResultHotkey, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
7071
<Border x:Name="HotkeyBG" Style="{DynamicResource ItemHotkeyBGStyle}">
7172
<Border.Visibility>
7273
<Binding Converter="{StaticResource ResourceKey=OpenResultHotkeyVisibilityConverter}" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}" />
@@ -79,7 +80,7 @@
7980
Style="{DynamicResource ItemHotkeyStyle}">
8081
<TextBlock.Text>
8182
<MultiBinding StringFormat="{}{0}+{1}">
82-
<Binding Path="OpenResultModifiers" />
83+
<Binding Mode="OneWay" Path="Settings.OpenResultModifiers" />
8384
<Binding Converter="{StaticResource ResourceKey=OrdinalConverter}" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}" />
8485
</MultiBinding>
8586
</TextBlock.Text>

Flow.Launcher/ViewModel/ResultViewModel.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ public ResultViewModel(Result result, Settings settings)
6464

6565
public Settings Settings { get; }
6666

67-
public Visibility ShowOpenResultHotkey =>
68-
Settings.ShowOpenResultHotkey ? Visibility.Visible : Visibility.Collapsed;
69-
7067
public Visibility ShowDefaultPreview => Result.PreviewPanel == null ? Visibility.Visible : Visibility.Collapsed;
7168

7269
public Visibility ShowCustomizedPreview => Result.PreviewPanel == null ? Visibility.Collapsed : Visibility.Visible;
@@ -152,8 +149,6 @@ public Visibility ShowBadge
152149

153150
private bool PreviewImageAvailable => !string.IsNullOrEmpty(Result.Preview.PreviewImagePath) || Result.Preview.PreviewDelegate != null;
154151

155-
public string OpenResultModifiers => Settings.OpenResultModifiers;
156-
157152
public string ShowTitleToolTip => string.IsNullOrEmpty(Result.TitleToolTip)
158153
? Result.Title
159154
: Result.TitleToolTip;

0 commit comments

Comments
 (0)