Permalink
Browse files

Add support for Photos app with custom emoji support

  • Loading branch information...
1 parent c829ef9 commit 2393677e9d8e486fc9cebeda1184429e31c58e72 @KrauseFx committed Dec 5, 2016
Showing with 27 additions and 9 deletions.
  1. +27 โˆ’9 overkill.rb
View
@@ -1,21 +1,39 @@
module Overkill
class Monitor
def run
- loop do
- output = `ps aux | grep iTunes`.split("\n")
- output.each do |current|
- next if current.include?("iTunesHelper")
- next unless current.include?("/Applications/iTunes.app/Contents/MacOS/iTunes")
+ output = `ps aux | grep -E "#{apps_to_kill.keys.join('|')}"`.split("\n")
+ output.each do |current|
+ next if blacklist.any? { |a| current.include?(a) }
+
+ apps_to_kill.each do |app_name, emoji|
+ next unless current.include?("/Applications/#{app_name}.app/Contents/MacOS/#{app_name}")
- puts "iTunes launched itself, killing the process now... ๐Ÿ’ฅ๐ŸŽต"
- `killall iTunes`
+ puts "#{app_name} launched itself, killing the process now... ๐Ÿ’ฅ #{emoji}"
+ `killall #{app_name}`
end
- sleep 0.1
end
+ sleep 0.1
+ end
+
+ def apps_to_kill
+ apps = {
+ "iTunes" => "๐ŸŽต"
+ }
+ apps["Photos"] = "๐Ÿ–ผ" if ENV["KILL_PHOTOS"]
+
+ apps
+ end
+
+ def blacklist
+ [
+ "iTunesHelper"
+ ]
end
def self.start
- self.new.run
+ loop do
+ self.new.run
+ end
end
end
end

0 comments on commit 2393677

Please sign in to comment.