Skip to content

Commit 4fae112

Browse files
committed
- Add LeftTop / RightTop Option
- Remove comment
1 parent a69bbac commit 4fae112

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ public enum LauncherPositions
229229
{
230230
RememberLastLaunchLocation,
231231
MouseScreenCenter,
232-
MouseScreenCenterTop
232+
MouseScreenCenterTop,
233+
MouseScreenLeftTop,
234+
MouseScreenRightTop
233235
}
234236
}

Flow.Launcher/Languages/en.xaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@
3636
<system:String x:Key="LauncherPosition">Launcher Position</system:String>
3737
<system:String x:Key="rememberLastLocation">Remember last launch location</system:String>
3838
<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>
39+
<system:String x:Key="LauncherPositionMouseScreenCenter">Mouse Focused Screen Center</system:String>
40+
<system:String x:Key="LauncherPositionMouseScreenCenterTop">Mouse Focused Screen Center Top</system:String>
41+
<system:String x:Key="LauncherPositionMouseScreenLeftTop">Mouse Focused Screen Left Top</system:String>
42+
<system:String x:Key="LauncherPositionMouseScreenRightTop">Mouse Focused Screen Right Top</system:String>
4143
<system:String x:Key="language">Language</system:String>
4244
<system:String x:Key="lastQueryMode">Last Query Style</system:String>
4345
<system:String x:Key="lastQueryModeToolTip">Show/Hide previous results when Flow Launcher is reactivated.</system:String>

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,16 @@ private void InitializePosition()
197197
Left = WindowLeft();
198198
Top = 10;
199199
}
200+
else if (_settings.LauncherPosition == "MouseScreenLeftTop")
201+
{
202+
Left = 10;
203+
Top = 10;
204+
}
205+
else if (_settings.LauncherPosition == "MouseScreenRightTop")
206+
{
207+
Left = WindowRight();
208+
Top = 10;
209+
}
200210
}
201211

202212
private void UpdateNotifyIconText()
@@ -438,6 +448,16 @@ private void UpdatePosition()
438448
Left = WindowLeft();
439449
Top = 10;
440450
}
451+
else if (_settings.LauncherPosition == "MouseScreenLeftTop")
452+
{
453+
Left = 10;
454+
Top = 10;
455+
}
456+
else if (_settings.LauncherPosition == "MouseScreenRightTop")
457+
{
458+
Left = WindowRight();
459+
Top = 10;
460+
}
441461
}
442462

443463
private void OnLocationChanged(object sender, EventArgs e)
@@ -482,6 +502,15 @@ public double WindowTop()
482502
return top;
483503
}
484504

505+
public double WindowRight()
506+
{
507+
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
508+
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X, 0);
509+
var dip2 = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.Width, 0);
510+
var left = (dip2.X - ActualWidth) - 10;
511+
return left;
512+
}
513+
485514
/// <summary>
486515
/// Register up and down key
487516
/// todo: any way to put this in xaml ?

Flow.Launcher/SettingWindow.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@
693693
<ComboBox
694694
x:Name="LauncherPosition"
695695
Grid.Column="2"
696-
MinWidth="180"
696+
MinWidth="220"
697697
Margin="0,0,18,0"
698698
VerticalAlignment="Center"
699699
DisplayMemberPath="Display"
@@ -702,7 +702,6 @@
702702
SelectedValue="{Binding Settings.LauncherPosition}"
703703
SelectedValuePath="Value"
704704
SelectionChanged="LauncherPositionSelectedIndexChanged" />
705-
<!--<CheckBox IsChecked="{Binding Settings.RememberLastLaunchLocation}" Style="{DynamicResource SideControlCheckBox}" />-->
706705
<TextBlock Style="{StaticResource Glyph}">
707706
&#xe7f4;
708707
</TextBlock>

0 commit comments

Comments
 (0)