Metadata-Version: 2.4
Name: afkafe
Version: 1.0
Summary: AFKafé orders caffeine for you if you idle too long!
Project-URL: Homepage, https://github.com/Graeme22/afkafe
Author-email: Graeme Holliday <graeme@tastyware.dev>
License: MIT License
        
        Copyright (c) 2025 Graeme Holliday
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
License-File: LICENSE
Requires-Python: >=3.9
Requires-Dist: pynput>=1.8.1
Requires-Dist: terminal-shop>=1.6.0
Requires-Dist: typer>=0.15.2
Description-Content-Type: text/markdown

# AFKafé

AFKafé is a simple service that uses pynput to monitor your system activity. If you idle for too long, AFKafé assumes you have entered a catatonic state due to caffeine depravation and quickly orders a random bag of coffee (but never decaf) from [terminal.shop](https://terminal.shop). I pray it reaches you in time.

## Installation

The best way to install is with `pipx`:

```
$ pipx install afkafe
```

## Usage

First, you'll need to store your terminal.shop access token in the environment variable `$TERMINAL_BEARER_TOKEN`. You should also make sure that the associated account at terminal.shop (or dev.terminal.shop) already has payment and address information saved. Now you can run the service:

```
$ afkafe --dev --verbose 5
```

Here, we're running with an idle timeout of 5 seconds. That's pretty low unless you're a 10x developer, so we're also running in the dev environment to avoid needlessly giving money to startup grifters. Finally, we're using the `--verbose` flag so you can ensure that keyboard and mouse events are being detected by the service. If everything is working correctly, you should see something like this as you use your mouse/keyboard:

```
13:22:51: Big dict entered the void (of the logging config)
13:22:55: Received event (637, 477, False)
13:22:55: Received event (636, 478, False)
13:22:55: Received event (634, 488, False)
13:22:55: Received event (627, 505, False)
13:22:55: Received event (609, 523, False)
13:22:55: Received event (569, 545, False)
13:22:55: Received event (519, 575, False)
a13:22:56: Received event ('a', False)
s13:22:56: Received event ('s', False)
d13:22:56: Received event ('d', False)
k13:22:56: Received event ('k', False)
f13:22:56: Received event ('f', False)
13:22:56: Received event ('j', False)
j13:22:56: Received event ('a', False)
13:22:59: Received event (642, 617, <Button.left: 1>, True, False)
13:22:59: Received event (642, 617, <Button.left: 1>, False, False)
13:23:00: Received event (642, 617, <Button.right: 3>, True, False)
13:23:00: Received event (642, 617, <Button.right: 3>, False, False)
13:23:00: Received event (642, 617, <Button.right: 3>, True, False)
13:23:00: Received event (642, 617, <Button.left: 1>, True, False)
13:23:00: Received event (642, 617, <Button.right: 3>, False, False)
13:23:00: Received event (642, 617, <Button.left: 1>, False, False)
13:23:01: Received event (643, 618, False)
13:23:01: Received event (645, 618, False)
13:23:01: Received event (<Key.ctrl: <65507>>, False)
13:23:01: Received event ('c', False)
```

And if you're idle for over 5 seconds, you should see this:

```
13:25:10: User needs caffeine!
13:25:11: Selected bag artisan out of desperation.
13:25:13: Placed order ord_01JQ78T9TFSEFF96EB8VG120RB
```

Now that everything is working, we should configure the script to run in the background. This will differ based on your window manager, a

## Supported platforms

AFKafé has only been tested on Linux with Xorg (Wayland is not supported!), but it should work on any platform that [pynput works on](https://pynput.readthedocs.io/en/latest/limitations.html).
