Skip to content

Commit ad7c69c

Browse files
authored
Release 2.1.3 | Plugin 5.3.1 (#4516)
1 parent f7bb0ca commit ad7c69c

29 files changed

Lines changed: 993 additions & 377 deletions

File tree

.github/workflows/default_plugins.yml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ jobs:
5353
files: "Flow.Launcher.Plugin.BrowserBookmark.zip"
5454
tag_name: "v${{steps.updated-version-browserbookmark.outputs.prop}}"
5555
body: Visit Flow's [release notes](https://github.com/Flow-Launcher/Flow.Launcher/releases) for changes.
56-
env:
57-
GITHUB_TOKEN: ${{ secrets.PUBLISH_PLUGINS }}
56+
token: ${{ secrets.PUBLISH_PLUGINS }}
5857

5958

6059
- name: Get Calculator Version
@@ -77,8 +76,7 @@ jobs:
7776
files: "Flow.Launcher.Plugin.Calculator.zip"
7877
tag_name: "v${{steps.updated-version-calculator.outputs.prop}}"
7978
body: Visit Flow's [release notes](https://github.com/Flow-Launcher/Flow.Launcher/releases) for changes.
80-
env:
81-
GITHUB_TOKEN: ${{ secrets.PUBLISH_PLUGINS }}
79+
token: ${{ secrets.PUBLISH_PLUGINS }}
8280

8381

8482
- name: Get Explorer Version
@@ -101,8 +99,7 @@ jobs:
10199
files: "Flow.Launcher.Plugin.Explorer.zip"
102100
tag_name: "v${{steps.updated-version-explorer.outputs.prop}}"
103101
body: Visit Flow's [release notes](https://github.com/Flow-Launcher/Flow.Launcher/releases) for changes.
104-
env:
105-
GITHUB_TOKEN: ${{ secrets.PUBLISH_PLUGINS }}
102+
token: ${{ secrets.PUBLISH_PLUGINS }}
106103

107104

108105
- name: Get PluginIndicator Version
@@ -125,8 +122,7 @@ jobs:
125122
files: "Flow.Launcher.Plugin.PluginIndicator.zip"
126123
tag_name: "v${{steps.updated-version-pluginindicator.outputs.prop}}"
127124
body: Visit Flow's [release notes](https://github.com/Flow-Launcher/Flow.Launcher/releases) for changes.
128-
env:
129-
GITHUB_TOKEN: ${{ secrets.PUBLISH_PLUGINS }}
125+
token: ${{ secrets.PUBLISH_PLUGINS }}
130126

131127

132128
- name: Get PluginsManager Version
@@ -149,8 +145,7 @@ jobs:
149145
files: "Flow.Launcher.Plugin.PluginsManager.zip"
150146
tag_name: "v${{steps.updated-version-pluginsmanager.outputs.prop}}"
151147
body: Visit Flow's [release notes](https://github.com/Flow-Launcher/Flow.Launcher/releases) for changes.
152-
env:
153-
GITHUB_TOKEN: ${{ secrets.PUBLISH_PLUGINS }}
148+
token: ${{ secrets.PUBLISH_PLUGINS }}
154149

155150

156151
- name: Get ProcessKiller Version
@@ -173,8 +168,7 @@ jobs:
173168
files: "Flow.Launcher.Plugin.ProcessKiller.zip"
174169
tag_name: "v${{steps.updated-version-processkiller.outputs.prop}}"
175170
body: Visit Flow's [release notes](https://github.com/Flow-Launcher/Flow.Launcher/releases) for changes.
176-
env:
177-
GITHUB_TOKEN: ${{ secrets.PUBLISH_PLUGINS }}
171+
token: ${{ secrets.PUBLISH_PLUGINS }}
178172

179173

180174
- name: Get Program Version
@@ -197,8 +191,7 @@ jobs:
197191
files: "Flow.Launcher.Plugin.Program.zip"
198192
tag_name: "v${{steps.updated-version-program.outputs.prop}}"
199193
body: Visit Flow's [release notes](https://github.com/Flow-Launcher/Flow.Launcher/releases) for changes.
200-
env:
201-
GITHUB_TOKEN: ${{ secrets.PUBLISH_PLUGINS }}
194+
token: ${{ secrets.PUBLISH_PLUGINS }}
202195

203196

204197
- name: Get Shell Version
@@ -221,8 +214,7 @@ jobs:
221214
files: "Flow.Launcher.Plugin.Shell.zip"
222215
tag_name: "v${{steps.updated-version-shell.outputs.prop}}"
223216
body: Visit Flow's [release notes](https://github.com/Flow-Launcher/Flow.Launcher/releases) for changes.
224-
env:
225-
GITHUB_TOKEN: ${{ secrets.PUBLISH_PLUGINS }}
217+
token: ${{ secrets.PUBLISH_PLUGINS }}
226218

227219

228220
- name: Get Sys Version
@@ -245,8 +237,7 @@ jobs:
245237
files: "Flow.Launcher.Plugin.Sys.zip"
246238
tag_name: "v${{steps.updated-version-sys.outputs.prop}}"
247239
body: Visit Flow's [release notes](https://github.com/Flow-Launcher/Flow.Launcher/releases) for changes.
248-
env:
249-
GITHUB_TOKEN: ${{ secrets.PUBLISH_PLUGINS }}
240+
token: ${{ secrets.PUBLISH_PLUGINS }}
250241

251242

252243
- name: Get Url Version
@@ -269,8 +260,7 @@ jobs:
269260
files: "Flow.Launcher.Plugin.Url.zip"
270261
tag_name: "v${{steps.updated-version-url.outputs.prop}}"
271262
body: Visit Flow's [release notes](https://github.com/Flow-Launcher/Flow.Launcher/releases) for changes.
272-
env:
273-
GITHUB_TOKEN: ${{ secrets.PUBLISH_PLUGINS }}
263+
token: ${{ secrets.PUBLISH_PLUGINS }}
274264

275265

276266
- name: Get WebSearch Version
@@ -293,8 +283,7 @@ jobs:
293283
files: "Flow.Launcher.Plugin.WebSearch.zip"
294284
tag_name: "v${{steps.updated-version-websearch.outputs.prop}}"
295285
body: Visit Flow's [release notes](https://github.com/Flow-Launcher/Flow.Launcher/releases) for changes.
296-
env:
297-
GITHUB_TOKEN: ${{ secrets.PUBLISH_PLUGINS }}
286+
token: ${{ secrets.PUBLISH_PLUGINS }}
298287

299288

300289
- name: Get WindowsSettings Version
@@ -317,5 +306,4 @@ jobs:
317306
files: "Flow.Launcher.Plugin.WindowsSettings.zip"
318307
tag_name: "v${{steps.updated-version-windowssettings.outputs.prop}}"
319308
body: Visit Flow's [release notes](https://github.com/Flow-Launcher/Flow.Launcher/releases) for changes.
320-
env:
321-
GITHUB_TOKEN: ${{ secrets.PUBLISH_PLUGINS }}
309+
token: ${{ secrets.PUBLISH_PLUGINS }}

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,11 @@ public void RemoveDropShadowEffectFromCurrentTheme()
554554
ThemeHelper.CopyStyle(windowBorderStyle, newWindowBorderStyle);
555555

556556
// Copy Setters, excluding the Effect setter and updating the Margin setter
557+
// Only adjust margin if there's actually a shadow effect to remove,
558+
// preventing it from shrinking on repeated calls.
559+
bool hasEffect = windowBorderStyle.Setters.OfType<Setter>()
560+
.Any(s => s.Property == UIElement.EffectProperty);
561+
557562
foreach (var setterBase in windowBorderStyle.Setters)
558563
{
559564
if (setterBase is Setter setter)
@@ -562,7 +567,7 @@ public void RemoveDropShadowEffectFromCurrentTheme()
562567
if (setter.Property == UIElement.EffectProperty) continue;
563568

564569
// Update Margin by subtracting the extra margin we added for the shadow
565-
if (setter.Property == FrameworkElement.MarginProperty)
570+
if (hasEffect && setter.Property == FrameworkElement.MarginProperty)
566571
{
567572
var currentMargin = (Thickness)setter.Value;
568573
var newMargin = new Thickness(
@@ -635,20 +640,8 @@ await Application.Current.Dispatcher.InvokeAsync(() =>
635640
// Get the actual backdrop type and drop shadow effect settings
636641
var (backdropType, useDropShadowEffect) = GetActualValue();
637642

638-
// Remove OS minimizing/maximizing animation
639-
// Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_TRANSITIONS_FORCEDISABLED, 3);
640-
641-
// The timing of adding the shadow effect should vary depending on whether the theme is transparent.
642-
if (BlurEnabled)
643-
{
644-
AutoDropShadow(useDropShadowEffect);
645-
}
646643
SetBlurForWindow(_settings.Theme, backdropType);
647-
648-
if (!BlurEnabled)
649-
{
650-
AutoDropShadow(useDropShadowEffect);
651-
}
644+
AutoDropShadow(useDropShadowEffect);
652645
}, DispatcherPriority.Render);
653646
}
654647

@@ -725,39 +718,42 @@ private void SetBlurForWindow(string theme, BackdropTypes backdropType)
725718
// Apply the blur effect
726719
Win32Helper.DWMSetBackdropForWindow(mainWindow, backdropType);
727720
ColorizeWindow(theme, backdropType);
721+
722+
// DWM renders rounded corners for backdrop windows
723+
SetWindowCornerPreference("Round");
724+
725+
// Clear any stale directly-set WindowBorderStyle that might shadow
726+
// the merged dictionary entry we just modified above.
727+
if (Application.Current.Resources.Contains("WindowBorderStyle"))
728+
Application.Current.Resources.Remove("WindowBorderStyle");
729+
730+
// For blur themes the resize border defaults to the system thickness.
731+
SetResizeBoarderThickness(null);
728732
}
729733
else
730734
{
731735
// Apply default style when Blur is disabled
732736
Win32Helper.DWMSetBackdropForWindow(mainWindow, BackdropTypes.None);
733737
ColorizeWindow(theme, backdropType);
738+
739+
// Non-blur themes use the default window corner preference
740+
SetWindowCornerPreference("Default");
734741
}
735742

736743
UpdateResourceDictionary(dict);
737744
}
738745

