feat(cli): make shellsaver the public command

This commit is contained in:
Robby Russell committed 2026-10-08 22:45:46 -07:00
1 parent 035556d687
commit b4e1e1083f
3 files changed
+26 -29

No files matched your search

+9 -9
View File
@@ -244,24 +244,24 @@ ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod)
### Shellsavers
Give your terminal a little downtime with `omz shellsaver`, a playful alias for
`omz screensaver`. The aquarium is the default; choose another scene to change the mood:
Give your terminal a little downtime with `omz shellsaver`—our playful name for
terminal screensavers. The aquarium is the default; choose another scene to change the mood:
```zsh
omz screensaver # A quiet aquarium full of sea shells
omz screensaver logo # The updater's rainbow logo, bouncing around
omz screensaver hermit # A slightly lost hermit crab
omz shellsaver # A quiet aquarium full of sea shells
omz shellsaver logo # The updater's rainbow logo, bouncing around
omz shellsaver hermit # A slightly lost hermit crab
omz shellsaver party # A rainbow stage and a dancing crowd
```
Press any key or Ctrl-C to return to your shell. Screensavers run only when invoked
and restore the terminal when they exit. No plugin or configuration change is needed.
Use `omz help` to discover the commands, and Tab to complete scene names and options.
Use `omz help` to discover the command, and Tab to complete scene names and options.
```zsh
omz screensaver aquarium --seconds 30 # Stop automatically after 30 seconds
omz screensaver logo --mono # Use the terminal's foreground color
omz screensaver --help # Show all scenes and options
omz shellsaver aquarium --seconds 30 # Stop automatically after 30 seconds
omz shellsaver logo --mono # Use the terminal's foreground color
omz shellsaver --help # Show all scenes and options
```
Requires Zsh 5.8 or newer, `stty`, and an xterm-compatible terminal with alternate-screen
+8 -9
View File
@@ -28,8 +28,7 @@ function _omz {
'plugin:Manage plugins'
'pr:Manage Oh My Zsh Pull Requests'
'reload:Reload the current zsh session'
'screensaver:Launch a whimsical terminal screensaver'
'shellsaver:Alias for screensaver'
'shellsaver:Launch a whimsical terminal screensaver'
'shop:Open the Oh My Zsh shop'
'theme:Manage themes'
'update:Update Oh My Zsh'
@@ -38,12 +37,12 @@ function _omz {
if [[ "$words[2]" == (screensaver|shellsaver) ]] && (( CURRENT > 2 )); then
_arguments \
'1:command:(screensaver shellsaver)' \
'1:command:' \
'2::scene:(aquarium logo hermit party)' \
'--mono[Use the default foreground color]' \
'--seconds[Exit after a number of seconds]:seconds:' \
'--snapshot[Print a plain-text still]::frame:' \
'--help[Show screensaver help]'
'--help[Show Shellsaver help]'
return
fi
@@ -187,8 +186,7 @@ Available commands:
plugin <command> Manage plugins
pr <command> Manage Oh My Zsh Pull Requests
reload Reload the current zsh session
screensaver [scene] Launch a screensaver (aquarium by default)
shellsaver [scene] Alias for screensaver
shellsaver [scene] Launch a Shellsaver (aquarium by default)
shop Open the Oh My Zsh shop
theme <command> Manage themes
update Update Oh My Zsh
@@ -197,12 +195,13 @@ Available commands:
EOF
}
function _omz::screensaver {
function _omz::shellsaver {
command zsh -f "$ZSH/tools/screensaver.zsh" "$@"
}
function _omz::shellsaver {
_omz::screensaver "$@"
# Hidden alias; only shellsaver is advertised in help and command completion.
function _omz::screensaver {
_omz::shellsaver "$@"
}
function _omz::changelog {
+9 -11
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env zsh
# Shared on-demand renderer for `omz screensaver <scene>`.
# Shared on-demand renderer for `omz shellsaver <scene>`.
# The CLI launches a separate Zsh process, keeping all state out of the caller.
{
emulate -L zsh
@@ -12,12 +12,10 @@
local -a canvas inks palette
_zshell_usage() {
print -r -- 'Oh My Zsh / experimental screensavers
print -r -- 'Oh My Zsh / experimental Shellsavers
Usage: omz screensaver [aquarium|logo|hermit|party] [--mono] [--seconds N]
omz screensaver [aquarium|logo|hermit|party] --snapshot [FRAME]
Alias: omz shellsaver [scene] [options]
Usage: omz shellsaver [aquarium|logo|hermit|party] [--mono] [--seconds N]
omz shellsaver [aquarium|logo|hermit|party] --snapshot [FRAME]
aquarium Sea shells, a ~ hermit crab, and a quiet current (default).
logo The Oh My Zsh wordmark takes a bouncing coffee break.
@@ -36,7 +34,7 @@ Nothing is installed or enabled automatically.'
--help|-h) _zshell_usage; exit 0 ;;
''|--*) scene=aquarium ;;
aquarium|logo|hermit|party) scene=$1; shift ;;
*) print -u2 -r -- "omz screensaver: unknown scene: $1 (choose aquarium, logo, hermit, or party)"; exit 2 ;;
*) print -u2 -r -- "omz shellsaver: unknown scene: $1 (choose aquarium, logo, hermit, or party)"; exit 2 ;;
esac
while (( $# )); do
@@ -46,14 +44,14 @@ Nothing is installed or enabled automatically.'
--seconds)
shift
if [[ $1 != <1-3600> ]]; then
print -u2 -r -- 'omz screensaver: --seconds requires an integer from 1 to 3600'
print -u2 -r -- 'omz shellsaver: --seconds requires an integer from 1 to 3600'
exit 2
fi
seconds_limit=$1 ;;
--snapshot)
snapshot=1
if [[ ${2-} == <0-100000> ]]; then tick=$2; shift; fi ;;
*) print -u2 -r -- "omz screensaver: unknown argument: $1 (try --help)"; exit 2 ;;
*) print -u2 -r -- "omz shellsaver: unknown argument: $1 (try --help)"; exit 2 ;;
esac
shift
done
@@ -534,7 +532,7 @@ Nothing is installed or enabled automatically.'
exit 0
fi
if [[ ! -t 0 || ! -t 1 || -z $TERM || $TERM == dumb ]]; then
print -u2 -r -- 'omz screensaver: run in an interactive terminal (or use --snapshot)'
print -u2 -r -- 'omz shellsaver: run in an interactive terminal (or use --snapshot)'
exit 1
fi
zmodload zsh/terminfo || exit 1
@@ -542,7 +540,7 @@ Nothing is installed or enabled automatically.'
local capability
for capability in smcup rmcup home clear civis cnorm sgr0 el; do
if [[ -z ${terminfo[$capability]} ]]; then
print -u2 -r -- "omz screensaver: terminal lacks $capability; try --snapshot"
print -u2 -r -- "omz shellsaver: terminal lacks $capability; try --snapshot"
exit 1
fi
done