Skip to content

feat(linux): X11 support for the Rust/iced rewrite#54

Open
aweigold wants to merge 3 commits into
KRTirtho:mainfrom
aweigold:feat/linux-support
Open

feat(linux): X11 support for the Rust/iced rewrite#54
aweigold wants to merge 3 commits into
KRTirtho:mainfrom
aweigold:feat/linux-support

Conversation

@aweigold

Copy link
Copy Markdown

Closes #53

What

Adds a Linux (X11) platform layer so Flemozi builds and runs on Linux (previously Windows/macOS only).

Changes

  • src/linux.rs (new) — X11 platform module mirroring win32/macos:
    • Keyboard: no global hook — the picker takes focus and iced key events are translated into HookKeyEvent.
    • Show/hide via iced window commands (set_mode/move_to/gain_focus) so winit renders the window.
    • Focus save/restore + synthetic Ctrl+V paste via XTEST (x11rb).
  • Tray: tray-icon restricted to non-Linux targets (it pulls GTK, which doesn't co-exist with the winit/iced loop); added a Settings → Exit button.
  • src/config.rs: XDG config path (~/.config/flemozi) and an XDG autostart entry for launch-at-startup; also fixes the unset-%APPDATA% fallback on macOS.
  • Cargo.toml: x11rb (xtest) for Linux; tray-icon for non-Linux.
  • docs/linux-support.md: design, limitations, and test plan.

Testing (KDE Plasma / X11)

  • ✅ Global hotkey summons the window; renders correctly
  • ✅ Type-to-search, emoji paste into the focused app, Escape, Settings → Exit
  • ✅ Launch-at-startup writes/removes ~/.config/autostart/flemozi.desktop (passes desktop-file-validate); config persists to ~/.config/flemozi/config.json

Known limitations (documented)

  • X11 only (no Wayland)
  • GIF paste degraded (pastes a file:// URI as text rather than embedding the file)
  • Multi-monitor placement uses the whole X screen; possible HiDPI position offset
  • Not wired into CI yet (a Linux build job is a sensible follow-up)

🤖 Generated with Claude Code

aweigold and others added 3 commits July 11, 2026 23:47
Add a Linux (X11) platform layer mirroring the win32/macos interface so
the Rust/iced rewrite builds and runs on Linux.

- src/linux.rs: X11 window focus + synthetic paste (XTEST) via x11rb;
  keyboard input by translating iced key events into HookKeyEvent
  (no global hook needed); cursor/screen queries and geometry.
- Show/hide the window through iced's window commands (set_mode/move_to/
  gain_focus) so winit actually renders it — mapping the window directly
  via X11 leaves the transparent window unrendered and invisible.
- Gate the system tray off on Linux (tray-icon pulls GTK, which does not
  co-exist with the winit/iced event loop) and add a Settings -> Exit
  button as the quit affordance.
- Cargo.toml: x11rb (xtest feature) for Linux; tray-icon restricted to
  non-Linux targets.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Configuration was stored under %APPDATA%, which is unset on Linux and
macOS and silently fell back to the current working directory, so
settings did not persist reliably.

- Resolve the config directory per-platform: %APPDATA% on Windows,
  ~/Library/Application Support on macOS, and $XDG_CONFIG_HOME (or
  ~/.config) on Linux.
- Implement launch-at-startup on Linux via an XDG autostart entry at
  $XDG_CONFIG_HOME/autostart/flemozi.desktop (created on enable, removed
  on disable). Windows keeps its Start Menu shortcut; macOS is a no-op
  for now (needs a LaunchAgent).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux support is missing from the Rust/iced rewrite (README still advertises it)

1 participant