Caffeine Applet for COSMIC DE
A simple COSMIC applet that prevents your system from going idle by creating a systemd-inhibit lock session. Perfect for keeping your machine awake on demand!
- Toggle Caffeine: Click the applet's icon to enable or disable an inhibit session.
- Minimal: Only uses a tiny amount of memory and CPU.
- Built with COSMIC: Integrates into your cosmic desktop or panel.
A justfile is included by default for the casey/just command runner.
justbuilds the application with the defaultjust build-releaserecipejust runbuilds and runs the applicationjust installinstalls the project into the systemjust vendorcreates a vendored tarballjust build-vendoredcompiles with vendored dependencies from that tarballjust checkruns clippy on the project to check for linter warningsjust check-jsoncan be used by IDEs that support LSP
Fluent is used for localization of the software. Fluent's translation files are found in the i18n directory. New translations may copy the English (en) localization of the project, rename en to the desired ISO 639-1 language code, and then translations can be provided for each message identifier. If no translation is necessary, the message may be omitted.
If packaging for a Linux distribution, vendor dependencies locally with the vendor rule, and build with the vendored sources using the build-vendored rule. When installing files, use the rootdir and prefix variables to change installation paths.
just vendor
just build-vendored
just rootdir=debian/caffeine-applet prefix=/usr installIt is recommended to build a source tarball with the vendored dependencies, which can typically be done by running just vendor on the host system before it enters the build environment.
Developers should install rustup and configure their editor to use rust-analyzer. To improve compilation times, disable LTO in the release profile, install the mold linker, and configure sccache for use with Rust. The mold linker will only improve link times if LTO is disabled.
Once the applet is running:
- Click the coffee-cup icon to toggle between awake (caffeine mode) and idle (normal). A PID file (/tmp/caffeine-id.txt) is maintained to track the systemd-inhibit session.
- If the PID file already exists, it means a caffeine session is running (and you won’t be able to start a new one without stopping it first).
Contributions are welcome! Feel free to open an issue or submit a pull request on GitHub. For major changes, please open an issue first to discuss what you would like to change.