chubin / chubin/cheat.sh

Stealth mode does not trigger on clipboard changes in WSLg

Open
#419 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
41.7k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Hi,

I’m experiencing a problem with the `cht.sh` command-line client’s stealth mode while running on WSL2 with WSLg. Clipboard polling works (I can use `xsel --clipboard` and receive Windows clipboard contents), and manual queries in `cht.sh` work as expected. However, when I enter `stealth` mode, copying text in Windows does not trigger any query or response in the terminal. There are no error messages displayed.

#### Steps to reproduce:
1. Run WSL2 with WSLg on Windows 11.
2. Run the latest `cht.sh` script:
```sh
curl https://cht.sh/:cht.sh > ~/cht.sh
chmod +x ~/cht.sh
~/cht.sh --shell
```
3. Enter `stealth` mode at the `cht.sh>` prompt.
4. Copy a short programming query (e.g., `python list comprehension`) in any Windows application.
5. Observe that nothing happens in the terminal (no query triggered, no output).
6. Confirm that `xsel --clipboard` in WSL shows the correct clipboard contents.

#### What I expected:
When I copy a short query in Windows, `cht.sh` should automatically fetch and display the answer in stealth mode.

#### What actually happens:
Nothing happens—no query is triggered, and the terminal remains idle. Manual queries work. No errors are shown.

#### Additional info:
- WSL version: 2.5.9.0
- Kernel version: 6.6.87.2-1
- WSLg version: 1.0.66
- Windows version: 10.0.26120.4452
- Default shell: bash
- Python version: 3.12.3
- `cht.sh` is up to date as of 2025-06-25

First line of ~/cht.sh:
```bash
#!/bin/bash
```

#### Troubleshooting attempted:
- Verified clipboard polling in Python (works as expected)
- Installed both `xsel` and `xclip`
- Tried running `cht.sh` in a clean shell environment
- No custom `.bashrc` or `.zshrc` interfering
- No error output observed

Contributor guide

Open the contributing guide

Research direction

Start by running ~/cht.sh --shell, entering stealth mode, and confirming that xsel --clipboard sees the Windows clipboard. Then inspect the stealth-mode and clipboard-polling paths in ~/cht.sh; done means a clipboard change in WSLg triggers the query and displays its response while manual queries continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.