Skip to content

Instantly share code, notes, and snippets.

@firstspring1845
Last active August 29, 2015 13:57
Show Gist options
  • Save firstspring1845/9670322 to your computer and use it in GitHub Desktop.
Save firstspring1845/9670322 to your computer and use it in GitHub Desktop.
アイコンを変えるプラグインです、ショートカットキーを設定して使ってね
# -*- coding: utf-8 -*-
Plugin.create :icon_change do
require 'base64'
command(:icon_change,
name: 'アイコン変更',
condition: lambda{ |opt| true},
visible: false,
role: :window) do |opt|
dialog = Gtk::FileChooserDialog.new("Open Icon",
nil,
Gtk::FileChooser::ACTION_OPEN,
nil,
[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
[Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT])
if dialog.run == Gtk::Dialog::RESPONSE_ACCEPT
(Service.primary.twitter/'account/update_profile_image').json(:image => Base64.encode64(File.binread(dialog.filename))).next do |d|
activity :system, "アイコンを変更しました"
end
end
dialog.destroy
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment