Skip to content

Commit 03686dd

Browse files
committed
Merge remote-tracking branch 'origin/dev' into quicklook
2 parents 4dbecb1 + 2ac2c9c commit 03686dd

Some content is hidden

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

57 files changed

+945
-1435
lines changed

.cm/gitstream.cm

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# -*- mode: yaml -*-
2+
# This example configuration for provides basic automations to get started with gitStream.
3+
# View the gitStream quickstart for more examples: https://docs.gitstream.cm/examples/
4+
manifest:
5+
version: 1.0
6+
7+
8+
automations:
9+
# Add a label that indicates how many minutes it will take to review the PR.
10+
estimated_time_to_review:
11+
if:
12+
- true
13+
run:
14+
- action: add-label@v1
15+
args:
16+
label: "{{ calc.etr }} min review"
17+
color: {{ colors.red if (calc.etr >= 20) else ( colors.yellow if (calc.etr >= 5) else colors.green ) }}
18+
# Post a comment that lists the best experts for the files that were modified.
19+
explain_code_experts:
20+
if:
21+
- true
22+
run:
23+
- action: explain-code-experts@v1
24+
args:
25+
gt: 10
26+
# Post a comment that indicates what percentage of the PR is new code.
27+
percent_new_code:
28+
if:
29+
- true
30+
run:
31+
- action: add-comment@v1
32+
args:
33+
comment: |
34+
This PR is {{ changes.ratio }}% new code.
35+
# Post a comment that request changes for a PR that contains a TODO statement.
36+
review_todo_comments:
37+
if:
38+
- {{ source.diff.files | matchDiffLines(regex=r/^[+].*(TODO)|(todo)/) | some }}
39+
run:
40+
- action: request-changes@v1
41+
args:
42+
comment: |
43+
This PR contains a TODO statement. Please check to see if they should be removed.
44+
# Post a comment that request a before and after screenshot
45+
request_screenshot:
46+
# Triggered for PRs that lack an image file or link to an image in the PR description
47+
if:
48+
- {{ not (has.screenshot_link or has.image_uploaded) }}
49+
run:
50+
- action: add-comment@v1
51+
args:
52+
comment: |
53+
Be a legend :trophy: by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.
54+
55+
56+
# +----------------------------------------------------------------------------+
57+
# | Custom Expressions |
58+
# | https://docs.gitstream.cm/how-it-works/#custom-expressions |
59+
# +----------------------------------------------------------------------------+
60+
61+
calc:
62+
etr: {{ branch | estimatedReviewTime }}
63+
64+
colors:
65+
red: 'b60205'
66+
yellow: 'fbca04'
67+
green: '0e8a16'
68+
69+
changes:
70+
# Sum all the lines added/edited in the PR
71+
additions: {{ branch.diff.files_metadata | map(attr='additions') | sum }}
72+
# Sum all the line removed in the PR
73+
deletions: {{ branch.diff.files_metadata | map(attr='deletions') | sum }}
74+
# Calculate the ratio of new code
75+
ratio: {{ (changes.additions / (changes.additions + changes.deletions)) * 100 | round(2) }}

.github/workflows/gitstream.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Code generated by gitStream GitHub app - DO NOT EDIT
2+
3+
name: gitStream workflow automation
4+
run-name: |
5+
/:\ gitStream: PR #${{ fromJSON(fromJSON(github.event.inputs.client_payload)).pullRequestNumber }} from ${{ github.event.inputs.full_repository }}
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
client_payload:
11+
description: The Client payload
12+
required: true
13+
full_repository:
14+
description: the repository name include the owner in `owner/repo_name` format
15+
required: true
16+
head_ref:
17+
description: the head sha
18+
required: true
19+
base_ref:
20+
description: the base ref
21+
required: true
22+
installation_id:
23+
description: the installation id
24+
required: false
25+
resolver_url:
26+
description: the resolver url to pass results to
27+
required: true
28+
resolver_token:
29+
description: Optional resolver token for resolver service
30+
required: false
31+
default: ''
32+
33+
jobs:
34+
gitStream:
35+
timeout-minutes: 5
36+
runs-on: ubuntu-latest
37+
name: gitStream workflow automation
38+
steps:
39+
- name: Evaluate Rules
40+
uses: linear-b/gitstream-github-action@v2
41+
id: rules-engine
42+
with:
43+
full_repository: ${{ github.event.inputs.full_repository }}
44+
head_ref: ${{ github.event.inputs.head_ref }}
45+
base_ref: ${{ github.event.inputs.base_ref }}
46+
client_payload: ${{ github.event.inputs.client_payload }}
47+
installation_id: ${{ github.event.inputs.installation_id }}
48+
resolver_url: ${{ github.event.inputs.resolver_url }}
49+
resolver_token: ${{ github.event.inputs.resolver_token }}

