Skip to content

Commit 5daf906

Browse files
committed
Merge branch 'dev' of github.com:Flow-Launcher/Flow.Launcher into JsonRPCPluginSettingControl
2 parents c677a63 + 1ab9c08 commit 5daf906

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+5095
-1349
lines changed

Flow.Launcher.Core/Resource/Internationalization.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Flow.Launcher.Infrastructure.Logger;
1010
using Flow.Launcher.Infrastructure.UserSettings;
1111
using Flow.Launcher.Plugin;
12+
using System.Globalization;
1213

1314
namespace Flow.Launcher.Core.Resource
1415
{
@@ -96,7 +97,8 @@ public void ChangeLanguage(Language language)
9697
}
9798
UpdatePluginMetadataTranslations();
9899
Settings.Language = language.LanguageCode;
99-
100+
CultureInfo.CurrentCulture = new CultureInfo(language.LanguageCode);
101+
CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture;
100102
}
101103

102104
public bool PromptShouldUsePinyin(string languageCodeToSet)

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -189,22 +189,11 @@ public ResourceDictionary GetResourceDictionary()
189189
new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o
190190
=> Array.ForEach(setters, p => o.Setters.Add(p)));
191191
}
192-
192+
/* Ignore Theme Window Width and use setting */
193193
var windowStyle = dict["WindowStyle"] as Style;
194-
195-
var width = windowStyle?.Setters.OfType<Setter>().Where(x => x.Property.Name == "Width")
196-
.Select(x => x.Value).FirstOrDefault();
197-
198-
if (width == null)
199-
{
200-
windowStyle = dict["BaseWindowStyle"] as Style;
201-
202-
width = windowStyle?.Setters.OfType<Setter>().Where(x => x.Property.Name == "Width")
203-
.Select(x => x.Value).FirstOrDefault();
204-
}
205-
194+
var width = Settings.WindowSize;
195+
windowStyle.Setters.Add(new Setter(Window.WidthProperty, width));
206196
mainWindowWidth = (double)width;
207-
208197
return dict;
209198
}
210199

