feat: Linux local build script, install workflow, and Wayland native support - #272
Open
saurondark22 wants to merge 3 commits into
Open
feat: Linux local build script, install workflow, and Wayland native support#272saurondark22 wants to merge 3 commits into
saurondark22 wants to merge 3 commits into
Conversation
- Add build-and-install-local-linux.sh for local install with launcher icon - Update build docs with clearer venv setup, platform-specific activation, and Linux install steps - Add autostart option and post-install usage info - Ignore Python venv, packaging, dist, and spec files in Windows_and_Linux - Fix README link to point to main branch instead of specific commit
saurondark22
marked this pull request as ready for review
June 5, 2026 08:28
Create a virtual environment and install requirements in build-and-install-local-linux.sh before running the installer. Update compile instructions to reflect the new Linux build process.
pynput and pyperclip are unreliable on Wayland sessions: pynput only reaches XWayland windows and pyperclip's wl-copy subprocess blocks. Add a Wayland-native IO path using wl-clipboard and ydotool, with automatic fallback to the existing X11 path when the tools are missing. Also update the Linux installer and compile docs to list the required system packages, and fix the Windows build workflow zip command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linux local build script, install workflow, and Wayland native support
description
A complete local-install experience for Linux users, plus native Wayland
clipboard + keystroke injection so the app works in native Wayland apps
(not only XWayland).
Changes
Local install + docs
build-and-install-local-linux.sh— builds locally and installs with a launcher icon + app menu entryinstall-local-linux.sh— dependency checks, venv creation, icon install, desktop entry, optional autostartTo Compile the Application Yourself.md— clearer venv setup + per-distro system dependency instructions (X11 vs Wayland)To Run Writing Tools Directly from the Source Code.md— post-install usage.gitignore— venvs, packaging artifacts, dist folders, PyInstaller specsWayland native support (fixes #93, #34)
On Wayland (KDE/KWin) Writing Tools only worked in XWayland windows.
Native Wayland apps got stale clipboard sent to the AI and no paste-back.
Three independent failures, each fixed:
wl-copy, which forks a background server and doesn't exit —
subprocess.run(capture_output=True)hangs. Clipboard clear (capture)and write (paste-back) never complete.
X11/XTest (
_xorg.py) — only reaches XWayland windows. Upstream PR feat(linux): Add Wayland support for text and window title capture #229swapped the clipboard read to
wl-pastebut left injection on pynput,so the selection never got copied;
wl-pasteread stale content (exact[Linux] Application does not get triggered when hot-key is pressed #93 symptom).
ydotool keyemits nothing as a single string.ydotool key "29:1 46:1 46:0 29:0"returns exit 0 but writes zerouinput events. Tokens must be separate argv elements. Silent no-op even
with a healthy daemon + accessible
/dev/uinput.The fix adds
_wayland_io.py(~150 lines), used only whenXDG_SESSION_TYPE=wayland+wl-clipboard+ydotoolpresent. Windows/X11keep the original
pyperclip+pynputpath unchanged — new code livesbehind
if _wayland_io.is_wayland_active():guards, original logic movedverbatim into
elsebranches.(
Popen+DEVNULL+close_fds, fed via stdin). No more hangs.ydotool keyat uinput layer, keycodes as separate argvelements (
KEY_LEFTCTRL=29, KEY_C=46, KEY_V=47). Reaches native Waylandydotooldrunning +inputgroup.it); poll until clipboard changes from backup instead of just
non-empty.
WT_PASTE_SETTLE_MSenv var (default 300ms on Wayland,0 on X11) lets KWin settle focus before Ctrl+V.
Verified live on CachyOS / KDE Plasma 6 / Wayland:
ydotool keyCtrl+A+Ctrl+C into a native KDE/Qt window captured the exact selected text;
clipboard backup/restore roundtrip clean.
vs PR #229
#229 took the right first step (wl-paste + session detect) but left
injection on pynput — the actual broken layer. Without Ctrl+C, wl-paste
reads stale clipboard. This completes the loop (native clipboard and
injection)
Why this matters
The Linux compile path was broken; this gives a one-command install +
desktop integration. Wayland support closes the long-standing #93/#34 —
native Wayland apps now capture and paste-back correctly instead of only
XWayland windows.
System deps (documented in install/compile docs)
xclip— pynput handles injection via XTest.wl-clipboard+ydotool, thensystemctl --user enable --now ydotool+sudo usermod -aG input $USER(log out/in). Without these, app auto-falls back to X11 path.
Files
Windows_and_Linux/_wayland_io.py(new) — detection + clipboard + injectionWindows_and_Linux/WritingToolApp.py— 3 call sites routed through Wayland guard (capture/poll/paste-back); X11/Windows branches untouchedWindows_and_Linux/build-and-install-local-linux.sh(new) — local build+installWindows_and_Linux/install-local-linux.sh(new) — installer + Wayland dep noticeREADME's Linked Content/To Compile the Application Yourself.md— venv + system deps docs