cocainate

A cross-platform caffeinate alternative that keeps your screen on.

https://github.com/applegamer22/cocainate

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.6%) to scientific vocabulary

Keywords

caffeinate cli dbus go golang golang-library golang-package linux macos windows
Last synced: 6 months ago · JSON representation ·

Repository

A cross-platform caffeinate alternative that keeps your screen on.

Basic Info
Statistics
  • Stars: 24
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 18
Topics
caffeinate cli dbus go golang golang-library golang-package linux macos windows
Created about 4 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Code of conduct Citation Codeowners

README.md

cocainate

Go Reference Test CodeQL Release Update Documentation

Description

cocainate is a cross-platform CLI utility for keeping the screen awake until stopped, or for a specified duration.

Why This Name?

The program's functionality and name are inspired by macOS's caffeinate utility that prevents the system from entering sleep mode.

This name is simply a stupid ~~pun~~, therefore I do not condone and do not promote drug use, for more information: Wikipedia.

Installation

Nix Flakes

nix { inputs = { # or your preferred NixOS channel nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; applegamer22.url = "github:AppleGamer22/nur"; }; outputs = { nixpkgs }: { nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { specialArgs = { pkgs = import nixpkgs { # ... overlays = [ (final: prev: { # ... ag22 = applegamer22.packages."<your_system>"; }) ]; }; }; modules = [ # or in a separate Nix file ({ pkgs, ... }: { programs.nix-ld.enable = true; environment.systemPackages = with pkgs; [ ag22.cocainate ]; }) # ... ]; }; }; }

Arch Linux Distributions

  • yay: bash yay -S cocainate-bin
  • paru: bash paru -S cocainate-bin

macOS

  • Homebrew Tap: bash brew install AppleGamer22/tap/cocainate

Windows (working progress)

  • winget: bash winget install AppleGamer22.cocainate ### Other
  • go:
    • Does not ship with:
      • a manual page
      • pre-built shell completion scripts go install github.com/AppleGamer22/cocainate

Functionality

Root -d/--duration Flag

This is an optional flag that accepts a duration string (see Go's time.ParseDuration for more details). If this flag is not provided, the program will run until manually stopped.

Acceptable Time Units

  • nanoseconds: ns
  • microseconds: us or µs
  • milliseconds: ms
  • seconds: s
  • minutes: m
  • hours: h

Examples

  • 10 hours: -d 10h
  • 1 hour, 10 minutes and 10 seconds: -d 1h10m10s
  • 1 microsecond: -d 1us

If the -p flag is provided, the -d flag's value is used as process polling interval.

Root -p/--pid Flag

This is an optional flag that accepts a process ID (PID). If a valid PID is provided, the program will wait until that process is terminated. The delay between the termination of the provided process and the termination of screensaver inhibitation depends on the -d flag (which must be provided).

version Sub-command

-v/--verbose Flag

  • If this flag is provided, the following details are printed to the screen:
    1. semantic version number
    2. commit hash
    3. Go compiler version
    4. processor architecture & operating system
  • Otherwise, only the semantic version number is printed.

Dependencies

Linux

Common Contributor Routines

Testing

Running the following command will run go test on the commands and session sub-modules: bash make test

Building From Source

Development

  • Using the following make command will save a cocainate binary with the last version tag and the latest git commit hash: bash make debug

Release

  • Using the following GoReleaser command with a version git tag and a clean git state: bash goreleaser build --clean
  • All release artificats will stored in the dist child directory in the codebase's root directory:
    • compressed package archives with:
      • a cocainate binary
      • manual page
      • shell completion scripts
    • checksums
    • change log

Copyright

cocainate is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

cocainate is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Owner

  • Name: Omri Bornstein
  • Login: AppleGamer22
  • Kind: user
  • Location: Melbourne, Australia

Software Engineer, Gopher, TeXnician | Enthusiastic About Open-Source Software and Software Supply Chains

Citation (CITATION.cff)

# yaml-language-server: $schema=https://citation-file-format.github.io/1.2.0/schema.json
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Bornstein
    given-names: Omri
title: cocainate
version: 1.0.0
date-released: 2022-03-12
url: https://github.com/AppleGamer22/cocainate

GitHub Events

Total
  • Release event: 3
  • Watch event: 5
  • Delete event: 37
  • Issue comment event: 7
  • Push event: 45
  • Pull request event: 81
  • Create event: 41
Last Year
  • Release event: 3
  • Watch event: 5
  • Delete event: 37
  • Issue comment event: 7
  • Push event: 45
  • Pull request event: 81
  • Create event: 41

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 71
  • Average time to close issues: N/A
  • Average time to close pull requests: about 13 hours
  • Total issue authors: 0
  • Total pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.15
  • Merged pull requests: 68
  • Bot issues: 0
  • Bot pull requests: 62
Past Year
  • Issues: 0
  • Pull requests: 23
  • Average time to close issues: N/A
  • Average time to close pull requests: about 13 hours
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.3
  • Merged pull requests: 22
  • Bot issues: 0
  • Bot pull requests: 23
Top Authors
Issue Authors
  • dependabot[bot] (1)
Pull Request Authors
  • dependabot[bot] (126)
  • AppleGamer22 (9)
Top Labels
Issue Labels
dependencies (1)
Pull Request Labels
dependencies (126) enhancement (5) bug (1) documentation (1)

Packages

  • Total packages: 2
  • Total downloads: unknown
  • Total dependent packages: 1
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 72
proxy.golang.org: github.com/AppleGamer22/cocainate
  • Versions: 36
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Stargazers count: 4.7%
Dependent packages count: 7.0%
Average: 7.5%
Forks count: 9.0%
Dependent repos count: 9.3%
Last synced: 6 months ago
proxy.golang.org: github.com/applegamer22/cocainate
  • Versions: 36
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.0%
Average: 8.2%
Dependent repos count: 9.3%
Last synced: 6 months ago

Dependencies

go.mod go
  • github.com/davecgh/go-spew v1.1.1
  • github.com/go-ole/go-ole v1.2.6
  • github.com/godbus/dbus/v5 v5.1.0
  • github.com/inconshreveable/mousetrap v1.0.0
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/shirou/gopsutil v3.21.11+incompatible
  • github.com/spf13/cobra v1.5.0
  • github.com/spf13/pflag v1.0.5
  • github.com/stretchr/testify v1.8.0
  • github.com/tklauser/go-sysconf v0.3.10
  • github.com/tklauser/numcpus v0.5.0
  • github.com/yusufpapurcu/wmi v1.2.2
  • golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
  • gopkg.in/yaml.v3 v3.0.1
go.sum go
  • github.com/cpuguy83/go-md2man/v2 v2.0.2
  • github.com/davecgh/go-spew v1.1.0
  • github.com/davecgh/go-spew v1.1.1
  • github.com/go-ole/go-ole v1.2.6
  • github.com/godbus/dbus/v5 v5.1.0
  • github.com/inconshreveable/mousetrap v1.0.0
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/russross/blackfriday/v2 v2.1.0
  • github.com/shirou/gopsutil v3.21.11+incompatible
  • github.com/spf13/cobra v1.5.0
  • github.com/spf13/pflag v1.0.5
  • github.com/stretchr/objx v0.1.0
  • github.com/stretchr/objx v0.4.0
  • github.com/stretchr/testify v1.7.1
  • github.com/stretchr/testify v1.8.0
  • github.com/tklauser/go-sysconf v0.3.10
  • github.com/tklauser/numcpus v0.4.0
  • github.com/tklauser/numcpus v0.5.0
  • github.com/yusufpapurcu/wmi v1.2.2
  • golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3
  • golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27
  • golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6
  • golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
  • gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
  • gopkg.in/yaml.v2 v2.4.0
  • gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
  • gopkg.in/yaml.v3 v3.0.1
.github/workflows/dependency.yml actions
  • actions/checkout v3.3.0 composite
  • actions/dependency-review-action v3 composite
.github/workflows/release.yml actions
  • actions/checkout v3.3.0 composite
  • actions/setup-go v3.5.0 composite
  • anchore/sbom-action/download-syft v0.13.3 composite
  • goreleaser/goreleaser-action v4 composite
.github/workflows/tag.yml actions
  • actions/setup-go v3.5.0 composite
.github/workflows/test.yml actions
  • actions/checkout v3.3.0 composite
  • actions/setup-go v3.5.0 composite
Dockerfile docker
  • kdeneon/plasma latest build