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.

address review feedback: opt-in native Wayland, Closed event tracking, and preserve existing installer/drag behaviors

mahaveergurjar6b8276740f6d
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0d21ccca..7d99b79d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -45,14 +45,15 @@ Linux release packages must run on Ubuntu 22.04 (glibc 2.35). CI builds rhwp fro
machine that built it. Check a package with
`python3 build/check-elf-glibc.py --max 2.35 <unpacked package>`. See [docs/ENGINES.md](docs/ENGINES.md#linux-builds-for-older-glibc).
-- **Linux:** drag gestures require X11. Install the Avalonia desktop dependencies (fontconfig, FreeType, X11,
+- **Linux:** drag gestures require X11 by default. Install the Avalonia desktop dependencies (fontconfig, FreeType, X11,
Xrandr, Xi, Xtst, Xt, XkbCommon, ICE and SM) and CJK fonts for document comparisons. File actions are installed for
Thunar, 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.
- On KDE Plasma 6 the drag gesture can also run there, experimentally and only with `FILEE_WAYLAND_GESTURES=1`. It needs
- the user in the `input` group (libuiohook's libinput back end) and the KWin script in `installer/linux/kwin`, which
- moves the donut window (titled "Filee Donut") to the cursor. See `installer/linux/INSTALL.txt`.
+ On KDE Plasma 6 and Hyprland, the drag gesture can also run there, experimentally with `FILEE_WAYLAND_GESTURES=1`. It needs
+ the user in the `input` group (libuiohook's libinput back end) and a compositor positioning mechanism (the KWin script in
+ `installer/linux/kwin` or a Hyprland floating window rule). Native Wayland support (`Avalonia.Wayland`) is also available
+ as an opt-in via `FILEE_USE_WAYLAND=1`. 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 Quick
Action under Services; auto-start uses a per-user LaunchAgent.
diff --git a/installer/linux/INSTALL.txt b/installer/linux/INSTALL.txt
index 2852fddb..9e32b506 100644
--- a/installer/linux/INSTALL.txt
+++ b/installer/linux/INSTALL.txt
@@ -24,10 +24,10 @@ 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, or the experimental setup below.
-Wayland gesture (experimental, KDE Plasma 6 only, off by default): Filee reads
-the mouse and keyboard from /dev/input through libinput, and a KWin script moves
-the donut to the cursor because Wayland apps cannot place windows. It needs
-libinput, libudev and libwayland-client (libinput10, libudev1 and
+Wayland gesture (experimental, KDE Plasma 6 and Hyprland, off by default): Filee reads
+the mouse and keyboard from /dev/input through libinput, and a KWin script or Hyprland
+window rule places the donut at the cursor because Wayland apps cannot place windows.
+It needs libinput, libudev and libwayland-client (libinput10, libudev1 and
libwayland-client0 on Ubuntu). To turn it on:
1. Start Filee with FILEE_WAYLAND_GESTURES=1 in its environment, for example
with the line FILEE_WAYLAND_GESTURES=1 in ~/.config/environment.d/filee.conf
@@ -36,12 +36,21 @@ libwayland-client0 on Ubuntu). To turn it on:
can read all keyboard and mouse input from any program they run, so enable
this only if you accept that. You may already be in it for other tools.
sudo usermod -aG input "$USER"
-3. Install the KWin script and enable it, so it loads at every login (you can
- also enable "Filee donut at the cursor" in System Settings > Window
- Management > KWin Scripts):
+3. For KDE Plasma: Install the KWin script and enable it, so it loads at every login:
kpackagetool6 --type=KWin/Script --install "${XDG_DATA_HOME:-$HOME/.local/share}/filee/application/kwin/filee-donut"
kwriteconfig6 --file kwinrc --group Plugins --key filee-donutEnabled true
qdbus6 org.kde.KWin /KWin reconfigure
+ For Hyprland: Add the floating window rule in ~/.config/hypr/hyprland.conf (or hyprland.lua):
+ windowrulev2 = float, title:^(Filee Donut)$
+ windowrulev2 = noborder, title:^(Filee Donut)$
+ windowrulev2 = noshadow, title:^(Filee Donut)$
+ windowrulev2 = noblur, title:^(Filee Donut)$
+
+Native Wayland Backend (experimental, off by default):
+By default, Filee runs through XWayland on Wayland desktops for maximum compatibility.
+To opt into the native Wayland backend (Avalonia.Wayland):
+ Start Filee with FILEE_USE_WAYLAND=1 in its environment.
+ (e.g., export FILEE_USE_WAYLAND=1 or set in ~/.config/environment.d/filee.conf).
Limits: Wayland cannot say which window is under the cursor, so a Ctrl+drag in
any app opens an invisible donut window. It only shows when files are dragged
onto it, but it rejects drops that are not files, so Ctrl+drag to copy text in an
diff --git a/installer/linux/install.sh b/installer/linux/install.sh
old mode 100755
new mode 100644
index 945350e6..2a3cec01
--- a/installer/linux/install.sh
+++ b/installer/linux/install.sh
@@ -6,17 +6,25 @@ data_dir=${XDG_DATA_HOME:-"$HOME/.local/share"}
install_dir="$data_dir/filee/application"
bin_dir="$HOME/.local/bin"
desktop_file="$data_dir/applications/com.filee.app.desktop"
-
-# Close running Filee instances
-pkill -f "Filee" 2>/dev/null || true
-
+if [ -e "$install_dir" ] || [ -L "$install_dir" ]; then
+ printf '%s\n' "An installation already exists at $install_dir. Run its uninstall.sh first."
+ exit 1
+fi
+if [ -e "$bin_dir/filee" ] || [ -L "$bin_dir/filee" ]; then
+ printf '%s\n' "$bin_dir/filee already exists. Remove or rename it before installing Filee."
+ exit 1
+fi
+if [ -e "$desktop_file" ] || [ -L "$desktop_file" ]; then
+ printf '%s\n' "$desktop_file already exists. Remove or rename it before installing Filee."
+ exit 1
+fi
+command -v python3 >/dev/null
+test -x "$source_dir/Filee"
+test -x "$source_dir/filee-cli"
mkdir -p "$data_dir/filee" "$bin_dir" "$data_dir/applications"
-rm -rf "$install_dir"
cp -R "$source_dir" "$install_dir"
printf '%s\n' 'com.filee.app' > "$install_dir/.filee-package"
-rm -f "$bin_dir/filee"
ln -s "$install_dir/filee-cli" "$bin_dir/filee"
-
python3 - "$install_dir" "$desktop_file" <<'PY'
import pathlib
import sys
@@ -33,14 +41,12 @@ def desktop_value(value):
desktop.write_text(
'[Desktop Entry]\nType=Application\nName=Filee\n'
- 'Comment=Convert files with Filee (Native Wayland)\n'
+ 'Comment=Convert files with Filee\n'
f'Exec={quoted_exec(str(app / "Filee"))} --convert %F\n'
f'Icon={desktop_value(app / "filee.png")}\n'
'Terminal=false\nCategories=Utility;\nX-Filee-Managed=true\n', encoding='utf-8')
PY
-
if command -v update-desktop-database >/dev/null 2>&1; then
update-desktop-database "$data_dir/applications"
fi
-
-printf '%s\n' "Installed Filee (Native Wayland) at $install_dir"
+printf '%s\n' "Installed Filee at $install_dir" "CLI: $bin_dir/filee (add $bin_dir to PATH if needed)."
diff --git a/src/Filee.App/Filee.App.csproj b/src/Filee.App/Filee.App.csproj
index 3355c555..68a5d6a4 100644
--- a/src/Filee.App/Filee.App.csproj
+++ b/src/Filee.App/Filee.App.csproj
@@ -23,9 +23,6 @@
<ItemGroup>
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.Desktop" />
- <PackageReference Include="Avalonia.Wayland" />
- <PackageReference Include="Avalonia.Skia" />
- <PackageReference Include="Avalonia.HarfBuzz" />
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Avalonia.Controls.ColorPicker" />
<PackageReference Include="AvaloniaUI.DiagnosticsSupport">
@@ -38,6 +35,13 @@
<PackageReference Include="SharpHook" />
</ItemGroup>
+ <!-- Linux-only Wayland packages to keep Windows and macOS binaries small -->
+ <ItemGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
+ <PackageReference Include="Avalonia.Wayland" />
+ <PackageReference Include="Avalonia.Skia" />
+ <PackageReference Include="Avalonia.HarfBuzz" />
+ </ItemGroup>
+
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
<!-- Shown on the About page. -->
diff --git a/src/Filee.App/Program.cs b/src/Filee.App/Program.cs
index f9419de4..6b9caa8f 100644
--- a/src/Filee.App/Program.cs
+++ b/src/Filee.App/Program.cs
@@ -275,7 +275,9 @@ internal static class Program
public static AppBuilder BuildAvaloniaApp()
{
var builder = AppBuilder.Configure<App>();
- if (OperatingSystem.IsLinux() && !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WAYLAND_DISPLAY")))
+ if (OperatingSystem.IsLinux()
+ && string.Equals(Environment.GetEnvironmentVariable("FILEE_USE_WAYLAND"), "1", StringComparison.Ordinal)
+ && !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WAYLAND_DISPLAY")))
{
builder.UseWayland().UseSkia().UseHarfBuzz();
}
diff --git a/src/Filee.App/Services/RadialController.cs b/src/Filee.App/Services/RadialController.cs
index a837c5fe..9fe6c33e 100644
--- a/src/Filee.App/Services/RadialController.cs
+++ b/src/Filee.App/Services/RadialController.cs
@@ -214,19 +214,23 @@ public sealed class RadialController(
private RadialWindow EnsureWindow()
{
- if (_window is { IsLoaded: true } w)
- return w;
-
- // On native Wayland, hiding a window can destroy its xdg_surface. Re-create if closed.
if (_window is not null)
- {
- try { _window.Close(); } catch { }
- _window = null;
- }
+ return _window;
var window = new RadialWindow { DataContext = viewModel };
var donut = window.DonutControl;
+ // On native Wayland, hiding an xdg_toplevel surface causes the compositor to destroy its surface,
+ // and re-showing raises an InvalidOperationException. Track Closed to re-create on the next gesture.
+ if (OperatingSystem.IsLinux() && string.Equals(Environment.GetEnvironmentVariable("FILEE_USE_WAYLAND"), "1", StringComparison.Ordinal))
+ {
+ window.Closed += (_, _) =>
+ {
+ if (ReferenceEquals(_window, window))
+ _window = null;
+ };
+ }
+
window.DragEntered += () => _dragReachedDonut = true;
// Tells "the drag reached the donut but brought no files" apart, with what it brought (file promises, say).
window.DragWithoutFiles += formats =>
diff --git a/src/Filee.App/ViewModels/RadialViewModel.cs b/src/Filee.App/ViewModels/RadialViewModel.cs
index 8e3c7b8f..9e6705cc 100644
--- a/src/Filee.App/ViewModels/RadialViewModel.cs
+++ b/src/Filee.App/ViewModels/RadialViewModel.cs
@@ -135,8 +135,8 @@ public sealed partial class RadialViewModel(UserDataStore store, ILocalizer loc,
ShowFace(back: false);
CenterTitle = loc["donut.center_drag"];
CenterSubtitle = null;
- DonutOpacity = 1;
- HitBackground = "Transparent";
+ DonutOpacity = 0;
+ HitBackground = "#01000000";
}
/// <summary>
diff --git a/src/Filee.Platform.Linux/LinuxPlatformServices.cs b/src/Filee.Platform.Linux/LinuxPlatformServices.cs
index d6d5bc57..ff2f2a2d 100644
--- a/src/Filee.Platform.Linux/LinuxPlatformServices.cs
+++ b/src/Filee.Platform.Linux/LinuxPlatformServices.cs
@@ -21,14 +21,26 @@ public sealed class LinuxPlatformServices : IPlatformServices
string.Equals(Environment.GetEnvironmentVariable("XDG_SESSION_TYPE"), "wayland", StringComparison.OrdinalIgnoreCase)
|| !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WAYLAND_DISPLAY"));
- // Wayland gestures (experimental) are opt-in: FILEE_WAYLAND_GESTURES=1.
- // Originally KDE Plasma only; patched to support any Wayland compositor (e.g. Hyprland).
- // libuiohook's libinput backend reads /dev/input, so the user must be in the `input` group.
- // On Hyprland, windowrulev2 places the donut at the cursor instead of a KWin script.
+ // Wayland gestures (experimental) are opt-in: FILEE_WAYLAND_GESTURES=1 on KDE Plasma and Hyprland.
+ // libuiohook's libinput backend reads /dev/input, so /dev/input is only probed once the switch is set,
+ // and it works once the user is in the `input` group. Presses carry no position and a mouse only moves
+ // relatively there; a KWin script or Hyprland window rule places the donut at the cursor.
private static readonly bool WaylandGestures = IsWaylandSession
&& Environment.GetEnvironmentVariable("FILEE_WAYLAND_GESTURES") == "1"
+ && IsSupportedWaylandCompositor()
&& CanReadInputDevices();
+ private static bool IsSupportedWaylandCompositor()
+ {
+ var desktop = Environment.GetEnvironmentVariable("XDG_CURRENT_DESKTOP") ?? "";
+ if (desktop.Split(':').Contains("KDE", StringComparer.OrdinalIgnoreCase))
+ return true;
+ if (desktop.Split(':').Contains("Hyprland", StringComparer.OrdinalIgnoreCase)
+ || !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("HYPRLAND_INSTANCE_SIGNATURE")))
+ return true;
+ return false;
+ }
+
private static bool CanReadInputDevices()
{
try