Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Set your desktop background to your screen saver.
# Install and activate with:
# curl -fsSL | bash
# The screen saver is visible only on desktops created before the screen saver
# was started. If you create a desktop and wish to see the screen saver on it
# immediately, just do:
# open -a ScreenSaverEngine
# to bring it in front of the default desktop background. You can also add
# /System/Library/Frameworks/ScreenSaver.framework/Resources/
# to the Dock and click it to bring it to the front of the desktop.
# ScreenSaverEngine uses minimal CPU when showing screen savers without
# animations and 0.0% CPU when the display is asleep. You can test this with:
# while true; do sleep 0.5; echo "$(date) $(pgrep ScreenSaverEngine | xargs ps -o '%cpu=' -p)"; done
# ScreenSaverEngine exits with exit code 0 after the screen is unlocked. The
# KeepAlive key is set to restart it in this case or if it crashes.
# To disable the screen saver desktop until next login:
# launchctl unload ~/Library/LaunchAgents/com.interestinglythere.backgroundsaver.plist
# To disable the screen saver desktop indefinitely:
# launchctl unload -wF ~/Library/LaunchAgents/com.interestinglythere.backgroundsaver.plist
# To un-disable the screen saver desktop:
# launchctl load -wF ~/Library/LaunchAgents/com.interestinglythere.backgroundsaver.plist
# To uninstall this:
# rm ~/Library/LaunchAgents/com.interestinglythere.backgroundsaver.plist
set -e
# Unload any previous versions of this launch agent
launchctl stop com.interestinglythere.backgroundsaver || true
launchctl unload ~/Library/LaunchAgents/com.interestinglythere.backgroundsaver.plist || true
# Write launch agent to file
cat << EOF > ~/Library/LaunchAgents/com.interestinglythere.backgroundsaver.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
# Load and start launch agent
launchctl load ~/Library/LaunchAgents/com.interestinglythere.backgroundsaver.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.