Tree @V0.1 (Download .tar.gz)
Executes a user script that either enables or disables a screensaver, then "gives the user a coffee" by rendering an image of a coffeecup as ascii art.
The script uses the pixabay.com developer API to obtain random images of coffee cups, then uses asciiview/aview to display that image as asciiart in the terminal. To obtain your own developer key, please see https://pixabay.com/api/docs/.
The repository provides a utility script to enroll new key's securely, so the user does not need to enter their API key every time. See utils/enroll-key.sh for more.
Take a look at a demo here: https://cloud.eclecticmedia.space/s/F27DPFKwWFmbPcy
Almost all dependencies are handled via Pypi/pip, so one can install amost everything with:
pip3 install -r requirements.txt; pip3 install .
You should probably do that in a virtual environment...
python3 -m venv venv; source venv/bin/activate; pip3 install requirements.txt; pip3 install .
Unfortunately, aview is not something that can be handled via the pip installer. Obtain it with apt (or other package managers):
sudo apt-get install aview imagemagick # imagemagick is a helper library for aview
It is also useful to save your API key to local storage and ensure that the file is only read access to you and no other users. To do so, use the utility script:
./utils/enroll-key.sh # saves key to ~/.config/caffeine/keyfile
The software will always attempt to run a script, and will fail if no script can be found. The software looks for scripts on the following paths:
/etc/caffeine/caffeine_script, ~/.config/caffeine/caffeine_script, /opt/caffeine/caffeine_script, ./caffeine_script
for the software to discover the script properly, it must be executable and contain a shebang line.
The software will call your script with one of two arguments:
enable --OR-- disable
Your script should handle these argument states, where enable tells the script to enable the screensaver. Aside from handling the argument and being executable, there are no specific requirements for what the script should do. This is so that you can patch in whatever method you need for screensaver interaction. Therefore, to complete the setup you will need to set up your script and include it on one of the above paths. For example scripts, check the examples/ directory.
Once the module has been installed via Pypi/pip, you can simply run:
caffeine # disables screen saver (passes 'disable' to script) decaf # enables screen saver (passes 'enable' to script)
Under the MIT license, circa 2020 by Ariana Giroux (email@example.com)
To submit a bug, include any relavent details in an email to firstname.lastname@example.org
We use a git native pull request workflow for patch submission.
First, clone the repository:
git clone git://git.eclecticmedia.space/public/caffeine
Then, once you've made your changes, push your copy to a publicly accessible location (i.e GitLab):
git remote add upstream $(git remote get-url origin) # keep the master repository link as upstream git remote set-url origin *YOUR REPO URL* # change origin to your public URL git push origin
Once you are confident in your changes, submit a git native pull request to email@example.com:
git request-pull origin upstream # outputs pull request text, copy this into your email.
Please ensure you include a short description of the changed you've made.
Commit History @V0.1
- Ensured path discovery always expands path Ariana Giroux 8 months ago
- Suppressed script output when output is empty Ariana Giroux 8 months ago
- Added demo link to README Ariana Giroux 8 months ago
- Added contribution guidelines Ariana Giroux 8 months ago
- Updated gitignore Ariana Giroux 8 months ago
- Removed old test script Ariana Giroux 8 months ago
- Updated todo.txt Ariana Giroux 8 months ago
- Expanded docs in README.rst Ariana Giroux 8 months ago
- Added initial setup.py Ariana Giroux 8 months ago
- Added decaf command to __main__, adds group for module execution Ariana Giroux 8 months ago