- Add LeftTop / RightTop Option

- Remove comment
This commit is contained in:
DB p 2022-09-07 11:08:11 +09:00
parent 0596c4cbeb
commit 00e8625a90
4 changed files with 37 additions and 5 deletions

View file

@ -228,6 +228,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings
{
RememberLastLaunchLocation,
MouseScreenCenter,
MouseScreenCenterTop
MouseScreenCenterTop,
MouseScreenLeftTop,
MouseScreenRightTop
}
}

View file

@ -36,8 +36,10 @@
<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="LauncherPositionMouseScreenCenter">Mouse Focused Screen Center</system:String>
<system:String x:Key="LauncherPositionMouseScreenCenterTop">Mouse Focused Screen Center Top</system:String>
<system:String x:Key="LauncherPositionMouseScreenLeftTop">Mouse Focused Screen Left Top</system:String>
<system:String x:Key="LauncherPositionMouseScreenRightTop">Mouse Focused Screen Right 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

@ -239,6 +239,16 @@ namespace Flow.Launcher
Left = WindowLeft();
Top = 10;
}
else if (_settings.LauncherPosition == "MouseScreenLeftTop")
{
Left = 10;
Top = 10;
}
else if (_settings.LauncherPosition == "MouseScreenRightTop")
{
Left = WindowRight();
Top = 10;
}
}
private void UpdateNotifyIconText()
@ -480,6 +490,16 @@ namespace Flow.Launcher
Left = WindowLeft();
Top = 10;
}
else if (_settings.LauncherPosition == "MouseScreenLeftTop")
{
Left = 10;
Top = 10;
}
else if (_settings.LauncherPosition == "MouseScreenRightTop")
{
Left = WindowRight();
Top = 10;
}
}
private void OnLocationChanged(object sender, EventArgs e)
@ -524,6 +544,15 @@ namespace Flow.Launcher
return top;
}
public double WindowRight()
{
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X, 0);
var dip2 = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.Width, 0);
var left = (dip2.X - ActualWidth) - 10;
return left;
}
/// <summary>
/// Register up and down key
/// todo: any way to put this in xaml ?

View file

@ -642,7 +642,7 @@
<ComboBox
x:Name="LauncherPosition"
Grid.Column="2"
MinWidth="180"
MinWidth="220"
Margin="0,0,18,0"
VerticalAlignment="Center"
DisplayMemberPath="Display"
@ -651,7 +651,6 @@
SelectedValue="{Binding Settings.LauncherPosition}"
SelectedValuePath="Value"
SelectionChanged="LauncherPositionSelectedIndexChanged" />
<!--<CheckBox IsChecked="{Binding Settings.RememberLastLaunchLocation}" Style="{DynamicResource SideControlCheckBox}" />-->
<TextBlock Style="{StaticResource Glyph}">
&#xe7f4;
</TextBlock>