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.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Run the drag gesture on KDE Plasma Wayland
IPedrax44227c25d678
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 4065b353..cf43777b 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -49,7 +49,9 @@ machine that built it. Check a package withXrandr, Xi, Xtst, Xt, XkbCommon, ICE and SM) and CJK fonts for document comparisons. File actions are installed forThunar, Nautilus, Nemo and Dolphin. The first enabled keyboard shortcut uses Thunar's native custom action;close Thunar before changing or pausing that shortcut and reopen it afterwards. Global selected-file queries- and hold gestures are not supported. Wayland can use file actions, the drop zone, watch folders and CLI.+ and hold gestures are not supported. Wayland can use file actions, the drop zone, watch folders and CLI. On KDE Plasma the drag gesture also runs+ there when the user is in the `input` group (libuiohook's libinput back end) and `installer/linux/kwin/filee-donut.js`+ is loaded (it moves the donut window, titled "Filee Donut", to the cursor); see `installer/linux/INSTALL.txt`.- **macOS:** grant Filee Accessibility permission for gestures and Finder Automation permission for selection.Keep the development `.app` at a stable path while testing these permissions. Finder integration is a QuickAction under Services; auto-start uses a per-user LaunchAgent.diff --git a/build/build-portable.ps1 b/build/build-portable.ps1index ec9c5107..e4b217de 100644--- a/build/build-portable.ps1+++ b/build/build-portable.ps1@@ -137,6 +137,7 @@ else {Copy-Item -LiteralPath (Join-Path $root 'installer/linux/install.sh') -Destination $packageCopy-Item -LiteralPath (Join-Path $root 'installer/linux/uninstall.sh') -Destination $packageCopy-Item -LiteralPath (Join-Path $root 'installer/linux/INSTALL.txt') -Destination $package+ Copy-Item -LiteralPath (Join-Path $root 'installer/linux/kwin/filee-donut.js') -Destination $package}Invoke-Checked 'Installer permissions' { chmod +x (Join-Path $package 'install.sh') (Join-Path $package 'uninstall.sh') }$temporaryArchive = "$archive.$([Guid]::NewGuid().ToString('N')).partial"diff --git a/installer/linux/INSTALL.txt b/installer/linux/INSTALL.txtindex 09def096..b03d4ef2 100644--- a/installer/linux/INSTALL.txt+++ b/installer/linux/INSTALL.txt@@ -22,7 +22,19 @@ libicu). Other distributions use different package names. The desktop needs anX11 server (or XWayland), fontconfig, FreeType and the X11 libraries above.X11 supports the global gesture toolbar; it needs libXtst and libXt (libxtst6,libxt6). A native Wayland session has additional input restrictions; use the-drop window and file-manager actions if needed.+drop window and file-manager actions, or the experimental setup below.++Wayland gesture (experimental, KDE Plasma): Filee reads the mouse and keyboard+from /dev/input, which needs the input group, and a KWin script moves the donut+to the cursor because Wayland apps cannot place windows. Members of the input+group can read all keyboard and mouse input, so enable this only if you accept+that. Add yourself, then sign out and in:+ sudo usermod -aG input "$USER"+Then load the script (it lasts until you sign out):+ qdbus6 org.kde.KWin /Scripting loadScript "$HOME/.local/share/filee/application/filee-donut.js" filee-donut+ qdbus6 org.kde.KWin /Scripting start+Wayland cannot say which window is under the cursor, so any Ctrl+drag opens the+invisible donut window; it only shows when files are dragged onto it.Packages are built and smoke-tested on Ubuntu 24.04 and started on Ubuntu 22.04by the automated builds.diff --git a/installer/linux/kwin/filee-donut.js b/installer/linux/kwin/filee-donut.jsnew file mode 100644index 00000000..1547ffe6--- /dev/null+++ b/installer/linux/kwin/filee-donut.js@@ -0,0 +1,30 @@+// KWin script for the experimental Wayland gesture: Wayland gives Filee no cursor position and no say over where its+// window opens, so this moves the donut ("Filee Donut") to the cursor whenever it is mapped.+// Load for this session: qdbus6 org.kde.KWin /Scripting loadScript <this file> filee-donut+// qdbus6 org.kde.KWin /Scripting start+// Remove: qdbus6 org.kde.KWin /Scripting unloadScript filee-donut++function centreOnCursor(w) {+ var p = workspace.cursorPos;+ var g = w.frameGeometry;+ var x = Math.round(p.x - g.width / 2);+ var y = Math.round(p.y - g.height / 2);+ if (g.x !== x || g.y !== y) {+ w.frameGeometry = { x: x, y: y, width: g.width, height: g.height };+ }+}++workspace.windowAdded.connect(function (w) {+ if (w.caption !== "Filee Donut") {+ return;+ }+ // Filee also positions the window itself (twice, to cope with DPI changes), so win the last few moves.+ var left = 4;+ centreOnCursor(w);+ w.frameGeometryChanged.connect(function () {+ if (left > 0) {+ left--;+ centreOnCursor(w);+ }+ });+});diff --git a/src/Filee.App/Services/Triggers/TriggerService.cs b/src/Filee.App/Services/Triggers/TriggerService.csindex e1226487..f4a78dce 100644--- a/src/Filee.App/Services/Triggers/TriggerService.cs+++ b/src/Filee.App/Services/Triggers/TriggerService.cs@@ -113,11 +113,14 @@ public sealed class TriggerService : IDisposable{if (Trace)_log.LogInformation("Trace: press {Button} at {X},{Y}, mask {Mask} = {Modifiers}", e.Data.Button, e.Data.X, e.Data.Y, e.RawEvent.Mask, Map(e.RawEvent.Mask));+ _relX = _relY = 0; // Wayland reports presses at (0, 0), so relative motion is counted from the press_detector.MouseDown(Map(e.Data.Button), e.Data.X, e.Data.Y, Map(e.RawEvent.Mask));};_hook.MouseReleased += (_, e) => _detector.MouseUp(Map(e.Data.Button), e.Data.X, e.Data.Y);_hook.MouseDragged += (_, e) => OnMove(e);_hook.MouseMoved += (_, e) => OnMove(e);+ _hook.MouseDraggedRelative += (_, e) => OnRelativeMove(e);+ _hook.MouseMovedRelative += (_, e) => OnRelativeMove(e);_hook.KeyPressed += (_, e) => _detector.KeyDown(KeyName(e.Data.KeyCode), Map(e.RawEvent.Mask));// Own the actual Run thread. SharpHook's RunAsync task completes BEFORE its finally// clears the native callback, so awaiting that task alone is not a safe restart barrier.@@ -170,6 +173,21 @@ public sealed class TriggerService : IDisposable_detector.MouseMove(e.Data.X, e.Data.Y, Map(e.RawEvent.Mask), HeldButton(e.RawEvent.Mask));}+ // Wayland (experimental). A mouse only gives relative motion there, so the detector gets the distance+ // moved since the last press (enough for the drag threshold). Placing the donut at the real cursor is a KWin+ // script's job (installer/linux/kwin/filee-donut.js), and a long hover drifts until the next press resets it.+ private int _relX, _relY;++ private void OnRelativeMove(MouseHookEventArgs e)+ {+ _relX += e.Data.X;+ _relY += e.Data.Y;+ if (Trace && HeldButton(e.RawEvent.Mask) != TriggerMouseButton.None)+ _log.LogInformation("Trace: relative move {Dx},{Dy} -> {X},{Y}, mask {Mask}", e.Data.X, e.Data.Y, _relX, _relY, e.RawEvent.Mask);+ LastCursor = (_relX, _relY);+ _detector.MouseMove(_relX, _relY, Map(e.RawEvent.Mask), HeldButton(e.RawEvent.Mask));+ }+private bool InScope(TriggerGesture gesture, int x, int y){var process = _platform.ProcessNameAt(x, y);diff --git a/src/Filee.App/Views/RadialWindow.axaml b/src/Filee.App/Views/RadialWindow.axamlindex 699a33d3..86c09bbb 100644--- a/src/Filee.App/Views/RadialWindow.axaml+++ b/src/Filee.App/Views/RadialWindow.axaml@@ -9,7 +9,7 @@xmlns:vm="using:Filee.App.ViewModels"x:Class="Filee.App.Views.RadialWindow"x:DataType="vm:RadialViewModel"- Title="Filee"+ Title="Filee Donut"WindowDecorations="None"Background="Transparent"TransparencyLevelHint="Transparent"diff --git a/src/Filee.Platform.Linux/LinuxPlatformServices.cs b/src/Filee.Platform.Linux/LinuxPlatformServices.csindex 4c62ffb6..11c5de3b 100644--- a/src/Filee.Platform.Linux/LinuxPlatformServices.cs+++ b/src/Filee.Platform.Linux/LinuxPlatformServices.cs@@ -21,17 +21,38 @@ public sealed class LinuxPlatformServices : IPlatformServicesstring.Equals(Environment.GetEnvironmentVariable("XDG_SESSION_TYPE"), "wayland", StringComparison.OrdinalIgnoreCase)|| !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WAYLAND_DISPLAY"));- public bool SupportsGlobalPointerGestures => X11WindowSystem.IsAvailable;+ // Wayland (experimental). libuiohook's libinput backend reads /dev/input, so it only works once the+ // user is in the `input` group. The cursor it reports is estimated from relative motion and can drift.+ private static readonly bool WaylandInputReadable = IsWaylandSession && CanReadInputDevices();++ private static bool CanReadInputDevices()+ {+ try+ {+ foreach (var device in Directory.EnumerateFiles("/dev/input", "event*"))+ {+ try { using var _ = File.OpenRead(device); return true; }+ catch (UnauthorizedAccessException) { }+ }+ }+ catch (IOException) { }+ return false;+ }++ public bool SupportsGlobalPointerGestures => X11WindowSystem.IsAvailable || WaylandInputReadable;public bool SupportsSelectionShortcut => false;public string SelectionShortcutUnavailableReason =>"Linux file managers do not expose a shared selected-file API. Use the Filee context action or its Thunar shortcut.";public string? GlobalPointerGesturesUnavailableReason => SupportsGlobalPointerGestures ? null : IsWaylandSession- ? "The cursor-following gesture requires an X11 desktop session. File actions and the drop zone remain available on Wayland."+ ? "On Wayland the cursor-following gesture reads /dev/input: add your user to the 'input' group and sign in again. File actions and the drop zone work without it.": "The cursor-following gesture requires an X11 display.";public string ThunarShortcutRestartRequired =>"Close Thunar before changing its shortcut, then reopen it to load the Filee action and shortcut.";- public bool IsFileManagerAt(int x, int y) => ProcessNameAt(x, y) is { } name && FileManagers.Contains(name);+ // Wayland can't say which window is under the cursor, so any Ctrl+drag may open the (invisible) donut window;+ // it only shows when files are dragged in. A KWin script could answer this properly.+ public bool IsFileManagerAt(int x, int y) =>+ WaylandInputReadable || ProcessNameAt(x, y) is { } name && FileManagers.Contains(name);public string? ProcessNameAt(int x, int y) => X11WindowSystem.ProcessNameAt(x, y);public IReadOnlyList<string> RunningAppNames() => IPlatformServices.AppNames(X11WindowSystem.ClientProcessNames());diff --git a/tests/Filee.App.Tests/TriggerServiceLifecycleTests.cs b/tests/Filee.App.Tests/TriggerServiceLifecycleTests.csindex b7db9536..31b72e30 100644--- a/tests/Filee.App.Tests/TriggerServiceLifecycleTests.cs+++ b/tests/Filee.App.Tests/TriggerServiceLifecycleTests.cs@@ -1,8 +1,11 @@-// Verifies that retrying gestures waits for the previous native hook to release its shared callback.+// Verifies that retrying gestures waits for the previous native hook to release its shared callback, and that+// Wayland's relative mouse motion still starts a drag gesture.using Avalonia.Headless.XUnit;+using Avalonia.Threading;using Filee.App.Services.Triggers;using Filee.Core.Platform;+using Filee.Core.Settings;using Microsoft.Extensions.Logging.Abstractions;using SharpHook;using SharpHook.Data;@@ -82,6 +85,29 @@ public sealed class TriggerServiceLifecycleTests}}+ [AvaloniaFact]+ public void Relative_motion_since_the_press_starts_a_drag_gesture()+ {+ // Wayland reports presses at (0, 0) and mouse motion only as deltas, so the drag distance is summed from the press.+ var provider = new DelayedProvider();+ provider.AllowExit.Set();+ using var service = Create(provider, () => { });+ service.Apply(new AppSettings());+ GestureEventArgs? started = null;+ service.DragStarted += (_, e) => started = e;+ service.Start();+ Assert.True(SpinWait.SpinUntil(() => provider.Runs == 1, 2000));++ const EventMask held = EventMask.LeftCtrl | EventMask.Button1;+ provider.PostMouse(EventType.MouseMovedRelative, 500, 500, EventMask.None); // before the press: must not count+ provider.PostMouse(EventType.MousePressed, 0, 0, held);+ provider.PostMouse(EventType.MouseDraggedRelative, 3, 0, held); // under the drag threshold+ provider.PostMouse(EventType.MouseDraggedRelative, 3, 1, held); // 6 in total: over it++ Assert.True(SpinWait.SpinUntil(() => { Dispatcher.UIThread.RunJobs(); return started is not null; }, 2000));+ Assert.Equal((6, 1), (started!.X, started.Y));+ }+private static TriggerService Create(DelayedProvider provider, Action key) =>new(new NullPlatformServicesForHooks(), NullLogger<TriggerService>.Instance, () =>{@@ -124,6 +150,20 @@ public sealed class TriggerServiceLifecycleTestsStopRequested.Set();return UioHookResult.Success;}+ public void PostMouse(EventType type, short x, short y, EventMask mask)+ {+ lock (_gate)+ {+ var e = new UioHookEvent+ {+ Type = type,+ Mask = mask,+ Mouse = new MouseEventData { Button = MouseButton.Button1, X = x, Y = y },+ };+ _callback?.Invoke(ref e, _data);+ }+ }+public void PressKey(){lock (_gate)