Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortcuts to adjust width size, number of results shown and game mode #1369

Merged
merged 17 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
<system:String x:Key="maxShowResultsToolTip">You can quick adjust CTRL+[ and CTRL+] in query box.</system:String>
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>
<system:String x:Key="ignoreHotkeysOnFullscreenToolTip">Disable Flow Launcher activation when a full screen application is active (Recommended for games).</system:String>
<system:String x:Key="defaultFileManager">Default File Manager</system:String>
Expand Down Expand Up @@ -124,6 +125,7 @@
<system:String x:Key="queryWindowShadowEffect">Query window shadow effect</system:String>
<system:String x:Key="shadowEffectCPUUsage">Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited.</system:String>
<system:String x:Key="windowWidthSize">Window Width Size</system:String>
<system:String x:Key="windowWidthSizeToolTip">You can quick adjust Ctrl+Plus/Minus Key in query box too.</system:String>
<system:String x:Key="useGlyphUI">Use Segoe Fluent Icons</system:String>
<system:String x:Key="useGlyphUIEffect">Use Segoe Fluent Icons for query results where supported</system:String>

Expand Down
67 changes: 64 additions & 3 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows;
Expand Down Expand Up @@ -478,6 +478,7 @@ public double WindowTop()
/// </summary>
private void OnKeyDown(object sender, KeyEventArgs e)
{
var specialKeyState = GlobalHotkey.CheckModifiers();
switch (e.Key)
{
case Key.Down:
Expand All @@ -504,16 +505,76 @@ private void OnKeyDown(object sender, KeyEventArgs e)
_viewModel.LoadContextMenuCommand.Execute(null);
e.Handled = true;
}
if (specialKeyState.CtrlPressed)
{

_settings.WindowSize = _settings.WindowSize + 100;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curious why does this work. I suspect we need to set the property in the viewmodel to trigger change?

Left = Left - 50;
}
break;
case Key.Left:
if (!_viewModel.SelectedIsFromQueryResults() && QueryTextBox.CaretIndex == 0)
{
_viewModel.EscCommand.Execute(null);
e.Handled = true;
}
if (specialKeyState.CtrlPressed)
{
if (_settings.WindowSize < 400)
{
}
else
{
_settings.WindowSize = _settings.WindowSize - 100;
Left = Left + 50;
}
}
break;
case Key.OemMinus:
if (specialKeyState.CtrlPressed)
{
if (_settings.WindowSize < 400)
{
}
else
{
_settings.WindowSize = _settings.WindowSize - 100;
Left = Left + 50;
}
}
break;
case Key.OemPlus:
if (specialKeyState.CtrlPressed)
{
_settings.WindowSize = _settings.WindowSize + 100;
Left = Left - 50;
}
break;
case Key.OemOpenBrackets:
if (specialKeyState.CtrlPressed)
{
if (_settings.MaxResultsToShow < 2)
{
}
else
{
_settings.MaxResultsToShow = _settings.MaxResultsToShow - 1;
}
}
break;
case Key.OemCloseBrackets:
if (specialKeyState.CtrlPressed)
{
_settings.MaxResultsToShow = _settings.MaxResultsToShow + 1;
}
break;
case Key.F12:
if (specialKeyState.CtrlPressed)
{
ToggleGameMode();
}
break;
case Key.Back:
var specialKeyState = GlobalHotkey.CheckModifiers();
if (specialKeyState.CtrlPressed)
{
if (_viewModel.SelectedIsFromQueryResults()
Expand Down Expand Up @@ -556,4 +617,4 @@ public void InitializeColorScheme()
}
}
}
}
}
14 changes: 9 additions & 5 deletions Flow.Launcher/SettingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,13 @@
BorderThickness="0"
Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Style="{DynamicResource SettingTitleLabel}"
Text="{DynamicResource maxShowResults}" />
<StackPanel Grid.Column="1">
<TextBlock
VerticalAlignment="Center"
Style="{DynamicResource SettingTitleLabel}"
Text="{DynamicResource maxShowResults}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource maxShowResultsToolTip}" />
</StackPanel>
<ComboBox
Grid.Column="2"
Width="100"
Expand Down Expand Up @@ -1604,6 +1606,7 @@
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource windowWidthSize}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource windowWidthSizeToolTip}" />
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<TextBlock
Expand All @@ -1617,6 +1620,7 @@
Name="WindowWidthValue"
Width="300"
Margin="0,0,18,0"
VerticalAlignment="Center"
IsMoveToPointEnabled="True"
IsSnapToTickEnabled="True"
Maximum="1920"
Expand Down