739746
private void AutoDropShadow(bool useDropShadowEffect)
740747
{
748+
if (BlurEnabled)
749+
return; // Blur themes have no drop shadow effect
750+
741751
if (useDropShadowEffect)
742752
{
743-
if (BlurEnabled && Win32Helper.IsBackdropSupported())
744-
{
745-
// For themes with blur enabled, the window border is rendered by the system,
746-
// so we set corner preference to round and remove drop shadow effect to avoid rendering issues.
747-
SetWindowCornerPreference("Round");
748-
RemoveDropShadowEffectFromCurrentTheme();
749-
}
750-
else
751-
{
752-
// For themes without blur, we set corner preference to default and add drop shadow effect.
753-
SetWindowCornerPreference("Default");
754-
AddDropShadowEffectToCurrentTheme();
755-
}
753+
AddDropShadowEffectToCurrentTheme();
756754
}
757755
else
758756
{
759-
// When drop shadow effect is disabled, we set corner preference to default and remove drop shadow effect.
760-
SetWindowCornerPreference("Default");
761757
RemoveDropShadowEffectFromCurrentTheme();
762758
}
763759
}

Flow.Launcher.Infrastructure/Constant.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Diagnostics;
1+
using System.Diagnostics;
22
using System.IO;
33
using System.Reflection;
44