Flow.Launcher.Core/Plugin/ProcessStreamPluginV2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ public override async Task ReloadDataAsync()
8282

8383
public override async ValueTask DisposeAsync()
8484
{
85+
await base.DisposeAsync();
8586
ClientProcess.Kill(true);
8687
await ClientProcess.WaitForExitAsync();
8788
ClientProcess.Dispose();
88-
await base.DisposeAsync();
8989
}
9090
}
9191
}

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
5+
using System.Xml;
56
using System.Runtime.InteropServices;
67
using System.Windows;
78
using System.Windows.Controls;
@@ -17,6 +18,10 @@ namespace Flow.Launcher.Core.Resource
1718
{
1819
public class Theme
1920
{
21+
private const string ThemeMetadataNamePrefix = "Name:";
22+
private const string ThemeMetadataIsDarkPrefix = "IsDark:";
23+
private const string ThemeMetadataHasBlurPrefix = "HasBlur:";
24+
2025
private const int ShadowExtraMargin = 32;
2126

2227
private readonly List<string> _themeDirectories = new List<string>();
@@ -79,14 +84,14 @@ public bool ChangeTheme(string theme)
7984
{
8085
if (string.IsNullOrEmpty(path))
8186
throw new DirectoryNotFoundException("Theme path can't be found <{path}>");
82-
87+
8388
// reload all resources even if the theme itself hasn't changed in order to pickup changes
8489
// to things like fonts
8590
UpdateResourceDictionary(GetResourceDictionary(theme));
86-
91+
8792
Settings.Theme = theme;
8893

89-
94+
9095
//always allow re-loading default theme, in case of failure of switching to a new theme from default theme
9196
if (_oldTheme != theme || theme == defaultTheme)
9297
{
@@ -148,7 +153,7 @@ private ResourceDictionary GetThemeResourceDictionary(string theme)
148153
public ResourceDictionary GetResourceDictionary(string theme)
149154
{
150155
var dict = GetThemeResourceDictionary(theme);
151-
156+
152157
if (dict["QueryBoxStyle"] is Style queryBoxStyle &&
153158
dict["QuerySuggestionBoxStyle"] is Style querySuggestionBoxStyle)
154159
{
@@ -187,7 +192,7 @@ public ResourceDictionary GetResourceDictionary(string theme)
187192

188193
Setter[] setters = { fontFamily, fontStyle, fontWeight, fontStretch };
189194
Array.ForEach(
190-
new[] { resultItemStyle, resultItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o
195+
new[] { resultItemStyle, resultItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o
191196
=> Array.ForEach(setters, p => o.Setters.Add(p)));
192197
}
193198

@@ -219,17 +224,53 @@ private ResourceDictionary GetCurrentResourceDictionary( )
219224
return GetResourceDictionary(Settings.Theme);
220225
}
221226

222-
public List<string> LoadAvailableThemes()
227+
public List<ThemeData> LoadAvailableThemes()
223228
{
224-
List<string> themes = new List<string>();
229+
List<ThemeData> themes = new List<ThemeData>();
225230
foreach (var themeDirectory in _themeDirectories)
226231
{
227-
themes.AddRange(
228-
Directory.GetFiles(themeDirectory)
229-
.Where(filePath => filePath.EndsWith(Extension) && !filePath.EndsWith("Base.xaml"))
230-
.ToList());
232+
var filePaths = Directory
233+
.GetFiles(themeDirectory)
234+
.Where(filePath => filePath.EndsWith(Extension) && !filePath.EndsWith("Base.xaml"))
235+
.Select(GetThemeDataFromPath);
236+
themes.AddRange(filePaths);
231237
}
232-
return themes.OrderBy(o => o).ToList();
238+
239+
return themes.OrderBy(o => o.Name).ToList();
240+
}
241+
242+
private ThemeData GetThemeDataFromPath(string path)
243+
{
244+
using var reader = XmlReader.Create(path);
245+
reader.Read();
246+
247+
var extensionlessName = Path.GetFileNameWithoutExtension(path);
248+
249+
if (reader.NodeType is not XmlNodeType.Comment)
250+
return new ThemeData(extensionlessName, extensionlessName);
251+
252+
var commentLines = reader.Value.Trim().Split('\n').Select(v => v.Trim());
253+
254+
var name = extensionlessName;
255+
bool? isDark = null;
256+
bool? hasBlur = null;
257+
foreach (var line in commentLines)
258+
{
259+
if (line.StartsWith(ThemeMetadataNamePrefix, StringComparison.OrdinalIgnoreCase))
260+
{
261+
name = line.Remove(0, ThemeMetadataNamePrefix.Length).Trim();
262+
}
263+
else if (line.StartsWith(ThemeMetadataIsDarkPrefix, StringComparison.OrdinalIgnoreCase))
264+
{
265+
isDark = bool.Parse(line.Remove(0, ThemeMetadataIsDarkPrefix.Length).Trim());
266+
}
267+
else if (line.StartsWith(ThemeMetadataHasBlurPrefix, StringComparison.OrdinalIgnoreCase))
268+
{
269+
hasBlur = bool.Parse(line.Remove(0, ThemeMetadataHasBlurPrefix.Length).Trim());
270+
}
271+
}
272+
273+
return new ThemeData(extensionlessName, name, isDark, hasBlur);
233274
}
234275

235276
private string GetThemePath(string themeName)
@@ -407,5 +448,7 @@ private void SetWindowAccent(Window w, AccentState state)
407448
Marshal.FreeHGlobal(accentPtr);
408449
}
409450
#endregion
451+
452+
public record ThemeData(string FileNameWithoutExtension, string Name, bool? IsDark = null, bool? HasBlur = null);
410453
}
411454
}

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public string Theme
5555
OnPropertyChanged(nameof(MaxResultsToShow));
5656
}
5757
}
58-
public bool UseDropShadowEffect { get; set; } = false;
58+
public bool UseDropShadowEffect { get; set; } = true;
5959

6060
/* Appearance Settings. It should be separated from the setting later.*/
6161
public double WindowHeightSize { get; set; } = 42;

Flow.Launcher/App.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<ui:XamlControlsResources />
2626
<ResourceDictionary Source="pack://application:,,,/Resources/CustomControlTemplate.xaml" />
2727
<ResourceDictionary Source="pack://application:,,,/Resources/SettingWindowStyle.xaml" />
28-
<ResourceDictionary Source="pack://application:,,,/Themes/Win11System.xaml" />
28+
<ResourceDictionary Source="pack://application:,,,/Themes/Win11Light.xaml" />
2929
<ResourceDictionary Source="pack://application:,,,/Languages/en.xaml" />
3030
</ResourceDictionary.MergedDictionaries>
3131
</ResourceDictionary>

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<OutputType>WinExe</OutputType>
55
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
66
<UseWPF>true</UseWPF>
7-
<UseWindowsForms>true</UseWindowsForms>
7+
<UseWindowsForms>false</UseWindowsForms>
88
<StartupObject>Flow.Launcher.App</StartupObject>
99
<ApplicationIcon>Resources\app.ico</ApplicationIcon>
1010
<ApplicationManifest>app.manifest</ApplicationManifest>

Flow.Launcher/Images/app_error.png

-13.2 KB
Loading

Flow.Launcher/Languages/en.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
5858
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
5959
<system:String x:Key="KeepMaxResults">Fixed Window Height</system:String>
60-
<system:String x:Key="KeepMaxResultsToolTip">The window height will not be resizeable by dragging</system:String>
60+
<system:String x:Key="KeepMaxResultsToolTip">The window height is not adjustable by dragging.</system:String>
6161
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
6262
<system:String x:Key="maxShowResultsToolTip">You can also quickly adjust this by using CTRL+Plus and CTRL+Minus.</system:String>
6363
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>
@@ -75,6 +75,7 @@
7575
<system:String x:Key="autoUpdates">Auto Update</system:String>
7676
<system:String x:Key="select">Select</system:String>
7777
<system:String x:Key="hideOnStartup">Hide Flow Launcher on startup</system:String>
78+
<system:String x:Key="hideOnStartupToolTip">Flow Launcher search window is hidden in the tray after starting up.</system:String>
7879
<system:String x:Key="hideNotifyIcon">Hide tray icon</system:String>
7980
<system:String x:Key="hideNotifyIconToolTip">When the icon is hidden from the tray, the Settings menu can be opened by right-clicking on the search window.</system:String>
8081
<system:String x:Key="querySearchPrecision">Query Search Precision</system:String>
@@ -279,6 +280,9 @@
279280
<system:String x:Key="clearlogfolder">Clear Logs</system:String>
280281
<system:String x:Key="clearlogfolderMessage">Are you sure you want to delete all logs?</system:String>
281282
<system:String x:Key="welcomewindow">Wizard</system:String>
283+
<system:String x:Key="userdatapath">User Data Location</system:String>
284+
<system:String x:Key="userdatapathToolTip">User settings and installed plugins are saved in the user data folder. This location may vary depending on whether it's in portable mode or not.</system:String>
285+
<system:String x:Key="userdatapathButton">Open Folder</system:String>
282286

283287
<!-- FileManager Setting Dialog -->
284288
<system:String x:Key="fileManagerWindow">Select File Manager</system:String>

0 commit comments

Comments
 (0)