Initial commit: Teams keep-active tool for Linux (X11) and Windows
Cross-platform anti-idle utility that keeps Microsoft Teams showing Available by resetting the OS idle timer with an invisible input signal. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
# teamsTrick
|
||||
|
||||
Keep Microsoft Teams (and any presence system driven by OS idle time) showing
|
||||
**Available** while you're reading, watching a video, on a call, or otherwise not
|
||||
touching the keyboard. Teams flips you to *Away* after roughly 5 minutes of no
|
||||
input; these scripts reset the OS idle timer with a brief, invisible signal so
|
||||
that never happens.
|
||||
|
||||
No third-party packages — each script uses only the standard OS APIs via Python's
|
||||
`ctypes`.
|
||||
|
||||
## Scripts
|
||||
|
||||
| Script | Platform | Method |
|
||||
| --- | --- | --- |
|
||||
| `stay_active.py` | Linux (X11) | 1px mouse nudge (or key tap) via the X11 XTest extension |
|
||||
| `stay_active_win.py` | Windows | Invisible F15 key tap (or mouse nudge) via the Win32 `SendInput` API |
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3
|
||||
- **Linux:** an **X11** session (`echo $XDG_SESSION_TYPE` → `x11`) and the
|
||||
`libX11` / `libXtst` system libraries (present on essentially every desktop).
|
||||
Wayland is not supported — XTest does not reset the idle timer there.
|
||||
- **Windows:** nothing beyond Python. If `python` isn't on your PATH, use `py`.
|
||||
|
||||
Run the script from **inside your desktop session** (not over SSH) so it can talk
|
||||
to the display / input system.
|
||||
|
||||
## Usage
|
||||
|
||||
### Linux
|
||||
|
||||
```bash
|
||||
./stay_active.py # default: invisible 1px mouse nudge every 120s
|
||||
./stay_active.py -i 90 # nudge every 90s
|
||||
./stay_active.py -m key -k shift # tap Shift instead of moving the mouse
|
||||
./stay_active.py -q & # quiet, run in the background
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
```
|
||||
python stay_active_win.py # default: invisible F15 tap every 120s
|
||||
python stay_active_win.py -i 90 # every 90s
|
||||
python stay_active_win.py -m mouse # 1px mouse nudge instead
|
||||
python stay_active_win.py --no-sleep # also keep the PC/display awake
|
||||
python stay_active_win.py -q # quiet, good for background
|
||||
```
|
||||
|
||||
Stop either script with **Ctrl+C**.
|
||||
|
||||
## Options
|
||||
|
||||
| Flag | Description |
|
||||
| --- | --- |
|
||||
| `-i`, `--interval` | Seconds between signals (default `120`). Keep it under Teams' ~300s Away threshold. |
|
||||
| `-m`, `--method` | `mouse` or `key`. Default is `mouse` on Linux, `key` on Windows. |
|
||||
| `-k`, `--key` | Which key to tap in key mode (Linux: `f13`–`f15`, `shift`). |
|
||||
| `--no-sleep` | *(Windows only)* Also prevent the system and display from sleeping. |
|
||||
| `-q`, `--quiet` | Suppress the heartbeat output. |
|
||||
|
||||
## Notes & caveats
|
||||
|
||||
- It only prevents the **idle → Away** transition. It does **not** override a
|
||||
status you set manually (e.g. *Do Not Disturb*).
|
||||
- It won't help if the machine **sleeps** — a sleeping PC goes offline regardless.
|
||||
On Windows use `--no-sleep`; on Linux disable screen lock / suspend if you need
|
||||
to stay green while away for a long time.
|
||||
- The signals are designed to be invisible: the mouse nudge returns the cursor to
|
||||
where it started, and F15 / the chosen keys aren't bound to anything on a normal
|
||||
desktop.
|
||||
Reference in New Issue
Block a user