Skip to content

Instantly share code, notes, and snippets.

@meyer
Created September 23, 2015 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meyer/44ebe6b73cc82bc27ab2 to your computer and use it in GitHub Desktop.
Save meyer/44ebe6b73cc82bc27ab2 to your computer and use it in GitHub Desktop.
set-screensaver-message.rb
#!/usr/bin/env ruby
require 'optparse'
OptionParser.new do |opts|
opts.on("-w", "--write", "Write new screensaver message") do |msg|
old_msg = `defaults -currentHost read com.apple.ScreenSaver.Basic MESSAGE`
system(
'defaults',
'-currentHost',
'write',
'com.apple.ScreenSaver.Basic',
'MESSAGE',
msg
)
puts "Replaced '#{old_msg}' with '#{msg}'"
end
end.parse!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment