Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Gestures work over Files, Directory Opus and other file managers

KnifeLemon1800e0f59306
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.json
index 52c51462..d31c4114 100644
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@ -278,7 +278,7 @@
"triggers.threshold_system": "System default",
"triggers.hold_ms": "Hold time",
"triggers.scope": "Active in",
- "triggers.scope.FileManager": "Explorer and desktop",
+ "triggers.scope.FileManager": "File managers and desktop",
"triggers.scope.FileManager_macos": "Finder and desktop",
"triggers.scope.FileManager_linux": "File manager and desktop",
"triggers.scope.Anywhere": "Everywhere",
diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.json
index 1c53de4d..0bcf43b9 100644
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@ -278,7 +278,7 @@
"triggers.threshold_system": "시스템 기본값",
"triggers.hold_ms": "누르는 시간",
"triggers.scope": "동작 범위",
- "triggers.scope.FileManager": "탐색기와 바탕화면",
+ "triggers.scope.FileManager": "파일 관리자와 바탕화면",
"triggers.scope.FileManager_macos": "Finder와 데스크탑",
"triggers.scope.FileManager_linux": "파일 관리자와 바탕화면",
"triggers.scope.Anywhere": "모든 곳",
diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.json
index abb0b93a..f7347bb1 100644
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@ -278,7 +278,7 @@
"triggers.threshold_system": "系统默认",
"triggers.hold_ms": "按住时间",
"triggers.scope": "生效范围",
- "triggers.scope.FileManager": "资源管理器和桌面",
+ "triggers.scope.FileManager": "文件管理器和桌面",
"triggers.scope.FileManager_macos": "访达和桌面",
"triggers.scope.FileManager_linux": "文件管理器和桌面",
"triggers.scope.Anywhere": "所有位置",
diff --git a/src/Filee.Core/Settings/TriggerGesture.cs b/src/Filee.Core/Settings/TriggerGesture.cs
index b6bcab5c..d7a870a0 100644
--- a/src/Filee.Core/Settings/TriggerGesture.cs
+++ b/src/Filee.Core/Settings/TriggerGesture.cs
@@ -40,7 +40,10 @@ public enum TriggerKind
/// <summary>Where the gesture is active.</summary>
public enum TriggerScope
{
- /// <summary>Only when the cursor is over the system file manager (Explorer / Finder) or the desktop.</summary>
+ /// <summary>
+ /// Only when the cursor is over a file manager (Explorer, Finder; on Windows also Files, Directory Opus and other
+ /// file managers) or the desktop.
+ /// </summary>
FileManager,
/// <summary>Everywhere, except excluded applications.</summary>
Anywhere,
diff --git a/src/Filee.Platform.Windows/WindowsPlatformServices.cs b/src/Filee.Platform.Windows/WindowsPlatformServices.cs
index 16c3bb6d..11d461b8 100644
--- a/src/Filee.Platform.Windows/WindowsPlatformServices.cs
+++ b/src/Filee.Platform.Windows/WindowsPlatformServices.cs
@@ -25,6 +25,23 @@ public sealed class WindowsPlatformServices : IPlatformServices
"WorkerW", // desktop (when wallpaper slideshow / Win+Tab created a WorkerW)
};
+ /// <summary>
+ /// File managers people use instead of Explorer, by process name (issue #124): their windows count as "over the
+ /// file manager" for gestures too. Dragging files out of them reaches the donut like a drag from Explorer.
+ /// </summary>
+ private static readonly HashSet<string> FileManagerProcesses = new(StringComparer.OrdinalIgnoreCase)
+ {
+ "explorer",
+ "Files", // Files (files.community)
+ "dopus", // Directory Opus
+ "TOTALCMD64", // Total Commander
+ "TOTALCMD",
+ "XYplorer",
+ "OneCommander",
+ "Q-Dir",
+ "FreeCommander",
+ };
+
public void RaiseTopmost(nint windowHandle)
{
if (windowHandle != 0)
@@ -37,10 +54,14 @@ public sealed class WindowsPlatformServices : IPlatformServices
var root = RootWindowAt(x, y);
if (root == 0)
return false;
- return FileManagerClasses.Contains(NativeMethods.ClassNameOf(root))
- || string.Equals(ProcessNameOf(root), "explorer", StringComparison.OrdinalIgnoreCase);
+ return IsFileManager(NativeMethods.ClassNameOf(root), ProcessNameOf(root));
}
+ /// <summary>True for a top-level window of Explorer, the desktop or another file manager.</summary>
+ public static bool IsFileManager(string? windowClass, string? processName) =>
+ windowClass is not null && FileManagerClasses.Contains(windowClass)
+ || processName is not null && FileManagerProcesses.Contains(processName);
+
public string? ProcessNameAt(int x, int y)
{
var root = RootWindowAt(x, y);
diff --git a/tests/Filee.App.Tests/FileManagerScopeTests.cs b/tests/Filee.App.Tests/FileManagerScopeTests.cs
new file mode 100644
index 00000000..ae6759c6
--- /dev/null
+++ b/tests/Filee.App.Tests/FileManagerScopeTests.cs
@@ -0,0 +1,29 @@
+// Gestures set to "File managers and desktop" also start over file managers other than Explorer (issue #124).
+
+using System.Runtime.Versioning;
+using Filee.Platform.Windows;
+
+namespace Filee.App.Tests;
+
+// Plain string checks: they run on every OS, the class is only marked for the Windows-only type.
+[SupportedOSPlatform("windows")]
+public class FileManagerScopeTests
+{
+ [Theory]
+ [InlineData("CabinetWClass", "explorer")]
+ [InlineData("Progman", "explorer")]
+ [InlineData("WinUIDesktopWin32WindowClass", "Files")]
+ [InlineData("dopus.lister", "dopus")]
+ [InlineData("TTOTAL_CMD", "TOTALCMD64")]
+ [InlineData("ThunderRT6FormDC", "XYplorer")]
+ public void Explorer_the_desktop_and_other_file_managers_count(string windowClass, string process) =>
+ Assert.True(WindowsPlatformServices.IsFileManager(windowClass, process));
+
+ [Theory]
+ [InlineData("Chrome_WidgetWin_1", "chrome")]
+ [InlineData("Notepad", "notepad")]
+ [InlineData("WinUIDesktopWin32WindowClass", "FilesBackup")]
+ [InlineData(null, null)]
+ public void Other_programs_dont(string? windowClass, string? process) =>
+ Assert.False(WindowsPlatformServices.IsFileManager(windowClass, process));
+}