Windows Subsystem for Linux (WSL)
LeetCode Ghost Window provides specialized support for Windows Subsystem for Linux, combining the best of both Windows and Linux implementations for a seamless experience.
WSL Setup Requirements
Before installing LeetCode Ghost Window on WSL, ensure you have the following prerequisites:
- WSL Installed: Windows Subsystem for Linux must be installed and configured
- WSL Version: Both WSL1 and WSL2 are supported, but WSL2 is recommended
- X Server: A Windows X server (VcXsrv, Xming, etc.) must be installed and running
- Linux Distribution: Ubuntu 20.04+, Debian, or another supported distribution
- Node.js: Version 18 or newer installed in your WSL environment
X Server Setup
An X server is required to display graphical applications from WSL on your Windows desktop:
Installing VcXsrv (Recommended)
- Download and install VcXsrv on Windows
- Launch XLaunch from the Start menu
- Select "Multiple windows" and set "Display number" to 0
- Select "Start no client"
- Check "Disable access control"
- Click "Next" and then "Finish" to start the X server
WSL Environment Configuration
Add these lines to your ~/.bashrc
or ~/.zshrc
file:
# WSL1 export DISPLAY=:0 # OR for WSL2 export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0 export LIBGL_ALWAYS_INDIRECT=1
Then reload your shell configuration:
source ~/.bashrc # or source ~/.zshrc
Installation
There are multiple ways to install LeetCode Ghost Window on WSL:
Option 1: AppImage
Using the AppImage format:
# Download the AppImage wget https://github.com/joseook/leetcode-ghost-joseok/releases/download/latest/LeetCode-Ghost-Window-x.x.x.AppImage # Make it executable chmod +x LeetCode-Ghost-Window-*.AppImage # Run the application ./LeetCode-Ghost-Window-*.AppImage
Option 2: NPM Package
Install using npm:
# Install globally npm install -g leetcode-joseok # Launch the application leet-joseok init
Option 3: WSL Launcher Script
Clone the repository and use the included WSL launcher script:
# Clone the repository git clone https://github.com/joseook/leetcode-ghost-joseok cd leetcode-ghost-joseok # Install dependencies npm install # Run the WSL launcher script ./wsl-launcher.sh
WSL Launcher Script
The included wsl-launcher.sh
script handles various WSL-specific configurations automatically, including X server detection, display settings, and ensuring the proper libraries are available. It's the recommended way to run the application in a WSL environment.
WSL-Specific Features
LeetCode Ghost Window in WSL combines features from both Windows and Linux implementations:
Hybrid Ghost Mode
The application uses a hybrid approach to ghost mode, combining X11 window properties with specialized WSL-specific adjustments to ensure invisibility to screen recorders running on the Windows host.
Windows Integration
Despite running in WSL, the application integrates seamlessly with the Windows desktop environment, appearing as a native Windows application.
Performance Optimizations
Includes specific optimizations for the WSL environment to ensure smooth performance despite the additional layer of abstraction between Linux and Windows.
Troubleshooting WSL Issues
X Server Connection Errors
If you see errors like "Cannot connect to X server":
- Ensure your X server is running on Windows
- Verify that "Disable access control" is checked in XLaunch settings
- Check if Windows Firewall is blocking the connection
- For WSL2, ensure your DISPLAY variable is set correctly
# Test X server connection with a simple X application sudo apt-get install x11-apps xeyes
Missing Libraries
Install required libraries if missing:
# For Ubuntu/Debian based distributions sudo apt-get update sudo apt-get install libgtk-3-0 libnotify4 libappindicator3-1 libxtst6 libatspi2.0-0 libnss3 libasound2
Performance Issues
If you experience performance issues:
- For WSL2, consider adding memory and processor limits in .wslconfig
- Use the included wsl-launcher.sh script which includes performance optimizations
- Disable unnecessary Windows background processes
- Ensure your WSL distribution is up to date
WSL2 vs WSL1
If you're having persistent issues with one WSL version, consider trying the other:
# Check your current WSL version wsl -l -v # Convert a distribution to WSL1 wsl --set-version <DistributionName> 1 # Convert a distribution to WSL2 wsl --set-version <DistributionName> 2