@@ -31,8 +31,9 @@ public static class Constant
3131
public static readonly string ErrorIcon = Path.Combine(ImagesDirectory, "app_error.png");
3232
public static readonly string MissingImgIcon = Path.Combine(ImagesDirectory, "app_missing_img.png");
3333
public static readonly string LoadingImgIcon = Path.Combine(ImagesDirectory, "loading.png");
34-
public static readonly string ImageIcon = Path.Combine(ImagesDirectory, "image.png");
3534
public static readonly string HistoryIcon = Path.Combine(ImagesDirectory, "history.png");
35+
public static readonly string SettingsIcon = Path.Combine(ImagesDirectory, "settings.png");
36+
public static readonly string FolderIcon = Path.Combine(ImagesDirectory, "folder.png");
3637

3738
public static string PythonPath;
3839
public static string NodePath;

Flow.Launcher.Infrastructure/Image/ImageHashGenerator.cs

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
using System.IO;
2+
using System.Buffers;
33
using System.Security.Cryptography;
44
using System.Windows.Media;
55
using System.Windows.Media.Imaging;
@@ -10,27 +10,56 @@ public interface IImageHashGenerator
1010
{
1111
string GetHashFromImage(ImageSource image);
1212
}
13+
1314
public class ImageHashGenerator : IImageHashGenerator
1415
{
1516
public string GetHashFromImage(ImageSource imageSource)
1617
{
17-
if (imageSource is not BitmapSource image)
18+
if (imageSource is not BitmapSource { IsFrozen: true } image)
1819
{
1920
return null;
2021
}
2122

2223
try
2324
{
24-
using var outStream = new MemoryStream();
25-
var enc = new JpegBitmapEncoder();
26-
var bitmapFrame = BitmapFrame.Create(image);
27-
bitmapFrame.Freeze();
28-
enc.Frames.Add(bitmapFrame);
29-
enc.Save(outStream);
30-
var byteArray = outStream.GetBuffer();
31-
using var sha1 = SHA1.Create();
32-
var hash = Convert.ToBase64String(sha1.ComputeHash(byteArray));
33-
return hash;
25+
// Normalize to a deterministic pixel format (32-bit premultiplied BGRA)
26+
BitmapSource normalized = image;
27+
if (normalized.Format != PixelFormats.Pbgra32)
28+
{
29+
var converted = new FormatConvertedBitmap();
30+
converted.BeginInit();
31+
converted.Source = normalized;
32+
converted.DestinationFormat = PixelFormats.Pbgra32;
33+
converted.EndInit();
34+
converted.Freeze();
35+
36+
normalized = converted;
37+
}
38+
39+
// Since we forced Pbgra32, we know it is exactly 4 bytes per pixel.
40+
const int bytesPerPixel = 4;
41+
42+
var stride = normalized.PixelWidth * bytesPerPixel;
43+
var bufferSize = stride * normalized.PixelHeight;
44+
45+
if (bufferSize <= 0)
46+
return null;
47+
48+
// Use ArrayPool to prevent Large Object Heap (LOH) allocations for big images
49+
var rentedPixelBuffer = ArrayPool<byte>.Shared.Rent(bufferSize);
50+
51+
try
52+
{
53+
normalized.CopyPixels(rentedPixelBuffer, stride, 0);
54+
55+
// Slice the rented array to the exact buffer size (Rented arrays are often larger than the requested size)
56+
var hashBytes = SHA1.HashData(rentedPixelBuffer.AsSpan(0, bufferSize));
57+
return Convert.ToBase64String(hashBytes);
58+
}
59+
finally
60+
{
61+
ArrayPool<byte>.Shared.Return(rentedPixelBuffer);
62+
}
3463
}
3564
catch
3665
{

0 commit comments

Comments
 (0)