- Add Launcher Positioning combobox in SettingWindow

- Add Mouse Center Top position
- remove RememberLastLaunch bool (moved to Launcher Positioning)
This commit is contained in:
DB p 2022-09-07 10:39:06 +09:00
parent 40d546eb9a
commit a9aed6d2bf
6 changed files with 76 additions and 9 deletions

View file

@ -198,7 +198,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
}
public bool LeaveCmdOpen { get; set; }
public bool HideWhenDeactive { get; set; } = true;
public bool RememberLastLaunchLocation { get; set; }
public string LauncherPosition { get; set; } = "RememberLastLaunchLocation";
public bool IgnoreHotkeysOnFullscreen { get; set; }
public HttpProxy Proxy { get; set; } = new HttpProxy();
@ -224,4 +224,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings
Light,
Dark
}
public enum LauncherPositions
{
RememberLastLaunchLocation,
MouseScreenCenter,
MouseScreenCenterTop
}
}

View file

@ -33,7 +33,11 @@
<system:String x:Key="setAutoStartFailed">Error setting launch on startup</system:String>
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Hide Flow Launcher when focus is lost</system:String>
<system:String x:Key="dontPromptUpdateMsg">Do not show new version notifications</system:String>
<system:String x:Key="LauncherPosition">Launcher Position</system:String>
<system:String x:Key="rememberLastLocation">Remember last launch location</system:String>
<system:String x:Key="LauncherPositionRememberLastLaunchLocation">Remember Last Launch Location</system:String>
<system:String x:Key="LauncherPositionMouseScreenCenter">Mouse Screen Center</system:String>
<system:String x:Key="LauncherPositionMouseScreenCenterTop">Mouse Screen Center Top</system:String>
<system:String x:Key="language">Language</system:String>
<system:String x:Key="lastQueryMode">Last Query Style</system:String>
<system:String x:Key="lastQueryModeToolTip">Show/Hide previous results when Flow Launcher is reactivated.</system:String>

View file

@ -224,16 +224,21 @@ namespace Flow.Launcher
private void InitializePosition()
{
if (_settings.RememberLastLaunchLocation)
if (_settings.LauncherPosition == "RememberLastLaunchLocation")
{
Top = _settings.WindowTop;
Left = _settings.WindowLeft;
}
else
else if(_settings.LauncherPosition == "MouseScreenCenter")
{
Left = WindowLeft();
Top = WindowTop();
}
else if (_settings.LauncherPosition == "MouseScreenCenterTop")
{
Left = WindowLeft();
Top = 0;
}
}
private void UpdateNotifyIconText()
@ -460,23 +465,28 @@ namespace Flow.Launcher
if (_animating)
return;
if (_settings.RememberLastLaunchLocation)
if (_settings.LauncherPosition == "RememberLastLaunchLocation")
{
Left = _settings.WindowLeft;
Top = _settings.WindowTop;
}
else
else if (_settings.LauncherPosition == "MouseScreenCenter")
{
Left = WindowLeft();
Top = WindowTop();
}
else if (_settings.LauncherPosition == "MouseScreenCenterTop")
{
Left = WindowLeft();
Top = 0;
}
}
private void OnLocationChanged(object sender, EventArgs e)
{
if (_animating)
return;
if (_settings.RememberLastLaunchLocation)
if (_settings.LauncherPosition == "RememberLastLaunchLocation")
{
_settings.WindowLeft = Left;
_settings.WindowTop = Top;

View file

@ -634,12 +634,27 @@
</ItemsControl>
</Border>
<Border Style="{DynamicResource SettingGroupBox}">
<Border Margin="0,30,0,0" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource rememberLastLocation}" />
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource LauncherPosition}" />
</StackPanel>
<CheckBox IsChecked="{Binding Settings.RememberLastLaunchLocation}" Style="{DynamicResource SideControlCheckBox}" />
<ComboBox
x:Name="LauncherPosition"
Grid.Column="2"
MinWidth="180"
Margin="0,0,18,0"
VerticalAlignment="Center"
DisplayMemberPath="Display"
FontSize="14"
ItemsSource="{Binding LauncherPositions}"
SelectedValue="{Binding Settings.LauncherPosition}"
SelectedValuePath="Value"
SelectionChanged="LauncherPositionSelectedIndexChanged" />
<!--<CheckBox IsChecked="{Binding Settings.RememberLastLaunchLocation}" Style="{DynamicResource SideControlCheckBox}" />-->
<TextBlock Style="{StaticResource Glyph}">
&#xe7f4;
</TextBlock>
</ItemsControl>
</Border>

View file

@ -355,6 +355,12 @@ namespace Flow.Launcher
}
private void LauncherPositionSelectedIndexChanged(object sender, SelectionChangedEventArgs e)
{
}
private void PreviewClockAndDate(object sender, RoutedEventArgs e)
{
ClockDisplay();

View file

@ -361,6 +361,32 @@ namespace Flow.Launcher.ViewModel
}
}
public class LauncherPosition
{
public string Display { get; set; }
public LauncherPositions Value { get; set; }
}
public List<LauncherPosition> LauncherPositions
{
get
{
List<LauncherPosition> modes = new List<LauncherPosition>();
var enums = (LauncherPositions[])Enum.GetValues(typeof(LauncherPositions));
foreach (var e in enums)
{
var key = $"LauncherPosition{e}";
var display = _translater.GetTranslation(key);
var m = new LauncherPosition { Display = display, Value = e, };
modes.Add(m);
}
return modes;
}
}
public List<string> TimeFormatList { get; set; } = new List<string>()
{
"hh:mm",