Skip to content

Instantly share code, notes, and snippets.

@orumin
Created October 21, 2013 23:53
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 orumin/7092898 to your computer and use it in GitHub Desktop.
Save orumin/7092898 to your computer and use it in GitHub Desktop.
mikutter 0.2.2.1373をWindowsで使えるようにし、popup通知をgrowlで行えるようにするパッチ
diff -urN mikutter.orig/core/mui/gtk_postbox.rb mikutter/core/mui/gtk_postbox.rb
--- mikutter.orig/core/mui/gtk_postbox.rb 2013-10-22 08:30:44.330987100 +0900
+++ mikutter/core/mui/gtk_postbox.rb 2013-10-21 19:50:11.893088600 +0900
@@ -138,7 +138,7 @@
text = widget_post.buffer.text
text += UserConfig[:footer] if add_footer?
@posting = service.post(:message => text){ |event, msg|
- notice [event, msg].inspect
+ # notice [event, msg].inspect
case event
when :start
Delayer.new{ start_post }
diff -urN mikutter.orig/core/plugin/libnotify/libnotify.rb mikutter/core/plugin/libnotify/libnotify.rb
--- mikutter.orig/core/plugin/libnotify/libnotify.rb 2013-10-22 08:30:45.313043300 +0900
+++ mikutter/core/plugin/libnotify/libnotify.rb 2013-10-22 08:18:38.318461600 +0900
@@ -7,4 +7,7 @@
elsif command_exist? 'notify-send' # notify-sendコマンドが有る場合
notice 'notify: use notify-send'
require File.expand_path File.join(File.dirname(__FILE__), 'notify-send')
+elsif require_if_exist('ruby_gntp') #ruby_gntp(Growl)が使える場合
+ notice 'notify: use rgrowl'
+ require File.expand_path File.join(File.dirname(__FILE__), 'rgntp')
end
diff -urN mikutter.orig/core/plugin/libnotify/rgntp.rb mikutter/core/plugin/libnotify/rgntp.rb
--- mikutter.orig/core/plugin/libnotify/rgntp.rb 1970-01-01 09:00:00.000000000 +0900
+++ mikutter/core/plugin/libnotify/rgntp.rb 2013-10-22 08:27:30.470899000 +0900
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+
+require 'rubygems'
+require 'ruby_gntp'
+
+Plugin::create(:libnotify) do
+ on_popup_notify do |user, text, &stop|
+
+ icon = nil
+ title = nil
+ category = nil
+ timeout = UserConfig[:notify_expire_time].to_i * 1000
+
+ if text.is_a? Message
+ text = text.to_s
+ end
+
+ if user
+ icon = Gdk::WebImageLoader.local_path(user[:profile_image_url])
+ title = "@#{user[:idname]} (#{user[:name]})"
+ end
+
+ g = GNTP.new "mikutter"
+ g.register({
+ :app_icon => File.join(File.dirname(__FILE__), "../../skin/data/icon.png"),
+ :notifications => [{
+ :name => "notification",
+ :enabled => true,
+ }]
+ })
+
+ g.notify({
+ :name => "notification",
+ :title => title,
+ :text => text,
+ :icon => icon
+ })
+
+ stop.call
+ end
+end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment