Metadata-Version: 2.4
Name: nosleepy
Version: 2.0.0
Summary: Keep your system active by simulating mouse, keyboard, or typed input at configurable intervals
License-Expression: MIT
Project-URL: Homepage, https://github.com/it-harsh/nosleepy
Project-URL: Issues, https://github.com/it-harsh/nosleepy/issues
Keywords: presence,idle,mouse,keyboard,automation,productivity
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: POSIX :: Linux
Classifier: Environment :: X11 Applications
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pynput
Requires-Dist: python-xlib; sys_platform == "linux"
Dynamic: license-file

# nosleepy

[![PyPI version](https://img.shields.io/pypi/v/nosleepy)](https://pypi.org/project/nosleepy/)
[![Python](https://img.shields.io/pypi/pyversions/nosleepy)](https://pypi.org/project/nosleepy/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/it-harsh/nosleepy/blob/master/LICENSE)
[![GitHub](https://img.shields.io/badge/GitHub-it--harsh%2Fnosleepy-blue?logo=github)](https://github.com/it-harsh/nosleepy)

Keep your system active with realistic typed input simulation — types random phrases into a hidden invisible window, never your active window.

![nosleepy demo](https://raw.githubusercontent.com/it-harsh/nosleepy/master/demo/demo.png)

---

## Quickstart

```bash
pip install nosleepy
nosleepy -m xlib --pause 37 --words 30
```

---

## Install

```bash
pip install nosleepy

# or
pip3 install nosleepy
```

### Via Snap
```bash
sudo snap install nosleepy
```

## Run (recommended)

```bash
nosleepy -m xlib --pause 37 --words 30
```

---

## Modes

| Mode | What it does |
|---|---|
| `xlib` | Types phrases into a hidden 1×1 invisible window — no GUI trace (**recommended**) |
| `xdotool` | Types phrases into a minimized sink xterm window |
| `mouse` | Moves mouse diagonally (default) |
| `keyboard` | Presses Shift key |
| `both` | Mouse + Shift |
| `scroll` | Scrolls mouse wheel |

---

## All Options

```
-m MODE, --mode MODE            xlib (recommended), xdotool, mouse, keyboard, both, scroll
--pause SECONDS                 Fixed pause between typed phrases. e.g. --pause 37
--words MAX or MIN MAX          Words per phrase. e.g. --words 30 or --words 20 30. Default: 20 30
-s SECONDS, --seconds SECONDS   Idle wait seconds for mouse/keyboard modes. Default: 300
-p PIXELS, --pixels PIXELS      Pixels to move mouse. Default: 1
-c, --circular                  Move mouse in a circle
-r MIN MAX, --random MIN MAX    Random interval. e.g. -r 30 60
-a LEVEL, --activity LEVEL      Activity % for xlib/xdotool (50-95). Default: 75
--version                       Show version
-h, --help                      Show help
```

---

## Examples

```bash
# Recommended
nosleepy -m xlib --pause 37 --words 30

# Shorter phrases
nosleepy -m xlib --pause 37 --words 15

# Faster cadence
nosleepy -m xlib --pause 20 --words 30

# Move mouse every 60 seconds
nosleepy -m mouse -s 60

# Run for 2 hours then stop
timeout 2h nosleepy -m xlib --pause 37 --words 30

# Stop anytime
Ctrl + C
```

---

## FAQ

### Does it work on Wayland?
No. Run on X11 or use XWayland.

### Does it affect my active window?
No. `xlib` mode creates an invisible off-screen window. Keystrokes never reach your active app.

### Any memory leak or leftover processes?
No. The hidden window lives only while the process runs. On exit everything is cleaned up automatically.

### What is the difference between `--pause` and `--activity`?
- `--pause` — fixed wait between phrases (recommended for human-like cadence)
- `--activity` — percentage of time spent typing (continuous rapid mode)

### Run on startup

**GNOME / KDE:** Add to Startup Applications:
```
nosleepy -m xlib --pause 37 --words 30
```

**Systemd:**
```ini
[Unit]
Description=nosleepy

[Service]
ExecStart=nosleepy -m xlib --pause 37 --words 30
Restart=always

[Install]
WantedBy=default.target
```
```bash
systemctl --user enable --now nosleepy
```

---

## Support

If nosleepy is useful to you, consider buying me a coffee!

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/itharsh)

---

## Links

- PyPI: https://pypi.org/project/nosleepy/
- Snap: `sudo snap install nosleepy`
- GitHub: https://github.com/it-harsh/nosleepy
- Changelog: [CHANGELOG.md](CHANGELOG.md)
