Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
220 commits
Select commit Hold shift + click to select a range
efd34c9
Draft Query Shortcut
taooceros Dec 23, 2021
4340c08
Draft Query Shortcut
taooceros Dec 23, 2021
2fa0b52
Merge remote-tracking branch 'origin/Shortcut' into Shortcut
taooceros Dec 23, 2021
0a8405f
Resolve issue and add partial replacement trick
taooceros Mar 1, 2022
0d355bd
Draft Query Shortcut
taooceros Dec 23, 2021
2bb8812
Resolve issue and add partial replacement trick
taooceros Mar 1, 2022
9ccebd9
Merge remote-tracking branch 'origin/Shortcut' into Shortcut
taooceros Mar 1, 2022
b837d45
Merge remote-tracking branch 'origin/dev' into Shortcut
taooceros Mar 1, 2022
4d42e52
- Move the 'Shorcut' to Hotkey tab from General
onesounds Mar 1, 2022
c0a61c0
slightly code adjustment
taooceros Mar 26, 2022
d60ba01
Implement {clipboard} feature and the setting panel
taooceros Jun 4, 2022
8ebdff0
Merge branch 'dev' into Shortcut
taooceros Jun 4, 2022
0c75dfe
Update delete message
taooceros Jun 4, 2022
806720d
Remove ignore executable check
taooceros Jun 7, 2022
3b0551f
- Add Clock Code
onesounds Aug 31, 2022
5c2a885
- Adjust Date Cultural info
onesounds Aug 31, 2022
a8bdb34
- Adjust Clock Color
onesounds Aug 31, 2022
4bb6ea9
- Adjust Alignment and color
onesounds Sep 1, 2022
9dc86fd
- Add Clock/Date Colors in Themes
onesounds Sep 1, 2022
d2332ab
- Add Clock/Date in SettingWindow
onesounds Sep 1, 2022
609e8e8
Remove testing code
taooceros Sep 1, 2022
5758d96
Merge branch 'dev' into clock
onesounds Sep 3, 2022
8e6af08
Add Clock/Date Format Combobox UI in settingswindow
onesounds Sep 5, 2022
7ae6f2a
- Add Timeformat to changable list
onesounds Sep 5, 2022
7e0ef2a
- Refresh Preview when Change Time/Date Format
onesounds Sep 5, 2022
61cdc73
- Toggle Clock/Date Display in Theme Preview
onesounds Sep 5, 2022
19001a4
Add Drag Test Code
onesounds Sep 8, 2022
0566a6c
Change the clock to it cannot be clicked
onesounds Sep 27, 2022
8e245f0
Merge branch 'dev' into DragandDrop
onesounds Sep 28, 2022
3e128e1
Changed listitem to draggable
onesounds Sep 28, 2022
dde5a51
Adjust Drag and drop code
onesounds Sep 28, 2022
d0c281e
- Add "Move"
onesounds Sep 28, 2022
e4fddab
Merge branch 'dev' into clock
onesounds Sep 29, 2022
cd79a2a
Merge branch 'dev' into clock
onesounds Sep 29, 2022
7499900
Change the default drag action to copy (shift+drag to move)
onesounds Sep 29, 2022
295f561
Merge branch 'dev' into DragandDrop
onesounds Sep 29, 2022
52cd8a8
Adjust Clock Code
onesounds Oct 3, 2022
1af8101
Merge branch 'dev' into clock
onesounds Oct 3, 2022
aa75aa6
Fix Formatting
onesounds Oct 3, 2022
9db654b
Merge branch 'dev' into DragandDrop
onesounds Oct 3, 2022
3d20a60
Rename ShortcutModel to CustomShortcutModel
VictoriousRaptor Oct 5, 2022
099b1d6
Rename Settings.ShortCuts to CustomShortcuts
VictoriousRaptor Oct 5, 2022
99d1807
Move CustomShortcutModel definition to a new file
VictoriousRaptor Oct 5, 2022
26b14c4
Add Install/New/Updated Label in plugin store
onesounds Oct 7, 2022
5e7ee68
Merge branch 'PluginSearchTextBox' into InstalledLabel5
onesounds Oct 8, 2022
15df419
- Change list order
onesounds Oct 8, 2022
bc47671
User ViewModel to separate logic
taooceros Oct 8, 2022
a0c70a3
Inherit
VictoriousRaptor Oct 8, 2022
c2b1481
Warn if trying to add existing shortcut
VictoriousRaptor Oct 8, 2022
e789948
Text update
VictoriousRaptor Oct 8, 2022
e3e0545
- Fix Mode to oneway
onesounds Oct 8, 2022
b7e51e5
Fix Install Button
onesounds Oct 8, 2022
f3c4120
Shortcut settings dialog preview & text & bugfix
VictoriousRaptor Oct 8, 2022
03d8b50
Fix Default TimeFormat
onesounds Oct 11, 2022
f97fdaf
Merge Dev
onesounds Oct 11, 2022
517d644
Merge branch 'dev' into InstalledLabel5
onesounds Oct 11, 2022
6b2a78e
- Add Uninstall / Update Btn
onesounds Oct 11, 2022
f1c2dfe
Merge branch 'InstalledLabel5' of https://github.com/onesounds/Flow.L…
onesounds Oct 11, 2022
b970fdc
- rename LabelUpdate from LabelUpdated
onesounds Oct 11, 2022
50702d8
Refactor Clcok/Date code to viewmodel
taooceros Oct 12, 2022
f4ce4bf
- Add Launcher Positioning combobox in SettingWindow
onesounds Sep 7, 2022
a69bbac
- Adjust Top Positioning
onesounds Sep 7, 2022
4fae112
- Add LeftTop / RightTop Option
onesounds Sep 7, 2022
7653d0e
- Change String "Remember Last Launch Location" to "Remember Last Loc…
onesounds Sep 7, 2022
ad50c38
- Add Positioning Reset in Tray
onesounds Sep 7, 2022
3c8acaa
Add "dash" in item for easy to read
onesounds Sep 14, 2022
b81e229
Checkbox to Toggle
onesounds Oct 12, 2022
106c4fa
Focus Visual Property move to style
onesounds Oct 12, 2022
7376ced
Formatting
onesounds Oct 12, 2022
bb49b73
Formatting & Seperate Style
onesounds Oct 12, 2022
978e2ed
Fix Theme Preview Blurry
onesounds Oct 12, 2022
d1bfd1c
- Change the if code to switch.
onesounds Oct 13, 2022
5eca096
Merge branch 'dev' into InstalledLabel5
onesounds Oct 13, 2022
6bcb8e5
Fix Button Align
onesounds Oct 13, 2022
b9bc700
Merge branch 'InstalledLabel5' of https://github.com/onesounds/Flow.L…
onesounds Oct 13, 2022
5879c84
Show builtin vars in shortcut list
VictoriousRaptor Oct 13, 2022
334d58d
Fix json load
VictoriousRaptor Oct 13, 2022
d394d86
Bugfix
VictoriousRaptor Oct 13, 2022
cde272a
Fix hard-coded text
VictoriousRaptor Oct 13, 2022
c733b95
Merge branch 'dev' into clock
onesounds Oct 14, 2022
23ecd39
Separate custom & built-in shortcuts
VictoriousRaptor Oct 15, 2022
ce60f41
bugfix
VictoriousRaptor Oct 15, 2022
951ba4c
Add Listview for builtin shortcuts
VictoriousRaptor Oct 16, 2022
750cfa4
Support .url file
LeLocTai Oct 16, 2022
2489bfa
Merge pull request #1474 from VictoriousRaptor/Shortcut
taooceros Oct 17, 2022
3372a40
Fix mixed usage of \t and space
VictoriousRaptor Oct 17, 2022
40dda13
Merge branch 'Flow-Launcher:Shortcut' into Shortcut
VictoriousRaptor Oct 17, 2022
fe5859a
Merge pull request #1478 from VictoriousRaptor/Shortcut
jjw24 Oct 17, 2022
3ee5954
Merge branch 'dev' into CheckBoxToToggleBtn
onesounds Oct 18, 2022
88d84b4
Merge Dev
onesounds Oct 19, 2022
21c944e
Fix Conflict
onesounds Oct 19, 2022
985003c
Rename Positioning function
onesounds Oct 19, 2022
c2e002b
Change default position to MouseScreenCenter
onesounds Oct 19, 2022
9490fd2
Merge branch 'dev' into PositionOption
onesounds Oct 19, 2022
17e6719
Fix Positioning when use quickadjust
onesounds Oct 19, 2022
e9fc508
Merge branch 'PositionOption' of https://github.com/onesounds/Flow.La…
onesounds Oct 19, 2022
be4621a
Merge branch 'dev' into DragandDrop
onesounds Oct 19, 2022
f806c23
Fix UWP icon missing issue
VictoriousRaptor Oct 19, 2022
3aad7a6
Changed Toggle from checkbox in Show Hotkey / Proxy
onesounds Oct 20, 2022
4ea1d40
- Fix Plugin Expander Clikable Area
onesounds Oct 20, 2022
b3e732a
Fix Content Panel Color
onesounds Oct 20, 2022
192b13e
Merge branch 'dev' into CheckBoxToToggleBtn
onesounds Oct 20, 2022
5e9aa64
Change Close Button Color (White from Black)
onesounds Oct 20, 2022
19bd346
Merge branch 'CheckBoxToToggleBtn' of https://github.com/onesounds/Fl…
onesounds Oct 20, 2022
2f1dba8
add Position Rest tool tip
jjw24 Oct 20, 2022
bcaa25a
update variable names to SearchWindowPosition
jjw24 Oct 20, 2022
00d9502
formatting
jjw24 Oct 20, 2022
8a5895f
remove obsolete SearchWindowPositionSelectedIndexChanged
jjw24 Oct 20, 2022
b80b3ed
Merge pull request #1367 from onesounds/PositionOption
jjw24 Oct 20, 2022
d533c5e
Try to find in Assets\ if logo doesn't exist
VictoriousRaptor Oct 20, 2022
9d40053
Merge branch 'dev' into FixProgramIcons
VictoriousRaptor Oct 20, 2022
4a15263
Changed the Icon 'IsHitTestVisible'
onesounds Oct 22, 2022
b559ad1
Adjust Text / Change Button / Add Layout
onesounds Oct 22, 2022
c27761e
- Adjust Strings
onesounds Oct 22, 2022
24ad8ed
Adjust Strings and add guide text
onesounds Oct 22, 2022
d5be961
Adjust margin
onesounds Oct 22, 2022
e154b12
- Add GroupName
onesounds Oct 23, 2022
b9afa13
Adjust Label / Fix Order
onesounds Oct 23, 2022
ad3fd4a
Fix Search / Removed Purple Icon
onesounds Oct 23, 2022
d13c381
Data binding for suffixes
VictoriousRaptor Oct 23, 2022
b77a8f7
Fix suffixes
VictoriousRaptor Oct 23, 2022
1715f81
protocols setting
VictoriousRaptor Oct 23, 2022
5103b2b
Update text
VictoriousRaptor Oct 23, 2022
48527e8
Adjust Colors
onesounds Oct 23, 2022
642ea4a
bugfix
VictoriousRaptor Oct 23, 2022
6f46504
Adjust text
VictoriousRaptor Oct 23, 2022
234156b
Move code to ResultListBox to avoid extra children retrieval.
taooceros Oct 23, 2022
2ba1559
bugfix
VictoriousRaptor Oct 24, 2022
568dced
Check null
VictoriousRaptor Oct 24, 2022
c8dfd56
Check if url field is null
VictoriousRaptor Oct 24, 2022
af7539a
Merge branch 'dev' into dev
VictoriousRaptor Oct 24, 2022
de5c039
Merge Dev
onesounds Oct 25, 2022
cd6140d
Fix Conflicts
onesounds Oct 25, 2022
fe4d251
Adjust Expander & Toggle
onesounds Oct 26, 2022
addac0d
Adjust Template
onesounds Oct 26, 2022
a3674de
Adjust Expander Arrow Color
onesounds Oct 26, 2022
8ac873b
remove comments
VictoriousRaptor Oct 28, 2022
8dd24de
update category strings to constants
jjw24 Oct 28, 2022
3fcae23
move plugin install/uninstall/update calls from View to ViewModel
jjw24 Oct 28, 2022
cea9c5b
update language file keys
jjw24 Oct 28, 2022
73335dd
Merge pull request #1457 from onesounds/InstalledLabel5
jjw24 Oct 28, 2022
3af296e
Try to get 44x44 logo
VictoriousRaptor Oct 28, 2022
9ca67ac
Change logic to not do anything if file not exist.
taooceros Oct 30, 2022
c194d21
Fix IcoPath for epic urls
VictoriousRaptor Oct 30, 2022
902c88d
fix typo
VictoriousRaptor Oct 30, 2022
0ab82de
Try to find logo closest to 44x44
VictoriousRaptor Oct 31, 2022
d1bb08a
Merge branch 'dev' into dev
VictoriousRaptor Nov 1, 2022
cc65562
Save settings
VictoriousRaptor Nov 1, 2022
0357b32
Merge remote-tracking branch 'onesounds/dev' into clock
jjw24 Nov 1, 2022
6da3ca5
revert deleted sln config
jjw24 Nov 1, 2022
e54c91d
formatting
jjw24 Nov 1, 2022
0dd25f0
Merge pull request #1354 from onesounds/clock
jjw24 Nov 1, 2022
81555ec
formatting
jjw24 Nov 1, 2022
e17ec6a
Merge pull request #1476 from LeLocTai/dev
VictoriousRaptor Nov 1, 2022
a3a50cd
Backward compatibilty
VictoriousRaptor Nov 2, 2022
51f5b42
Text update
VictoriousRaptor Nov 2, 2022
171ac07
Merge branch 'dev' into Fix-1476
VictoriousRaptor Nov 2, 2022
4232ef7
Merge pull request #1508 from VictoriousRaptor/Fix-1476
VictoriousRaptor Nov 2, 2022
e1220ee
Merge branch 'dev' into FixProgramIcons
VictoriousRaptor Nov 2, 2022
cbb5400
Fix Store Layout for Memory leak
onesounds Nov 2, 2022
0d610ab
Adjust Images Quality
onesounds Nov 2, 2022
e065743
remove await to speedup startup
VictoriousRaptor Nov 2, 2022
1f8506a
Add Virtualizing WrapPanel
onesounds Nov 2, 2022
8882476
Adjust VirtualWrappanel
onesounds Nov 2, 2022
d3a9d1e
Fix SelectionMode
onesounds Nov 2, 2022
805680e
Merge pull request #1511 from VictoriousRaptor/FixPluginManifestUpdat…
taooceros Nov 2, 2022
cbbb3b8
Merge branch 'dev' into Shortcut
VictoriousRaptor Nov 2, 2022
532f7ce
Fix merging
VictoriousRaptor Nov 2, 2022
3d36513
Add MinHeight for ListViews
VictoriousRaptor Nov 2, 2022
12721bc
Revert accidental change in Log.cs
VictoriousRaptor Nov 2, 2022
0eedb7b
renaming
VictoriousRaptor Nov 3, 2022
165aa90
Fix indexing unwanted protocols in custom sources
VictoriousRaptor Nov 3, 2022
b1c8fa3
Adjust Layout
onesounds Nov 3, 2022
fbc3110
fix test output display
jjw24 Nov 3, 2022
1296b0e
minor changes
VictoriousRaptor Nov 3, 2022
fc7ed31
Use reference when editing
VictoriousRaptor Nov 3, 2022
b8a68fe
Check after merging all win32 programs
VictoriousRaptor Nov 3, 2022
3a56bf4
Merge pull request #1514 from VictoriousRaptor/Fix1476
VictoriousRaptor Nov 4, 2022
473626f
Fix duplicates when editing
VictoriousRaptor Nov 4, 2022
8d4a21e
Merge remote-tracking branch 'upstream/dev' into FixProgramIcons
VictoriousRaptor Nov 4, 2022
44c541b
Fix path case in comparison
VictoriousRaptor Nov 4, 2022
7d87292
add score adjust for a match that is closer to the start of string
jjw24 Nov 4, 2022
1fe701f
Adjust Layout
onesounds Nov 4, 2022
92a9662
add testing for tail end string match
jjw24 Nov 4, 2022
212565a
Adjust Layout
onesounds Nov 4, 2022
629e7ab
Adjust Color
onesounds Nov 4, 2022
14c137a
Merge pull request #1516 from Flow-Launcher/update_stringmatcher_scor…
jjw24 Nov 4, 2022
7fe81b4
Add text
VictoriousRaptor Nov 6, 2022
977ec33
Move logic to viewmodel
VictoriousRaptor Nov 6, 2022
5d3e6e0
Move dialog logic to vm
VictoriousRaptor Nov 6, 2022
019019e
Fix
VictoriousRaptor Nov 6, 2022
69bca5d
Merge branch 'dev' into DragandDrop
taooceros Nov 6, 2022
b47206e
add requery to refresh the results after drag
jjw24 Nov 7, 2022
9bbd01a
add drag and drop for folders
jjw24 Nov 7, 2022
6efd288
add reset for query string
jjw24 Nov 7, 2022
49b9e97
Merge pull request #1428 from onesounds/DragandDrop
jjw24 Nov 7, 2022
d8b2083
Virtualizing the plugin list
taooceros Nov 7, 2022
83fc4c8
revert removal of snaptodevicepixels
taooceros Nov 7, 2022
224b1df
Translate BuiltinShortcut desc
VictoriousRaptor Nov 7, 2022
9ccdf59
change text textbox when expanding builtin shortcuts
VictoriousRaptor Nov 7, 2022
588ef4b
Merge pull request #930 from Flow-Launcher/Shortcut
jjw24 Nov 7, 2022
903aec5
bugfix
VictoriousRaptor Nov 8, 2022
5a0e432
Fix issue when clipboard is empty
VictoriousRaptor Nov 8, 2022
4a6e298
Merge branch 'dev' into Shortcut
VictoriousRaptor Nov 8, 2022
77fff6c
Merge pull request #1521 from Flow-Launcher/Shortcut
VictoriousRaptor Nov 8, 2022
e941364
- Change Install UI
onesounds Nov 8, 2022
3c1451e
Change Plugin Store Icon Image Rendermode
onesounds Nov 8, 2022
55d2bdd
Merge branch 'dev' into FixMemoryLeak
onesounds Nov 8, 2022
3a55cb4
Remove unused method
onesounds Nov 8, 2022
03c9a1a
Merge branch 'FixMemoryLeak' of https://github.com/onesounds/Flow.Lau…
onesounds Nov 8, 2022
6e76d87
Add VirtualPanel in other scrollviews
onesounds Nov 8, 2022
ad77ecd
Set VirtualizingPanel.ScrollUnit and ScrollViewer.CanContentScroll fo…
taooceros Nov 8, 2022
07f82ef
Change Cancontentscroll in general tab / add flyout hidden in uninsta…
onesounds Nov 9, 2022
66cdc88
Merge pull request #1510 from onesounds/FixMemoryLeak
jjw24 Nov 10, 2022
841501f
fix grouping disappear when item refreshed
taooceros Nov 11, 2022
a2c2da0
Merge pull request #1492 from VictoriousRaptor/FixProgramIcons
VictoriousRaptor Nov 11, 2022
9ac5d42
Merge pull request #1527 from Flow-Launcher/refresh_grouping
taooceros Nov 11, 2022
fa47398
Fix Colors / Click Areas / Changed Checkboxes to ToggleSwitch / Adjus…
onesounds Nov 11, 2022
d96e291
Fix PluginStoreItem Color (Darkmode)
onesounds Nov 11, 2022
3fd67b9
Merge dev
onesounds Nov 11, 2022
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
7 changes: 6 additions & 1 deletion Flow.Launcher.Core/ExternalPlugins/UserPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Flow.Launcher.Core.ExternalPlugins
using System;

namespace Flow.Launcher.Core.ExternalPlugins
{
public record UserPlugin
{
Expand All @@ -12,5 +14,8 @@ public record UserPlugin
public string UrlDownload { get; set; }
public string UrlSourceCode { get; set; }
public string IcoPath { get; set; }
public DateTime LatestReleaseDate { get; set; }
public DateTime DateAdded { get; set; }

}
}
2 changes: 1 addition & 1 deletion Flow.Launcher.Infrastructure/Logger/Log.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Diagnostics;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using NLog;
Expand Down
16 changes: 14 additions & 2 deletions Flow.Launcher.Infrastructure/StringMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
if (allQuerySubstringsMatched)
{
var nearestSpaceIndex = CalculateClosestSpaceIndex(spaceIndices, firstMatchIndex);
var score = CalculateSearchScore(query, stringToCompare, firstMatchIndex - nearestSpaceIndex - 1,

// firstMatchIndex - nearestSpaceIndex - 1 is to set the firstIndex as the index of the first matched char
// preceded by a space e.g. 'world' matching 'hello world' firstIndex would be 0 not 6
// giving more weight than 'we or donald' by allowing the distance calculation to treat the starting position at after the space.
var score = CalculateSearchScore(query, stringToCompare, firstMatchIndex - nearestSpaceIndex - 1, spaceIndices,
lastMatchIndex - firstMatchIndex, allSubstringsContainedInCompareString);

var resultList = indexList.Select(x => translationMapping?.MapToOriginalIndex(x) ?? x).Distinct().ToList();
Expand Down Expand Up @@ -296,14 +300,22 @@ private static bool AllQuerySubstringsMatched(int currentQuerySubstringIndex, in
return currentQuerySubstringIndex >= querySubstringsLength;
}

private static int CalculateSearchScore(string query, string stringToCompare, int firstIndex, int matchLen,
private static int CalculateSearchScore(string query, string stringToCompare, int firstIndex, List<int> spaceIndices, int matchLen,
bool allSubstringsContainedInCompareString)
{
// A match found near the beginning of a string is scored more than a match found near the end
// A match is scored more if the characters in the patterns are closer to each other,
// while the score is lower if they are more spread out
var score = 100 * (query.Length + 1) / ((1 + firstIndex) + (matchLen + 1));

// Give more weight to a match that is closer to the start of the string.
// if the first matched char is immediately before space and all strings are contained in the compare string e.g. 'world' matching 'hello world'
// and 'world hello', because both have 'world' immediately preceded by space, their firstIndex will be 0 when distance is calculated,
// to prevent them scoring the same, we adjust the score by deducting the number of spaces it has from the start of the string, so 'world hello'
// will score slightly higher than 'hello world' because 'hello world' has one additional space.
if (firstIndex == 0 && allSubstringsContainedInCompareString)
score -= spaceIndices.Count;

// A match with less characters assigning more weights
if (stringToCompare.Length - query.Length < 5)
{
Expand Down
65 changes: 65 additions & 0 deletions Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System;
using System.Text.Json.Serialization;

namespace Flow.Launcher.Infrastructure.UserSettings
{
public abstract class ShortcutBaseModel
{
public string Key { get; set; }

[JsonIgnore]
public Func<string> Expand { get; set; } = () => { return ""; };

public override bool Equals(object obj)
{
return obj is ShortcutBaseModel other &&
Key == other.Key;
}

public override int GetHashCode()
{
return Key.GetHashCode();
}
}

public class CustomShortcutModel : ShortcutBaseModel
{
public string Value { get; set; }

[JsonConstructorAttribute]
public CustomShortcutModel(string key, string value)
{
Key = key;
Value = value;
Expand = () => { return Value; };
}

public void Deconstruct(out string key, out string value)
{
key = Key;
value = Value;
}

public static implicit operator (string Key, string Value)(CustomShortcutModel shortcut)
{
return (shortcut.Key, shortcut.Value);
}

public static implicit operator CustomShortcutModel((string Key, string Value) shortcut)
{
return new CustomShortcutModel(shortcut.Key, shortcut.Value);
}
}

public class BuiltinShortcutModel : ShortcutBaseModel
{
public string Description { get; set; }

public BuiltinShortcutModel(string key, string description, Func<string> expand)
{
Key = key;
Description = description;
Expand = expand ?? (() => { return ""; });
}
}
}
25 changes: 22 additions & 3 deletions Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.ObjectModel;
using System.Drawing;
using System.Text.Json.Serialization;
using System.Windows;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedModels;
using Flow.Launcher;
Expand Down Expand Up @@ -41,6 +42,10 @@ public string Language
public bool UseGlyphIcons { get; set; } = true;
public bool UseAnimation { get; set; } = true;
public bool UseSound { get; set; } = true;
public bool UseClock { get; set; } = true;
public bool UseDate { get; set; } = false;
public string TimeFormat { get; set; } = "hh:mm tt";
public string DateFormat { get; set; } = "MM'/'dd ddd";
public bool FirstLaunch { get; set; } = true;

public double SettingWindowWidth { get; set; } = 1000;
Expand Down Expand Up @@ -125,8 +130,7 @@ public CustomBrowserViewModel CustomBrowser
PrivateArg = "-private",
EnablePrivate = false,
Editable = false
}
,
},
new()
{
Name = "MS Edge",
Expand Down Expand Up @@ -182,6 +186,13 @@ public string QuerySearchPrecisionString

public ObservableCollection<CustomPluginHotkey> CustomPluginHotkeys { get; set; } = new ObservableCollection<CustomPluginHotkey>();

public ObservableCollection<CustomShortcutModel> CustomShortcuts { get; set; } = new ObservableCollection<CustomShortcutModel>();

[JsonIgnore]
public ObservableCollection<BuiltinShortcutModel> BuiltinShortcuts { get; set; } = new ObservableCollection<BuiltinShortcutModel>() {
new BuiltinShortcutModel("{clipboard}", "shortcut_clipboard_description", Clipboard.GetText)
};

public bool DontPromptUpdateMsg { get; set; }
public bool EnableUpdateLog { get; set; }

Expand All @@ -199,7 +210,7 @@ public bool HideNotifyIcon
}
public bool LeaveCmdOpen { get; set; }
public bool HideWhenDeactive { get; set; } = true;
public bool RememberLastLaunchLocation { get; set; }
public SearchWindowPositions SearchWindowPosition { get; set; } = SearchWindowPositions.MouseScreenCenter;
public bool IgnoreHotkeysOnFullscreen { get; set; }

public HttpProxy Proxy { get; set; } = new HttpProxy();
Expand All @@ -225,4 +236,12 @@ public enum ColorSchemes
Light,
Dark
}
public enum SearchWindowPositions
{
RememberLastLaunchLocation,
MouseScreenCenter,
MouseScreenCenterTop,
MouseScreenLeftTop,
MouseScreenRightTop
}
}
7 changes: 6 additions & 1 deletion Flow.Launcher.Plugin/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ public class Result
/// user's clipboard when Ctrl + C is pressed on a result. If the text is a file/directory path
/// flow will copy the actual file/folder instead of just the path text.
/// </summary>
public string CopyText { get; set; } = string.Empty;
public string CopyText
{
get => string.IsNullOrEmpty(_copyText) ? SubTitle : _copyText;
set => _copyText = value;
}

/// <summary>
/// This holds the text which can be provided by plugin to help Flow autocomplete text
Expand Down Expand Up @@ -81,6 +85,7 @@ public string IcoPath
/// Delegate to Get Image Source
/// </summary>
public IconDelegate Icon;
private string _copyText = string.Empty;

/// <summary>
/// Information for Glyph Icon (Prioritized than IcoPath/Icon if user enable Glyph Icons)
Expand Down
47 changes: 43 additions & 4 deletions Flow.Launcher.Test/FuzzyMatcherTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,20 @@ public void GivenQueryString_WhenAppliedPrecisionFiltering_ThenShouldReturnGreat
}
}


/// <summary>
/// These are standard match scenarios
/// The intention of this test is provide a bench mark for how much the score has increased from a change.
/// Usually the increase in scoring should not be drastic, increase of less than 10 is acceptable.
/// </summary>
[TestCase(Chrome, Chrome, 157)]
[TestCase(Chrome, LastIsChrome, 147)]
[TestCase(Chrome, LastIsChrome, 145)]
[TestCase("chro", HelpCureHopeRaiseOnMindEntityChrome, 50)]
[TestCase("chr", HelpCureHopeRaiseOnMindEntityChrome, 30)]
[TestCase(Chrome, UninstallOrChangeProgramsOnYourComputer, 21)]
[TestCase(Chrome, CandyCrushSagaFromKing, 0)]
[TestCase("sql", MicrosoftSqlServerManagementStudio, 110)]
[TestCase("sql manag", MicrosoftSqlServerManagementStudio, 121)] //double spacing intended
[TestCase("sql", MicrosoftSqlServerManagementStudio, 109)]
[TestCase("sql manag", MicrosoftSqlServerManagementStudio, 120)] //double spacing intended
public void WhenGivenQueryString_ThenShouldReturn_TheDesiredScoring(
string queryString, string compareString, int expectedScore)
{
Expand Down Expand Up @@ -275,7 +281,40 @@ public void WhenGivenAQuery_Scoring_ShouldGiveMoreWeightToStartOfNewWord(
$"Query: \"{queryString}\"{Environment.NewLine} " +
$"CompareString1: \"{compareString1}\", Score: {compareString1Result.Score}{Environment.NewLine}" +
$"Should be greater than{Environment.NewLine}" +
$"CompareString2: \"{compareString2}\", Score: {compareString1Result.Score}{Environment.NewLine}");
$"CompareString2: \"{compareString2}\", Score: {compareString2Result.Score}{Environment.NewLine}");
}

