AFKafé orders caffeine for you if you idle too long!
Project description
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. 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
After ordering, the service exits since a single bag should be enough to keep you running for a while.
Now that everything is working, you should configure the script to run in the background. There are many ways to do this, but one way is to add this line to your .xinitrc file if you're using startx:
~/.local/bin/afkafe &
By default, the idle time is 30 minutes before coffee is ordered. That should be appropriate for all you normie programmers, Twitch chatters, and Reddit users out there. Enjoy your coffee and boosted productivity!
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file afkafe-1.1.tar.gz.
File metadata
- Download URL: afkafe-1.1.tar.gz
- Upload date:
- Size: 25.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34f2280d2e7fbb26eabcd3f443502d3cf48ba6e2ce8f7e887a4d0c8450b28279
|
|
| MD5 |
cea52be5ced6f67fcbf100b51366725a
|
|
| BLAKE2b-256 |
3c3488f8e5f7dfd046d7fbd8420307cd76e1550247489f6c53bdda75a464fbb1
|
Provenance
The following attestation bundles were made for afkafe-1.1.tar.gz:
Publisher:
python-publish.yml on Graeme22/afkafe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
afkafe-1.1.tar.gz -
Subject digest:
34f2280d2e7fbb26eabcd3f443502d3cf48ba6e2ce8f7e887a4d0c8450b28279 - Sigstore transparency entry: 187919313
- Sigstore integration time:
-
Permalink:
Graeme22/afkafe@81e938182297b94af62c3a44c2d78b6cc0ff785b -
Branch / Tag:
refs/tags/v1.1 - Owner: https://github.com/Graeme22
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@81e938182297b94af62c3a44c2d78b6cc0ff785b -
Trigger Event:
release
-
Statement type:
File details
Details for the file afkafe-1.1-py3-none-any.whl.
File metadata
- Download URL: afkafe-1.1-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62f710230adbaa1e5d94e314b97a15be2b2f4170db6932f7bc8eef2f875d7f57
|
|
| MD5 |
f4dec3652f7a9afc67951fe0334cf861
|
|
| BLAKE2b-256 |
db233e86f6d9b3ab3a493239be6d67bce0a6ca47e5ad01d241291d5a09032d9d
|
Provenance
The following attestation bundles were made for afkafe-1.1-py3-none-any.whl:
Publisher:
python-publish.yml on Graeme22/afkafe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
afkafe-1.1-py3-none-any.whl -
Subject digest:
62f710230adbaa1e5d94e314b97a15be2b2f4170db6932f7bc8eef2f875d7f57 - Sigstore transparency entry: 187919314
- Sigstore integration time:
-
Permalink:
Graeme22/afkafe@81e938182297b94af62c3a44c2d78b6cc0ff785b -
Branch / Tag:
refs/tags/v1.1 - Owner: https://github.com/Graeme22
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@81e938182297b94af62c3a44c2d78b6cc0ff785b -
Trigger Event:
release
-
Statement type: