Skip to content

Commit 2a445e3

Browse files
Merge branch 'dev' into logon_task
2 parents 585b701 + 0893134 commit 2a445e3

File tree

9 files changed

+82
-4
lines changed

9 files changed

+82
-4
lines changed

Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,5 +173,10 @@ public void OpenAppUri(string appUri)
173173
{
174174
_api.OpenAppUri(appUri);
175175
}
176+
177+
public void BackToQueryResults()
178+
{
179+
_api.BackToQueryResults();
180+
}
176181
}
177182
}

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
102102
<PackageReference Include="SemanticVersioning" Version="3.0.0" />
103103
<PackageReference Include="TaskScheduler" Version="2.11.0" />
104-
<PackageReference Include="VirtualizingWrapPanel" Version="2.1.0" />
104+
<PackageReference Include="VirtualizingWrapPanel" Version="2.1.1" />
105105
</ItemGroup>
106106

107107
<ItemGroup>

Flow.Launcher/Helper/WindowsInteropHelper.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,64 @@ public static Point TransformPixelsToDIP(Visual visual, double unitX, double uni
148148

149149
return new Point((int)(matrix.M11 * unitX), (int)(matrix.M22 * unitY));
150150
}
151+
152+
#region Alt Tab
153+
154+
private static int SetWindowLong(HWND hWnd, WINDOW_LONG_PTR_INDEX nIndex, int dwNewLong)
155+
{
156+
PInvoke.SetLastError(WIN32_ERROR.NO_ERROR); // Clear any existing error
157+
158+
var result = PInvoke.SetWindowLong(hWnd, nIndex, dwNewLong);
159+
if (result == 0 && Marshal.GetLastPInvokeError() != 0)
160+
{
161+
throw new Win32Exception(Marshal.GetLastPInvokeError());
162+
}
163+
164+
return result;
165+
}
166+
167+
/// <summary>
168+
/// Hide windows in the Alt+Tab window list
169+
/// </summary>
170+
/// <param name="window">To hide a window</param>
171+
public static void HideFromAltTab(Window window)
172+
{
173+
var exStyle = GetCurrentWindowStyle(window);
174+
175+
// Add TOOLWINDOW style, remove APPWINDOW style
176+
var newExStyle = ((uint)exStyle | (uint)WINDOW_EX_STYLE.WS_EX_TOOLWINDOW) & ~(uint)WINDOW_EX_STYLE.WS_EX_APPWINDOW;
177+
178+
SetWindowLong(new(new WindowInteropHelper(window).Handle), WINDOW_LONG_PTR_INDEX.GWL_EXSTYLE, (int)newExStyle);
179+
}
180+
181+
/// <summary>
182+
/// Restore window display in the Alt+Tab window list.
183+
/// </summary>
184+
/// <param name="window">To restore the displayed window</param>
185+
public static void ShowInAltTab(Window window)
186+
{
187+
var exStyle = GetCurrentWindowStyle(window);
188+
189+
// Remove the TOOLWINDOW style and add the APPWINDOW style.
190+
var newExStyle = ((uint)exStyle & ~(uint)WINDOW_EX_STYLE.WS_EX_TOOLWINDOW) | (uint)WINDOW_EX_STYLE.WS_EX_APPWINDOW;
191+
192+
SetWindowLong(new(new WindowInteropHelper(window).Handle), WINDOW_LONG_PTR_INDEX.GWL_EXSTYLE, (int)newExStyle);
193+
}
194+
195+
/// <summary>
196+
/// To obtain the current overridden style of a window.
197+
/// </summary>
198+
/// <param name="window">To obtain the style dialog window</param>
199+
/// <returns>current extension style value</returns>
200+
private static int GetCurrentWindowStyle(Window window)
201+
{
202+
var style = PInvoke.GetWindowLong(new(new WindowInteropHelper(window).Handle), WINDOW_LONG_PTR_INDEX.GWL_EXSTYLE);
203+
if (style == 0 && Marshal.GetLastPInvokeError() != 0)
204+
{
205+
throw new Win32Exception(Marshal.GetLastPInvokeError());
206+
}
207+
return style;
208+
}
209+
210+
#endregion
151211
}

Flow.Launcher/MainWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
Closing="OnClosing"
2121
Deactivated="OnDeactivated"
2222
Icon="Images/app.png"
23+
SourceInitialized="OnSourceInitialized"
2324
Initialized="OnInitialized"
2425
Left="{Binding Settings.WindowLeft, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
2526
Loaded="OnLoaded"

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ private async void OnClosing(object sender, CancelEventArgs e)
171171
Environment.Exit(0);
172172
}
173173

174+
private void OnSourceInitialized(object sender, EventArgs e)
175+
{
176+
WindowsInteropHelper.HideFromAltTab(this);
177+
}
178+
174179
private void OnInitialized(object sender, EventArgs e)
175180
{
176181
}

Flow.Launcher/NativeMethods.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ FindWindowEx
1414
WINDOW_STYLE
1515

1616
WM_ENTERSIZEMOVE
17-
WM_EXITSIZEMOVE
17+
WM_EXITSIZEMOVE
18+
19+
SetLastError
20+
WINDOW_EX_STYLE

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
</ItemGroup>
9696

9797
<ItemGroup>
98-
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
98+
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.1" />
9999
</ItemGroup>
100100

101101
</Project>

Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ internal static class Constants
2222
internal const string WindowsIndexErrorImagePath = "Images\\index_error2.png";
2323
internal const string GeneralSearchErrorImagePath = "Images\\robot_error.png";
2424

25-
2625
internal const string ToolTipOpenDirectory = "Ctrl + Enter to open the directory";
2726

2827
internal const string ToolTipOpenContainingFolder = "Ctrl + Enter to open the containing folder";
@@ -31,6 +30,8 @@ internal static class Constants
3130

3231
internal const string DefaultContentSearchActionKeyword = "doc:";
3332

33+
internal const char UnixDirectorySeparator = '/';
34+
3435
internal const char DirectorySeparator = '\\';
3536

3637
internal const string WindowsIndexingOptions = "srchadmin.dll";

Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ private async Task<List<Result>> PathSearchAsync(Query query, CancellationToken
187187
var needToExpand = EnvironmentVariables.HasEnvironmentVar(querySearch);
188188
var path = needToExpand ? Environment.ExpandEnvironmentVariables(querySearch) : querySearch;
189189

190+
// if user uses the unix directory separator, we need to convert it to windows directory separator
191+
path = path.Replace(Constants.UnixDirectorySeparator, Constants.DirectorySeparator);
192+
190193
// Check that actual location exists, otherwise directory search will throw directory not found exception
191194
if (!FilesFolders.ReturnPreviousDirectoryIfIncompleteString(path).LocationExists())
192195
return results.ToList();

0 commit comments

Comments
 (0)