@@ -375,8 +364,6 @@ private void SetWindowAccent(Window w, AccentState state)
375364
{
376365
var windowHelper = new WindowInteropHelper(w);
377366

378-
// this determines the width of the main query window
379-
w.Width = mainWindowWidth;
380367
windowHelper.EnsureHandle();
381368

382369
var accent = new AccentPolicy { AccentState = state };

Flow.Launcher.Infrastructure/Constant.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static class Constant
3333

3434
public static readonly string QueryTextBoxIconImagePath = $"{ProgramDirectory}\\Images\\mainsearch.svg";
3535

36-
public const string DefaultTheme = "Darker";
36+
public const string DefaultTheme = "Win11Light";
3737

3838
public const string Themes = "Themes";
3939

Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,15 @@
5050

5151
<ItemGroup>
5252
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
53+
<PackageReference Include="Fody" Version="6.5.5">
54+
<PrivateAssets>all</PrivateAssets>
55+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
56+
</PackageReference>
5357
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="16.10.56" />
5458
<PackageReference Include="NLog" Version="4.7.10" />
5559
<PackageReference Include="NLog.Schema" Version="4.7.10" />
5660
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />
61+
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
5762
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
5863
<!--ToolGood.Words.Pinyin v3.0.2.6 results in high memory usage when search with pinyin is enabled-->
5964
<!--Bumping to it or higher needs to test and ensure this is no longer a problem-->
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Flow.Launcher.Plugin;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace Flow.Launcher.ViewModel
9+
{
10+
public class CustomExplorerViewModel : BaseModel
11+
{
12+
public string Name { get; set; }
13+
public string Path { get; set; }
14+
public string FileArgument { get; set; } = "\"%d\"";
15+
public string DirectoryArgument { get; set; } = "\"%d\"";
16+
public bool Editable { get; init; } = true;
17+
18+
public CustomExplorerViewModel Copy()
19+
{
20+
return new CustomExplorerViewModel
21+
{
22+
Name = Name,
23+
Path = Path,
24+
FileArgument = FileArgument,
25+
DirectoryArgument = DirectoryArgument,
26+
Editable = Editable
27+
};
28+
}
29+
}
30+
}

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.Collections.ObjectModel;
34
using System.Drawing;
45
using System.Text.Json.Serialization;
56
using Flow.Launcher.Plugin;
67
using Flow.Launcher.Plugin.SharedModels;
8+
using Flow.Launcher;
9+
using Flow.Launcher.ViewModel;
710

811
namespace Flow.Launcher.Infrastructure.UserSettings
912
{
1013
public class Settings : BaseModel
1114
{
1215
private string language = "en";
13-
1416
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
1517
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
1618
public bool ShowOpenResultHotkey { get; set; } = true;
19+
public double WindowSize { get; set; } = 580;
20+
1721
public string Language
1822
{
19-
get => language; set
23+
get => language;
24+
set
2025
{
2126
language = value;
2227
OnPropertyChanged();
@@ -34,6 +39,49 @@ public string Language
3439
public string ResultFontStretch { get; set; }
3540
public bool UseGlyphIcons { get; set; } = true;
3641

42+
public int CustomExplorerIndex { get; set; } = 0;
43+
44+
[JsonIgnore]
45+
public CustomExplorerViewModel CustomExplorer
46+
{
47+
get => CustomExplorerList[CustomExplorerIndex < CustomExplorerList.Count ? CustomExplorerIndex : 0];
48+
set => CustomExplorerList[CustomExplorerIndex] = value;
49+
}
50+
51+
public List<CustomExplorerViewModel> CustomExplorerList { get; set; } = new()
52+
{
53+
new()
54+
{
55+
Name = "Explorer",
56+
Path = "explorer",
57+
DirectoryArgument = "\"%d\"",
58+
FileArgument = "/select, \"%f\"",
59+
Editable = false
60+
},
61+
new()
62+
{
63+
Name = "Total Commander",
64+
Path = @"C:\Program Files\totalcmd\TOTALCMD64.exe",
65+
DirectoryArgument = "/O /A /S /T \"%d\"",
66+
FileArgument = "/O /A /S /T \"%f\""
67+
},
68+
new()
69+
{
70+
Name = "Directory Opus",
71+
Path = @"C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe",
72+
DirectoryArgument = "/cmd Go \"%d\" NEW",
73+
FileArgument = "/cmd Go \"%f\" NEW"
74+
75+
},
76+
new()
77+
{
78+
Name = "Files",
79+
Path = "Files",
80+
DirectoryArgument = "-select \"%d\"",
81+
FileArgument = "-select \"%f\""
82+
}
83+
};
84+
3785

3886
/// <summary>
3987
/// when false Alphabet static service will always return empty results
@@ -52,7 +100,7 @@ public string QuerySearchPrecisionString
52100
try
53101
{
54102
var precisionScore = (SearchPrecisionScore)Enum
55-
.Parse(typeof(SearchPrecisionScore), value);
103+
.Parse(typeof(SearchPrecisionScore), value);
56104

57105
QuerySearchPrecision = precisionScore;
58106
StringMatcher.Instance.UserSettingSearchPrecision = precisionScore;

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,12 @@ public interface IPublicAPI
190190
/// <typeparam name="T">Type for Serialization</typeparam>
191191
/// <returns></returns>
192192
void SaveSettingJsonStorage<T>() where T : new();
193+
194+
/// <summary>
195+
/// Open directory in an explorer configured by user via Flow's Settings. The default is Windows Explorer
196+
/// </summary>
197+
/// <param name="DirectoryPath">Directory Path to open</param>
198+
/// <param name="FileName">Extra FileName Info</param>
199+
public void OpenDirectory(string DirectoryPath, string FileName = null);
193200
}
194201
}

Flow.Launcher/ActionKeywords.xaml

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,54 @@
11
<Window x:Class="Flow.Launcher.ActionKeywords"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
Title="ActionKeywords"
4+
Title="{DynamicResource actionKeywordsTitle}"
55
Icon="Images\app.png"
66
ResizeMode="NoResize"
77
Loaded="ActionKeyword_OnLoaded"
88
WindowStartupLocation="CenterScreen"
9-
Height="250" Width="500">
9+
Height="365" Width="450" Background="#F3F3F3" BorderBrush="#cecece">
1010
<Grid>
11+
<Grid.RowDefinitions>
12+
<RowDefinition />
13+
<RowDefinition Height="80"/>
14+
</Grid.RowDefinitions>
15+
<Border BorderThickness="0 0 0 1" BorderBrush="#e5e5e5" Background="#ffffff" Padding="26 26 26 0">
16+
<Grid>
17+
<StackPanel>
18+
<StackPanel Grid.Row="0" Margin="0 0 0 12">
19+
<TextBlock Grid.Column="0" Text="{DynamicResource actionKeywordsTitle}" FontSize="20" FontWeight="SemiBold" FontFamily="Segoe UI" TextAlignment="Left"
20+
Margin="0 0 0 0" />
21+
</StackPanel>
22+
<StackPanel>
23+
<TextBlock
24+
Text="{DynamicResource actionkeyword_tips}" Foreground="#1b1b1b" FontSize="14" TextWrapping="WrapWithOverflow" TextAlignment="Left"/>
25+
</StackPanel>
26+
27+
<StackPanel Orientation="Horizontal" Margin="0 18 0 0">
28+
<TextBlock FontSize="14" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center"
29+
HorizontalAlignment="Left" Text="{DynamicResource currentActionKeywords}" />
30+
<TextBlock x:Name="tbOldActionKeyword" Grid.Row="0" Grid.Column="1" Margin="14 10 10 10" FontSize="14"
31+
VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="SemiBold"/>
32+
</StackPanel>
33+
<StackPanel Orientation="Horizontal">
34+
<TextBlock FontSize="14" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center"
35+
HorizontalAlignment="Left" Text="{DynamicResource newActionKeyword}" />
36+
37+
<TextBox x:Name="tbAction" Margin="10 10 15 10" Width="105" VerticalAlignment="Center" HorizontalAlignment="Left" />
38+
39+
</StackPanel>
40+
</StackPanel>
41+
</Grid>
42+
</Border>
43+
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="1">
44+
<Button x:Name="btnCancel" Click="BtnCancel_OnClick" Margin="10 0 5 0" Width="100" Height="30"
45+
Content="{DynamicResource cancel}" />
46+
<Button x:Name="btnDone" Margin="5 0 10 0" Width="100" Height="30" Click="btnDone_OnClick">
47+
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
48+
</Button>
49+
</StackPanel>
50+
</Grid>
51+
<!--
1152
<Grid.RowDefinitions>
1253
<RowDefinition />
1354
<RowDefinition Height="60"/>
@@ -40,4 +81,5 @@
4081
</Button>
4182
</StackPanel>
4283
</Grid>
84+
-->
4385
</Window>

0 commit comments

Comments
 (0)