Skip to content

Instantly share code, notes, and snippets.

@boxp
Created November 4, 2013 18:23
Show Gist options
  • Save boxp/7306994 to your computer and use it in GitHub Desktop.
Save boxp/7306994 to your computer and use it in GitHub Desktop.
Grimoireのプラグイン一例です.~/.grimoire/plugin/にこのコードを保存したファイルを配置する事で,ツイートをコピー出来るようになります.
(do
; 名前空間の束縛はdo内で行なって下さい
(import '(javafx.scene.input Clipboard ClipboardContent))
; プラグインを作成
; それぞれnilの部分を書き換えて,プラグインの処理を書いて下さい.
(reify Plugin
; 右クリックメニューの名前を返します
(get-name [this] "クリップボードへコピー")
; ツイート(status)を受信した際に呼ばれる
(on-status [this status] nil)
; RTを(status)を受信した際に呼ばれる
(on-rt [this status] nil)
; RTの取り消し(status)を受信した際に呼ばれる
(on-unrt [this status] nil)
; ふぁぼ(status)を受信した際に呼ばれる
(on-fav [this source target status] nil)
; あんふぁぼ(status)を受信した際に呼ばれる
(on-unfav [this source target status] nil)
; つい消し(status)を受信した際に呼ばれる
(on-del [this status] nil)
; フォローされた際に呼ばれる(source:フォロー user
(on-follow [this source user] nil)
; ダイレクトメッセージ受信時に呼ばれる
(on-dm [this dm] nil)
; 起動時に呼ばれる
(on-start [this] nil)
; 右クリックメニューからクリックした際に呼ばれる
(on-click [this e]
(let [cb (Clipboard/getSystemClipboard)
txt (. (focused-status) getText)
cbc (doto (ClipboardContent.)
(.putString txt))]
(.setContent cb cbc)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment