Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ Windows_and_Linux/config.json

# Xcode user-specific data
**/xcuserdata/
**/project.xcworkspace/xcuserdata/
**/project.xcworkspace/xcuserdata/

Windows_and_Linux/.venv/
Windows_and_Linux/packaging/
Windows_and_Linux/dist/
Windows_and_Linux/Writing Tools.spec
95 changes: 81 additions & 14 deletions README's Linked Content/To Compile the Application Yourself.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,101 @@
# 👨‍💻 To compile the application yourself:

### Windows and Linux Version build instructions:
Here's how to compile it with PyInstaller and a virtual environment:
### Linux build instructions:

1. Open Terminal and enter the Linux app folder:
```bash
cd Windows_and_Linux
```

2. Build and install locally (recommended, creates launcher and app menu entry):
```bash
bash build-and-install-local-linux.sh
```

This creates a virtual environment, installs dependencies, builds with PyInstaller, and installs:
- `~/.local/bin/writing-tools`
- `~/.local/share/applications/writing-tools.desktop`

Optional autostart:
```bash
bash build-and-install-local-linux.sh --enable-autostart
```

After local install, you can launch Writing Tools with:
```bash
writing-tools
```

No daily recompilation is needed unless you changed source code and want a newer build.

#### Linux system dependencies

1. First, create and activate a virtual environment:
The Python dependencies (in `requirements.txt`) are installed into the venv automatically. A few **system** packages are needed for the clipboard and keystroke-injection flow; which ones depend on your display server:

**X11 (Xorg) session:**
```bash
# Clipboard backend (one of):
sudo apt install xclip # Debian/Ubuntu
sudo pacman -S xclip # Arch/CachyOS
```
pynput (bundled via pip) handles keystroke injection on X11 via the XTest extension — no extra system tool needed.

**Wayland session (e.g. KDE Plasma Wayland, GNOME Wayland, Hyprland):**
pynput's injection and pyperclip's clipboard calls are unreliable on native Wayland. Writing Tools auto-detects a Wayland session and switches to native tools. Install:
```bash
# Install virtualenv if you haven't already
pip install virtualenv
# Arch / CachyOS:
sudo pacman -S wl-clipboard ydotool
# Debian / Ubuntu:
sudo apt install wl-clipboard ydotool
# Fedora:
sudo dnf install wl-clipboard ydotool
```
Then enable the ydotool daemon and grant input access:
```bash
# Enable the daemon (socket-activated; runs per-user)
systemctl --user enable --now ydotool

# Grant /dev/uinput access (required for keystroke injection)
sudo usermod -aG input "$USER"
# Log out and back in for the group change to take effect.
```
- `wl-clipboard` provides `wl-copy`/`wl-paste` for clipboard read/write.
- `ydotool` injects Ctrl+C / Ctrl+V at the kernel uinput layer, reaching both native Wayland and XWayland windows (pynput only reaches XWayland).

# Create a new virtual environment
virtualenv myvenv
Without these tools on Wayland, the app falls back to the X11 path, which only works inside XWayland windows.

# Activate it
# On Windows:
myvenv\Scripts\activate
# On Linux:
source myvenv/bin/activate
### Windows build instructions:
Here's how to compile it with PyInstaller and a virtual environment:

1. Open Command Prompt (or PowerShell) and enter the Windows app folder:
```bash
cd /path/to/WritingTools/Windows_and_Linux
```

2. Once activated, install the required packages:
2. Create and activate a virtual environment:
```bash
python -m venv .venv

# Windows (PowerShell):
.venv\Scripts\Activate.ps1

# Windows (cmd):
.venv\Scripts\activate.bat
```

3. Install dependencies:
```bash
python -m pip install --upgrade pip
pip install -r requirements.txt
```

3. Build Writing Tools:
4. Build Writing Tools:
```bash
python pyinstaller-build-script.py
```

The compiled binary is written to: ~/Windows_and_Linux/dist/Writing Tools

### macOS Version (by [Aryamirsepasi](https://github.com/Aryamirsepasi)) build instructions:

1. **Install Xcode**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,13 @@ Of course, you'll need to have [Python installed](https://www.python.org/downloa
python3 main.py
```

If you want a launcher icon in your app menu and a reusable local install (so you do not need to run from terminal every day), use:

```bash
bash build-and-install-local-linux.sh
```

from the `Windows_and_Linux` folder.


### [**◀️ Back to main page**](https://github.com/theJayTea/WritingTools)
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ Aside from being the only Windows/Linux program like Apple's Writing Tools, and
### **🐧 Linux (work-in-progress)**:
[Run it from the source code](https://github.com/theJayTea/WritingTools/blob/main/README's%20Linked%20Content/To%20Run%20Writing%20Tools%20Directly%20from%20the%20Source%20Code.md)

[Compile and install locally with launcher icon](https://github.com/theJayTea/WritingTools/blob/main/README's%20Linked%20Content/To%20Compile%20the%20Application%20Yourself.md)

Writing Tools works well on x11. On Wayland, there are a few caveats:
- [it works on XWayland apps](https://github.com/theJayTea/WritingTools/issues/34#issuecomment-2461633556)
- [and it works if you disable Wayland for individual Flatpaks with Flatseal.](https://github.com/theJayTea/WritingTools/issues/93#issuecomment-2576511041)
Expand Down Expand Up @@ -220,7 +222,7 @@ These instructions are for any Writing Tools version, using the OpenAI-Compatibl

## 👨‍💻 To Compile the Application Yourself:

[Instructions here!](https://github.com/theJayTea/WritingTools/blob/8713e5a5de63a7892b05a43b9753172e692768fb/README's%20Linked%20Content/To%20Compile%20the%20Application%20Yourself.md)
[Instructions here!](https://github.com/theJayTea/WritingTools/blob/main/README's%20Linked%20Content/To%20Compile%20the%20Application%20Yourself.md)

## 🌟 Contributors

Expand Down
Loading