Skip to content

Commit f4ce4bf

Browse files
committed
- Add Launcher Positioning combobox in SettingWindow
- Add Mouse Center Top position - remove RememberLastLaunch bool (moved to Launcher Positioning)
1 parent 31daacb commit f4ce4bf

File tree

6 files changed

+77
-9
lines changed

6 files changed

+77
-9
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public bool HideNotifyIcon
199199
}
200200
public bool LeaveCmdOpen { get; set; }
201201
public bool HideWhenDeactive { get; set; } = true;
202-
public bool RememberLastLaunchLocation { get; set; }
202+
public string LauncherPosition { get; set; } = "RememberLastLaunchLocation";
203203
public bool IgnoreHotkeysOnFullscreen { get; set; }
204204

205205
public HttpProxy Proxy { get; set; } = new HttpProxy();
@@ -225,4 +225,10 @@ public enum ColorSchemes
225225
Light,
226226
Dark
227227
}
228+
public enum LauncherPositions
229+
{
230+
RememberLastLaunchLocation,
231+
MouseScreenCenter,
232+
MouseScreenCenterTop
233+
}
228234
}

Flow.Launcher/Languages/en.xaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
<system:String x:Key="setAutoStartFailed">Error setting launch on startup</system:String>
3434
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Hide Flow Launcher when focus is lost</system:String>
3535
<system:String x:Key="dontPromptUpdateMsg">Do not show new version notifications</system:String>
36+
<system:String x:Key="LauncherPosition">Launcher Position</system:String>
3637
<system:String x:Key="rememberLastLocation">Remember last launch location</system:String>
38+
<system:String x:Key="LauncherPositionRememberLastLaunchLocation">Remember Last Launch Location</system:String>
39+
<system:String x:Key="LauncherPositionMouseScreenCenter">Mouse Screen Center</system:String>
40+
<system:String x:Key="LauncherPositionMouseScreenCenterTop">Mouse Screen Center Top</system:String>
3741
<system:String x:Key="language">Language</system:String>
3842
<system:String x:Key="lastQueryMode">Last Query Style</system:String>
3943
<system:String x:Key="lastQueryModeToolTip">Show/Hide previous results when Flow Launcher is reactivated.</system:String>

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,21 @@ private void OnLoaded(object sender, RoutedEventArgs _)
182182

183183
private void InitializePosition()
184184
{
185-
if (_settings.RememberLastLaunchLocation)
185+
if (_settings.LauncherPosition == "RememberLastLaunchLocation")
186186
{
187187
Top = _settings.WindowTop;
188188
Left = _settings.WindowLeft;
189189
}
190-
else
190+
else if(_settings.LauncherPosition == "MouseScreenCenter")
191191
{
192192
Left = WindowLeft();
193193
Top = WindowTop();
194194
}
195+
else if (_settings.LauncherPosition == "MouseScreenCenterTop")
196+
{
197+
Left = WindowLeft();
198+
Top = 0;
199+
}
195200
}
196201

197202
private void UpdateNotifyIconText()
@@ -418,23 +423,28 @@ private void UpdatePosition()
418423
if (_animating)
419424
return;
420425

421-
if (_settings.RememberLastLaunchLocation)
426+
if (_settings.LauncherPosition == "RememberLastLaunchLocation")
422427
{
423428
Left = _settings.WindowLeft;
424429
Top = _settings.WindowTop;
425430
}
426-
else
431+
else if (_settings.LauncherPosition == "MouseScreenCenter")
427432
{
428433
Left = WindowLeft();
429434
Top = WindowTop();
430435
}
436+
else if (_settings.LauncherPosition == "MouseScreenCenterTop")
437+
{
438+
Left = WindowLeft();
439+
Top = 0;
440+
}
431441
}
432442

433443
private void OnLocationChanged(object sender, EventArgs e)
434444
{
435445
if (_animating)
436446
return;
437-
if (_settings.RememberLastLaunchLocation)
447+
if (_settings.LauncherPosition == "RememberLastLaunchLocation")
438448
{
439449
_settings.WindowLeft = Left;
440450
_settings.WindowTop = Top;

Flow.Launcher/SettingWindow.xaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,12 +685,27 @@
685685
</ItemsControl>
686686
</Border>
687687

688-
<Border Style="{DynamicResource SettingGroupBox}">
688+
<Border Margin="0,30,0,0" Style="{DynamicResource SettingGroupBox}">
689689
<ItemsControl Style="{StaticResource SettingGrid}">
690690
<StackPanel Style="{StaticResource TextPanel}">
691-
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource rememberLastLocation}" />
691+
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource LauncherPosition}" />
692692
</StackPanel>
693-
<CheckBox IsChecked="{Binding Settings.RememberLastLaunchLocation}" Style="{DynamicResource SideControlCheckBox}" />
693+
<ComboBox
694+
x:Name="LauncherPosition"
695+
Grid.Column="2"
696+
MinWidth="180"
697+
Margin="0,0,18,0"
698+
VerticalAlignment="Center"
699+
DisplayMemberPath="Display"
700+
FontSize="14"
701+
ItemsSource="{Binding LauncherPositions}"
702+
SelectedValue="{Binding Settings.LauncherPosition}"
703+
SelectedValuePath="Value"
704+
SelectionChanged="LauncherPositionSelectedIndexChanged" />
705+
<!--<CheckBox IsChecked="{Binding Settings.RememberLastLaunchLocation}" Style="{DynamicResource SideControlCheckBox}" />-->
706+
<TextBlock Style="{StaticResource Glyph}">
707+
&#xe7f4;
708+
</TextBlock>
694709
</ItemsControl>
695710
</Border>
696711

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,12 @@ private void OnPluginSettingKeydown(object sender, KeyEventArgs e)
435435
pluginFilterTxb.Focus();
436436
}
437437

438+
private void LauncherPositionSelectedIndexChanged(object sender, SelectionChangedEventArgs e)
439+
{
440+
441+
}
442+
443+
438444
private void PluginStore_OnKeyDown(object sender, KeyEventArgs e)
439445
{
440446
if (e.Key == Key.F && (Keyboard.Modifiers & ModifierKeys.Control) != 0)

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,33 @@ public List<ColorScheme> ColorSchemes
382382
}
383383
}
384384

385+
386+
387+
public class LauncherPosition
388+
{
389+
public string Display { get; set; }
390+
public LauncherPositions Value { get; set; }
391+
}
392+
393+
public List<LauncherPosition> LauncherPositions
394+
{
395+
get
396+
{
397+
List<LauncherPosition> modes = new List<LauncherPosition>();
398+
var enums = (LauncherPositions[])Enum.GetValues(typeof(LauncherPositions));
399+
foreach (var e in enums)
400+
{
401+
var key = $"LauncherPosition{e}";
402+
var display = _translater.GetTranslation(key);
403+
var m = new LauncherPosition { Display = display, Value = e, };
404+
modes.Add(m);
405+
}
406+
return modes;
407+
}
408+
}
409+
410+
411+
385412
public double WindowWidthSize
386413
{
387414
get => Settings.WindowSize;

0 commit comments

Comments
 (0)