Last active
March 21, 2016 16:02
-
-
Save eddiefisher/ada6e56e714090092e5d to your computer and use it in GitHub Desktop.
Revisions
-
eddiefisher revised this gist
Mar 21, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ case event when "MSG" case arg1 when "IN" if filename && File.exists?(filename) file = File.open(filename).to_a msg = file.last[26..-1] else -
eddiefisher revised this gist
Mar 21, 2016 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,8 @@ log.write "#{event}, #{arg1}, #{arg2}, #{filename}\n" log.write "filename: #{filename}\n" def notify(msg, arg2) # TerminalNotifier.notify(msg, title: "Mcabber", subtitle: "#{arg2}", sound: 'default', activate: 'com.apple.Terminal') # terminal TerminalNotifier.notify(msg, title: "Mcabber", subtitle: "#{arg2}", sound: 'default', activate: 'com.googlecode.iterm2') # iterm2 end case event -
eddiefisher created this gist
Mar 16, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ #!/usr/bin/env ruby require 'terminal-notifier' event, arg1, arg2, filename = ARGV history = "#{Dir.home}/.mcabber/histo" filename = "#{history}/#{arg2}" log = File.open "#{Dir.home}/.mcabber/eventcmd.log", 'a' log.write "#{event}, #{arg1}, #{arg2}, #{filename}\n" log.write "filename: #{filename}\n" def notify(msg, arg2) TerminalNotifier.notify(msg, title: "Mcabber", subtitle: "#{arg2}", sound: 'default', activate: 'com.apple.Terminal', sender: 'com.apple.Terminal') end case event when "MSG" case arg1 when "IN" if filename and File.exists?(filename) file = File.open(filename).to_a msg = file.last[26..-1] else msg = "file not found" end notify(msg, arg2) when "OUT" end when "STATUS" msg = { "O" => "online", "F" => "chat", "A" => "away", "N" => "xa", "D" => "dnd", "I" => "invisible", "_" => "offline", "?" => "error", "X" => "requested" }[arg1.to_s] notify(msg, arg2) when "UNREAD" end