LinuxCommandLibrary

gh-screensaver

Display a screensaver using GitHub contributions

TLDR

Run a random screensaver

$ gh screensaver
copy

Run a specific screensaver
$ gh screensaver [[-s|--saver]] [fireworks|life|marquee|pipes|pollock|starfield]
copy

Run the "marquee" screensaver with a specific text and font
$ gh screensaver [[-s|--saver]] [marquee] -- --message="[message]" --font=[font_name]
copy

Run the "starfield" screensaver with a specific density and speed
$ gh screensaver [[-s|--saver]] [starfield] -- --density [500] --speed [10]
copy

List available screensavers
$ gh screensaver [[-l|--list]]
copy

SYNOPSIS

gh-screensaver command

PARAMETERS

lock
    Immediately locks the screen, activating the screensaver.

unlock
    Attempts to unlock the screen. Note: This command typically does not work directly from the command line as it requires user interaction (e.g., password entry) via the graphical login prompt.

status
    Checks and reports the current status of the screensaver, indicating whether the screen is locked or unlocked.

activate
    Forces the screensaver to activate, displaying the screensaver content without necessarily locking the screen.

deactivate
    Deactivates the screensaver, returning to the desktop or application without unlocking the screen if it was previously locked.

DESCRIPTION

gh-screensaver is a lightweight shell script designed to simplify interaction with the Gnome Screensaver from the command line. It acts as a convenient wrapper around the more verbose gnome-screensaver-command utility, providing a straightforward interface for common screensaver operations. Users can quickly lock their screen, check its current status, or activate/deactivate the screensaver, making it particularly useful for scripting, automation, or integrating screensaver control into custom desktop environments or keybinds. Its primary benefit lies in offering a more memorable and streamlined syntax compared to its underlying command. It's often found in personal utility collections or specialized tooling like the geekhack/gh-tools suite.

CAVEATS

gh-screensaver is a shell script and relies on the gnome-screensaver-command utility being installed and functional within a Gnome desktop environment. It may not work in other desktop environments (e.g., KDE, XFCE) or if gnome-screensaver is not running. The unlock command typically requires graphical user interaction and a password, making it impractical for direct command-line use without further graphical automation.

DEPENDENCIES

gh-screensaver is fundamentally dependent on the presence and functionality of gnome-screensaver-command. It essentially parses its arguments and passes them directly to this underlying utility.

SCRIPTING UTILITY

Due to its simple command-line interface, gh-screensaver is ideally suited for integration into custom shell scripts, keyboard shortcuts, or desktop environment automation rules, providing quick and easy screensaver management.

HISTORY

Developed as part of the geekhack/gh-tools collection, gh-screensaver emerged as a practical wrapper for the gnome-screensaver-command utility. Its creation aimed to provide a more concise and memorable interface for common screensaver actions, simplifying its use in shell scripts and custom desktop automations. It is not a core Linux utility but rather a specialized convenience script, reflecting a common pattern of creating shell wrappers for frequently used or verbose commands.

SEE ALSO

gnome-screensaver-command(1), gnome-screensaver(1), xset(1), xrandr(1)

Copied to clipboard