[TestCase("red", "red colour", "metro red")]
[TestCase("red", "this red colour", "this colour red")]
[TestCase("red", "this red colour", "this colour is very red")]
[TestCase("red", "this red colour", "this colour is surprisingly super awesome red and cool")]
[TestCase("red", "this colour is surprisingly super red very and cool", "this colour is surprisingly super very red and cool")]
public void WhenGivenTwoStrings_Scoring_ShouldGiveMoreWeightToTheStringCloserToIndexZero(
string queryString, string compareString1, string compareString2)
{
// When
var matcher = new StringMatcher { UserSettingSearchPrecision = SearchPrecisionScore.Regular };

// Given
var compareString1Result = matcher.FuzzyMatch(queryString, compareString1);
var compareString2Result = matcher.FuzzyMatch(queryString, compareString2);

Debug.WriteLine("");
Debug.WriteLine("###############################################");
Debug.WriteLine($"QueryString: \"{queryString}\"{Environment.NewLine}");
Debug.WriteLine(
$"CompareString1: \"{compareString1}\", Score: {compareString1Result.Score}{Environment.NewLine}");
Debug.WriteLine(
$"CompareString2: \"{compareString2}\", Score: {compareString2Result.Score}{Environment.NewLine}");
Debug.WriteLine("###############################################");
Debug.WriteLine("");

// Should
Assert.True(compareString1Result.Score > compareString2Result.Score,
$"Query: \"{queryString}\"{Environment.NewLine} " +
$"CompareString1: \"{compareString1}\", Score: {compareString1Result.Score}{Environment.NewLine}" +
$"Should be greater than{Environment.NewLine}" +
$"CompareString2: \"{compareString2}\", Score: {compareString2Result.Score}{Environment.NewLine}");
}

