Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created April 19, 2013 03:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jugyo/5417982 to your computer and use it in GitHub Desktop.
Save jugyo/5417982 to your computer and use it in GitHub Desktop.
earthquake.gem plugin to start screensaver remotely!
# encoding: utf-8
Earthquake.init do
_ = config[:screensaver] ||= {}
_[:pattern] ||= /screen ?saver|スクリーンセーバー/i
_[:command] ||= %(open -a /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app)
output_filter do |item|
next unless item["_stream"] && item["text"]
next unless item["user"]["screen_name"] == twitter.info["screen_name"]
if item["text"] =~ _[:pattern]
puts 'Starting Screen Saver…'.c(:info)
system _[:command]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment