Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Postboxに入力した内容をmikutterコマンドとして実行するmikutterプラグイン
# -*- coding: utf-8 -*-
Plugin.create :post_as_mikutter_command do
command(:post_as_mikutter_command,
name: 'mikutterコマンドとして実行',
condition: lambda{ |opt| Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text.size > 0 },
visible: true,
role: :postbox) do |opt|
begin
command = Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text
Plugin.call(:before_postbox_post, command)
result = Kernel.instance_eval(command)
Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text = ""
rescue Exception => e
Plugin.call(:update, nil, [Message.new(:message => e.to_s, :system => true)])
e.backtrace
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.