[TestCase("vim", "Vim", "ignoreDescription", "ignore.exe", "Vim Diff", "ignoreDescription", "ignore.exe")]
Expand Down
43 changes: 43 additions & 0 deletions Flow.Launcher/Converters/BoolToVisibilityConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;

namespace Flow.Launcher.Converters
{
public class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture)
{
if (parameter != null)
{
if (value is true)
{
return Visibility.Collapsed;
}

else
{
return Visibility.Visible;
}
}
else {
if (value is true)
{
return Visibility.Visible;
}

else {
return Visibility.Collapsed;
}
}
}

public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException();
}
}
32 changes: 32 additions & 0 deletions Flow.Launcher/Converters/TextConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Globalization;
using System.Windows.Data;
using Flow.Launcher.Core.Resource;
using Flow.Launcher.ViewModel;

namespace Flow.Launcher.Converters
{
public class TextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var ID = value.ToString();
switch(ID)
{
case PluginStoreItemViewModel.NewRelease:
return InternationalizationManager.Instance.GetTranslation("pluginStore_NewRelease");
case PluginStoreItemViewModel.RecentlyUpdated:
return InternationalizationManager.Instance.GetTranslation("pluginStore_RecentlyUpdated");
case PluginStoreItemViewModel.None:
return InternationalizationManager.Instance.GetTranslation("pluginStore_None");
case PluginStoreItemViewModel.Installed:
return InternationalizationManager.Instance.GetTranslation("pluginStore_Installed");
default:
return ID;
}

}

public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException();
}
}
20 changes: 20 additions & 0 deletions Flow.Launcher/Converters/TranslationConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Globalization;
using System.Windows.Data;
using Flow.Launcher.Core.Resource;

namespace Flow.Launcher.Converters
{
public class TranlationConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var key = value.ToString();
if (String.IsNullOrEmpty(key))
return key;
return InternationalizationManager.Instance.GetTranslation(key);
}

public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException();
}
}
Loading